Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
11/16/17 10:30:21 (7 years ago)
Author:
pfleck
Message:

#2845

  • Added an explicit method for StartMarquee.
  • Renamed Add/RemoveOperationProgress methods.
  • Moved progress helpers from MainForm into static Progress methods named Show and Hide.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/EnhancedProgress/HeuristicLab.DataPreprocessing.Views/3.4/DataPreprocessingView.cs

    r15446 r15477  
    169169        await Task.Run(() => {
    170170          TProblemData instance;
    171           var mainForm = (MainForm.WindowsForms.MainForm)MainFormManager.MainForm;
    172171          // lock active view and show progress bar
    173           var activeView = (IContentView)MainFormManager.MainForm.ActiveView;
    174172
    175173          try {
    176             var progress = mainForm.AddOperationProgressToContent(activeView.Content, "Loading problem instance.", 0);
    177 
     174            var progress = Progress.Show(Content, "Loading problem instance.");
    178175            instanceProvider.ProgressChanged += (o, args) => { progress.ProgressValue = args.ProgressPercentage / 100.0; };
    179176
     
    181178          } catch (IOException ex) {
    182179            MessageBox.Show(string.Format("There was an error parsing the file: {0}", Environment.NewLine + ex.Message), "Error while parsing", MessageBoxButtons.OK, MessageBoxIcon.Error);
    183             mainForm.RemoveOperationProgressFromContent(activeView.Content);
     180            Progress.Hide(Content);
    184181            return;
    185182          }
     
    189186            MessageBox.Show(string.Format("This problem does not support loading the instance {0}: {1}", Path.GetFileName(importDialog.Path), Environment.NewLine + ex.Message), "Cannot load instance");
    190187          } finally {
    191             mainForm.RemoveOperationProgressFromContent(activeView.Content);
     188            Progress.Hide(Content);
    192189          }
    193190        });
     
    226223          var storable = itemCreator() as IStorableContent;
    227224          if (storable != null) {
    228             var mainForm = (MainForm.WindowsForms.MainForm)MainFormManager.MainForm;
    229             var activeView = (IContentView)MainFormManager.MainForm.ActiveView;
    230225            try {
    231               mainForm.AddOperationProgressToContent(activeView.Content, "Exporting data.");
     226              Progress.ShowMarquee(Content, "Exporting data.");
    232227              ContentManager.Save(storable, saveFileDialog.FileName, compressed);
    233228            } finally {
    234               mainForm.RemoveOperationProgressFromContent(activeView.Content);
     229              Progress.Hide(Content);
    235230            }
    236231          }
     
    248243      if (saveFileDialog.ShowDialog() == DialogResult.OK) {
    249244        Task.Run(() => {
    250           var mainForm = (MainForm.WindowsForms.MainForm)MainFormManager.MainForm;
    251           var activeView = (IContentView)MainFormManager.MainForm.ActiveView;
    252245          try {
    253246            var problemData = Content.CreateNewProblemData();
    254             mainForm.AddOperationProgressToContent(activeView.Content, "Exporting data.");
     247            Progress.ShowMarquee(Content, "Exporting data.");
    255248            if (problemData is TimeSeriesPrognosisProblemData)
    256249              Export(new TimeSeriesPrognosisCSVInstanceProvider(), problemData, saveFileDialog.FileName);
     
    260253              Export(new ClassificationCSVInstanceProvider(), problemData, saveFileDialog.FileName);
    261254          } finally {
    262             mainForm.RemoveOperationProgressFromContent(activeView.Content);
     255            Progress.Hide(Content);
    263256          }
    264257        });
Note: See TracChangeset for help on using the changeset viewer.