Changeset 10538 for branches/DataPreprocessing/HeuristicLab.Optimizer
- Timestamp:
- 03/05/14 14:48:13 (11 years ago)
- Location:
- branches/DataPreprocessing
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/DataPreprocessing
- Property svn:mergeinfo changed
-
branches/DataPreprocessing/HeuristicLab.Optimizer/3.3/OptimizerDockingMainForm.cs
r9456 r10538 86 86 protected override void OnClosing(CancelEventArgs e) { 87 87 base.OnClosing(e); 88 if (MainFormManager.MainForm.Views.OfType<IContentView>(). FirstOrDefault() != null) {88 if (MainFormManager.MainForm.Views.OfType<IContentView>().Any(v=>v.Content is IStorableContent)) { 89 89 if (MessageBox.Show(this, "Some views are still opened. If their content has not been saved, it will be lost after closing. Do you really want to close HeuristicLab Optimizer?", "Close Optimizer", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1) == DialogResult.No) 90 90 e.Cancel = true; … … 110 110 else { 111 111 IContentView activeView = ActiveView as IContentView; 112 if ((activeView != null) && (activeView.Content != null) && (activeView.Contentis IStorableContent)) {112 if ((activeView != null) && (activeView.Content is IStorableContent)) { 113 113 IStorableContent content = (IStorableContent)activeView.Content; 114 114 Title = title + " [" + (string.IsNullOrEmpty(content.Filename) ? "Unsaved" : content.Filename) + "]"; -
branches/DataPreprocessing/HeuristicLab.Optimizer/3.3/OptimizerMultipleDocumentMainForm.cs
r9456 r10538 86 86 protected override void OnClosing(CancelEventArgs e) { 87 87 base.OnClosing(e); 88 if (MainFormManager.MainForm.Views.OfType<IContentView>(). FirstOrDefault() != null) {88 if (MainFormManager.MainForm.Views.OfType<IContentView>().Any(v => v.Content is IStorableContent)) { 89 89 if (MessageBox.Show(this, "Some views are still opened. If their content has not been saved, it will be lost after closing. Do you really want to close HeuristicLab Optimizer?", "Close Optimizer", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1) == DialogResult.No) 90 90 e.Cancel = true; … … 110 110 else { 111 111 IContentView activeView = ActiveView as IContentView; 112 if ((activeView != null) && (activeView.Content != null) && (activeView.Contentis IStorableContent)) {112 if ((activeView != null) && (activeView.Content is IStorableContent)) { 113 113 IStorableContent content = (IStorableContent)activeView.Content; 114 114 Title = title + " [" + (string.IsNullOrEmpty(content.Filename) ? "Unsaved" : content.Filename) + "]"; -
branches/DataPreprocessing/HeuristicLab.Optimizer/3.3/OptimizerSingleDocumentMainForm.cs
r9456 r10538 86 86 protected override void OnClosing(CancelEventArgs e) { 87 87 base.OnClosing(e); 88 if (MainFormManager.MainForm.Views.OfType<IContentView>(). FirstOrDefault() != null) {88 if (MainFormManager.MainForm.Views.OfType<IContentView>().Any(v => v.Content is IStorableContent)) { 89 89 if (MessageBox.Show(this, "Some views are still opened. If their content has not been saved, it will be lost after closing. Do you really want to close HeuristicLab Optimizer?", "Close Optimizer", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1) == DialogResult.No) 90 90 e.Cancel = true; … … 110 110 else { 111 111 IContentView activeView = ActiveView as IContentView; 112 if ((activeView != null) && (activeView.Content != null) && (activeView.Contentis IStorableContent)) {112 if ((activeView != null) && (activeView.Content is IStorableContent)) { 113 113 IStorableContent content = (IStorableContent)activeView.Content; 114 114 Title = title + " [" + (string.IsNullOrEmpty(content.Filename) ? "Unsaved" : content.Filename) + "]"; -
branches/DataPreprocessing/HeuristicLab.Optimizer/3.3/StartPage.cs
r9907 r10538 70 70 private void LoadSamples(object state) { 71 71 progress = MainFormManager.GetMainForm<HeuristicLab.MainForm.WindowsForms.MainForm>().AddOperationProgressToView(samplesListView, "Loading..."); 72 Assembly assembly = Assembly.GetExecutingAssembly(); 73 var samples = assembly.GetManifestResourceNames().Where(x => x.EndsWith(".hl")); 74 int count = samples.Count(); 75 string path = Path.GetTempFileName(); 72 try { 73 Assembly assembly = Assembly.GetExecutingAssembly(); 74 var samples = assembly.GetManifestResourceNames().Where(x => x.EndsWith(".hl")); 75 int count = samples.Count(); 76 string path = Path.GetTempFileName(); 76 77 77 foreach (string name in samples) { 78 try { 79 using (Stream stream = assembly.GetManifestResourceStream(name)) { 80 WriteStreamToTempFile(stream, path); 81 INamedItem item = XmlParser.Deserialize<INamedItem>(path); 82 OnSampleLoaded(item, 1.0 / count); 78 foreach (string name in samples) { 79 try { 80 using (Stream stream = assembly.GetManifestResourceStream(name)) { 81 WriteStreamToTempFile(stream, path); 82 INamedItem item = XmlParser.Deserialize<INamedItem>(path); 83 OnSampleLoaded(item, 1.0 / count); 84 } 85 } 86 catch (Exception) { 83 87 } 84 88 } 85 catch (Exception) { 86 MainFormManager.GetMainForm<HeuristicLab.MainForm.WindowsForms.MainForm>().RemoveOperationProgressFromView(samplesListView); 87 } 89 OnAllSamplesLoaded(); 88 90 } 89 OnAllSamplesLoaded(); 91 finally { 92 MainFormManager.GetMainForm<HeuristicLab.MainForm.WindowsForms.MainForm>().RemoveOperationProgressFromView(samplesListView); 93 } 90 94 } 91 95 private void OnSampleLoaded(INamedItem sample, double progress) { … … 111 115 samplesListView.Columns[i].AutoResize(ColumnHeaderAutoResizeStyle.ColumnContent); 112 116 } 113 MainFormManager.GetMainForm<HeuristicLab.MainForm.WindowsForms.MainForm>().RemoveOperationProgressFromView(samplesListView);114 117 } 115 118 }
Note: See TracChangeset
for help on using the changeset viewer.