Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
08/05/13 16:16:31 (11 years ago)
Author:
jkarder
Message:

#1042: ProgressView overlays are now shown to indicate save operations

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Optimizer/3.3/FileManager.cs

    r9456 r9849  
    2222using System;
    2323using System.Collections.Generic;
    24 using System.Linq;
     24using System.IO;
    2525using System.Windows.Forms;
    2626using HeuristicLab.Common;
     
    9898          SaveAs(view);
    9999        else {
    100           ((MainForm.WindowsForms.MainForm)MainFormManager.MainForm).SetAppStartingCursor();
     100          MainFormManager.GetMainForm<HeuristicLab.MainForm.WindowsForms.MainForm>().SetAppStartingCursor();
    101101          SetEnabledStateOfContentViews(content, false);
    102102          ContentManager.SaveAsync(content, content.Filename, true, SavingCompleted);
     
    123123
    124124        if (saveFileDialog.ShowDialog() == DialogResult.OK) {
    125           ((MainForm.WindowsForms.MainForm)MainFormManager.MainForm).SetAppStartingCursor();
     125          MainFormManager.GetMainForm<HeuristicLab.MainForm.WindowsForms.MainForm>().SetAppStartingCursor();
    126126          SetEnabledStateOfContentViews(content, false);
    127127          if (saveFileDialog.FilterIndex == 1) {
     
    135135    private static void SavingCompleted(IStorableContent content, Exception error) {
    136136      try {
    137         SetEnabledStateOfContentViews(content, true);
    138137        if (error != null) throw error;
    139138        MainFormManager.GetMainForm<HeuristicLab.MainForm.WindowsForms.MainForm>().UpdateTitle();
     
    143142      }
    144143      finally {
    145         ((MainForm.WindowsForms.MainForm)MainFormManager.MainForm).ResetAppStartingCursor();
     144        SetEnabledStateOfContentViews(content, true);
     145        MainFormManager.GetMainForm<HeuristicLab.MainForm.WindowsForms.MainForm>().ResetAppStartingCursor();
    146146      }
    147147    }
     
    152152      // removed the InvokeRequired check because of Mono
    153153      mainForm.Invoke((Action)delegate {
    154         var views = MainFormManager.MainForm.Views.OfType<IContentView>().Where(v => v.Content == content).ToList();
    155         views.ForEach(v => v.Enabled = enabled);
     154        if (enabled)
     155          mainForm.RemoveOperationProgressFromContent(content);
     156        else
     157          mainForm.AddOperationProgressToContent(content, new Progress(string.Format("Saving file \"{0}\"...", Path.GetFileName(content.Filename))));
    156158      });
    157159      #endregion
Note: See TracChangeset for help on using the changeset viewer.