Changeset 10488
- Timestamp:
- 02/20/14 15:34:31 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Optimizer/3.3/StartPage.cs
r9907 r10488 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.