Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
03/05/14 14:48:13 (11 years ago)
Author:
pfleck
Message:
  • merged trunk
Location:
branches/DataPreprocessing
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • branches/DataPreprocessing

  • branches/DataPreprocessing/HeuristicLab.Optimizer/3.3/OptimizerDockingMainForm.cs

    r9456 r10538  
    8686    protected override void OnClosing(CancelEventArgs e) {
    8787      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)) {
    8989        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)
    9090          e.Cancel = true;
     
    110110      else {
    111111        IContentView activeView = ActiveView as IContentView;
    112         if ((activeView != null) && (activeView.Content != null) && (activeView.Content is IStorableContent)) {
     112        if ((activeView != null) && (activeView.Content is IStorableContent)) {
    113113          IStorableContent content = (IStorableContent)activeView.Content;
    114114          Title = title + " [" + (string.IsNullOrEmpty(content.Filename) ? "Unsaved" : content.Filename) + "]";
  • branches/DataPreprocessing/HeuristicLab.Optimizer/3.3/OptimizerMultipleDocumentMainForm.cs

    r9456 r10538  
    8686    protected override void OnClosing(CancelEventArgs e) {
    8787      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)) {
    8989        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)
    9090          e.Cancel = true;
     
    110110      else {
    111111        IContentView activeView = ActiveView as IContentView;
    112         if ((activeView != null) && (activeView.Content != null) && (activeView.Content is IStorableContent)) {
     112        if ((activeView != null) && (activeView.Content is IStorableContent)) {
    113113          IStorableContent content = (IStorableContent)activeView.Content;
    114114          Title = title + " [" + (string.IsNullOrEmpty(content.Filename) ? "Unsaved" : content.Filename) + "]";
  • branches/DataPreprocessing/HeuristicLab.Optimizer/3.3/OptimizerSingleDocumentMainForm.cs

    r9456 r10538  
    8686    protected override void OnClosing(CancelEventArgs e) {
    8787      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)) {
    8989        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)
    9090          e.Cancel = true;
     
    110110      else {
    111111        IContentView activeView = ActiveView as IContentView;
    112         if ((activeView != null) && (activeView.Content != null) && (activeView.Content is IStorableContent)) {
     112        if ((activeView != null) && (activeView.Content is IStorableContent)) {
    113113          IStorableContent content = (IStorableContent)activeView.Content;
    114114          Title = title + " [" + (string.IsNullOrEmpty(content.Filename) ? "Unsaved" : content.Filename) + "]";
  • branches/DataPreprocessing/HeuristicLab.Optimizer/3.3/StartPage.cs

    r9907 r10538  
    7070    private void LoadSamples(object state) {
    7171      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();
    7677
    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) {
    8387          }
    8488        }
    85         catch (Exception) {
    86           MainFormManager.GetMainForm<HeuristicLab.MainForm.WindowsForms.MainForm>().RemoveOperationProgressFromView(samplesListView);
    87         }
     89        OnAllSamplesLoaded();
    8890      }
    89       OnAllSamplesLoaded();
     91      finally {
     92        MainFormManager.GetMainForm<HeuristicLab.MainForm.WindowsForms.MainForm>().RemoveOperationProgressFromView(samplesListView);
     93      }
    9094    }
    9195    private void OnSampleLoaded(INamedItem sample, double progress) {
     
    111115            samplesListView.Columns[i].AutoResize(ColumnHeaderAutoResizeStyle.ColumnContent);
    112116        }
    113         MainFormManager.GetMainForm<HeuristicLab.MainForm.WindowsForms.MainForm>().RemoveOperationProgressFromView(samplesListView);
    114117      }
    115118    }
Note: See TracChangeset for help on using the changeset viewer.