- Timestamp:
- 11/16/17 10:30:21 (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/EnhancedProgress/HeuristicLab.DataPreprocessing.Views/3.4/DataPreprocessingView.cs
r15446 r15477 169 169 await Task.Run(() => { 170 170 TProblemData instance; 171 var mainForm = (MainForm.WindowsForms.MainForm)MainFormManager.MainForm;172 171 // lock active view and show progress bar 173 var activeView = (IContentView)MainFormManager.MainForm.ActiveView;174 172 175 173 try { 176 var progress = mainForm.AddOperationProgressToContent(activeView.Content, "Loading problem instance.", 0); 177 174 var progress = Progress.Show(Content, "Loading problem instance."); 178 175 instanceProvider.ProgressChanged += (o, args) => { progress.ProgressValue = args.ProgressPercentage / 100.0; }; 179 176 … … 181 178 } catch (IOException ex) { 182 179 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); 184 181 return; 185 182 } … … 189 186 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"); 190 187 } finally { 191 mainForm.RemoveOperationProgressFromContent(activeView.Content);188 Progress.Hide(Content); 192 189 } 193 190 }); … … 226 223 var storable = itemCreator() as IStorableContent; 227 224 if (storable != null) { 228 var mainForm = (MainForm.WindowsForms.MainForm)MainFormManager.MainForm;229 var activeView = (IContentView)MainFormManager.MainForm.ActiveView;230 225 try { 231 mainForm.AddOperationProgressToContent(activeView.Content, "Exporting data.");226 Progress.ShowMarquee(Content, "Exporting data."); 232 227 ContentManager.Save(storable, saveFileDialog.FileName, compressed); 233 228 } finally { 234 mainForm.RemoveOperationProgressFromContent(activeView.Content);229 Progress.Hide(Content); 235 230 } 236 231 } … … 248 243 if (saveFileDialog.ShowDialog() == DialogResult.OK) { 249 244 Task.Run(() => { 250 var mainForm = (MainForm.WindowsForms.MainForm)MainFormManager.MainForm;251 var activeView = (IContentView)MainFormManager.MainForm.ActiveView;252 245 try { 253 246 var problemData = Content.CreateNewProblemData(); 254 mainForm.AddOperationProgressToContent(activeView.Content, "Exporting data.");247 Progress.ShowMarquee(Content, "Exporting data."); 255 248 if (problemData is TimeSeriesPrognosisProblemData) 256 249 Export(new TimeSeriesPrognosisCSVInstanceProvider(), problemData, saveFileDialog.FileName); … … 260 253 Export(new ClassificationCSVInstanceProvider(), problemData, saveFileDialog.FileName); 261 254 } finally { 262 mainForm.RemoveOperationProgressFromContent(activeView.Content);255 Progress.Hide(Content); 263 256 } 264 257 });
Note: See TracChangeset
for help on using the changeset viewer.