Current filter:
                                You should refresh the page.
                                  • I would like to know the best method to report progress in a long running action in XAF.
                                    My action controller runs in both the web and windows modules.
                                    Obviously for a windows based module I could show a dialog with a progress bar. What I would like to know is what is currently best practices in regard to displaying progress information.
                                    It would also be ideal if the progress info view could also have cancel mechanism.
                                    Thanks in advance,
                                    Kavan

                                1 Solution

                                Creation Date Importance Sort by

                                Hi Kavan
                                For a windows application, you can create a simple progress bar with the cancel mechanism as shown in my code below. For this
                                purpose a new form will be created with our two controls: the SimpleButton and the ProgressBarControl. For a long running action I
                                choose the creation of hundred objects. If the Cancel button or Esc key was pressed while the process is running, the progress will be
                                stopped.
                                As for the web application, it is not trivial to implement the functionality as that found in winapp.

                                [C#]
                                private void simpleAction1_Execute(object sender, SimpleActionExecuteEventArgs e) { using (Form form = new Form()) { ProgressBarControl progressBarControl = new ProgressBarControl(); SimpleButton cancelProgress = new SimpleButton(); form.Size = new Size(200, 50); form.TopMost = true; form.FormBorderStyle = FormBorderStyle.FixedToolWindow; form.AutoSizeMode = AutoSizeMode.GrowAndShrink; form.CancelButton = cancelProgress; form.StartPosition = FormStartPosition.CenterScreen; form.FormBorderStyle = FormBorderStyle.None; form.Controls.Add((Control)progressBarControl); form.Controls.Add((Control)cancelProgress); cancelProgress.Dock = DockStyle.Right; cancelProgress.Text = "Cancel"; cancelProgress.Size = new Size(50, 50); cancelProgress.Click += new EventHandler(cancelProgress_Click); progressBarControl.Size = new Size(150, 50); progressBarControl.Dock = DockStyle.Left; progressBarControl.Properties.Step = 1; progressBarControl.Properties.PercentView = true; progressBarControl.Properties.Maximum = 100; progressBarControl.Properties.Minimum = 0; form.Show(); for (int i = 0; i < 100; i++) { ((DevExpress.ExpressApp.ListView)View).CollectionSource.Add(new Something(View.ObjectSpace.Session)); progressBarControl.PerformStep(); cancelProgress.Update(); System.Windows.Forms.Application.DoEvents(); } form.Close(); } } void cancelProgress_Click(object sender, EventArgs e) { //... //your rollback implementation ( (Form) (((SimpleButton)sender).Parent)).Close(); throw new Exception("The rollback method is not implemented."); } private void ViewController1_Activated(object sender, EventArgs e) { CreateAction.SetActiveByKey("", View.Id == Application.GetListViewId(typeof(Something))); }

                                There is a complete sample in the attachment.
                                Please let me know if this helps.
                                Thanks
                                 Den

                                Show all comments
                                • Kavan Shaban 07.24.2007

                                  What would be the best pattern to follow for a web-based mechanism?

                                • Dennis (DevExpress Support) 07.25.2007

                                  Hi Kavan,
                                  Thank you for the report. We are working on this problem and will post a solution once it is found. Please bear with us.
                                  Thanks
                                    Den

                                • Dennis (DevExpress Support) 07.25.2007

                                  Hi Kavan
                                  Unfortunately, with the current version, there is no way to implement a progress bar in the XAF web application.
                                  The only immediate solution we see is to create your own web application and bind it to the BO logic without creating the XAF web application.
                                  Thanks
                                   Den

                                • Lukasz Stanczyk 2 04.17.2013

                                  Dennis - if i wanted to use

                                  [C#]
                                  form.FormBorderStyle = FormBorderStyle.FixedDialog;

                                  How can i force it to have look and feel matching the rest of XAF application?

                                • Dennis (DevExpress Support) 04.18.2013

                                  @Lukasz: I suggest that you use the XtraForm class instead of a standard Form class.
                                  Refer to the "%Public%\Documents\DXperience 12.2 Demos\eXpressApp Framework\FeatureCenter\CS\FeatureCenter.Module.Win\ProgressForm.cs" file for an example.
                                  Alternatively, you can use the built-in wait form (a part of the SplashScreenManager component).
                                  If these solutions do not meet your needs, then please create a separate ticket, and describe your issue in greater detail.

                                • LarsPL 07.19.2015

                                  Hi Dennis,

                                  is there any solution now possible in WEB.AXF too?

                                  Hope for a fast reply Regards Lars

                                • Dennis (DevExpress Support) 07.20.2015

                                  Hi Lars,

                                  I'll answer you in the XAF Web Progress Bar for long running process ticket you created. Thanks.