Free cookie consent management tool by TermsFeed Policy Generator

Changeset 9851


Ignore:
Timestamp:
08/06/13 12:15:20 (11 years ago)
Author:
jkarder
Message:

#1042: fixed file name shown in ProgressView overlays

File:
1 edited

Legend:

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

    r9849 r9851  
    9999        else {
    100100          MainFormManager.GetMainForm<HeuristicLab.MainForm.WindowsForms.MainForm>().SetAppStartingCursor();
    101           SetEnabledStateOfContentViews(content, false);
     101          SetSaveOperationProgressInContentViews(content, true);
    102102          ContentManager.SaveAsync(content, content.Filename, true, SavingCompleted);
    103103        }
     
    124124        if (saveFileDialog.ShowDialog() == DialogResult.OK) {
    125125          MainFormManager.GetMainForm<HeuristicLab.MainForm.WindowsForms.MainForm>().SetAppStartingCursor();
    126           SetEnabledStateOfContentViews(content, false);
     126          SetSaveOperationProgressInContentViews(content, true, saveFileDialog.FileName);
    127127          if (saveFileDialog.FilterIndex == 1) {
    128128            ContentManager.SaveAsync(content, saveFileDialog.FileName, false, SavingCompleted);
     
    142142      }
    143143      finally {
    144         SetEnabledStateOfContentViews(content, true);
     144        SetSaveOperationProgressInContentViews(content, false);
    145145        MainFormManager.GetMainForm<HeuristicLab.MainForm.WindowsForms.MainForm>().ResetAppStartingCursor();
    146146      }
    147147    }
    148148
    149     private static void SetEnabledStateOfContentViews(IStorableContent content, bool enabled) {
     149    private static void SetSaveOperationProgressInContentViews(IStorableContent content, bool showProgress, string fileName = null) {
    150150      HeuristicLab.MainForm.WindowsForms.MainForm mainForm = MainFormManager.GetMainForm<HeuristicLab.MainForm.WindowsForms.MainForm>();
    151151      #region Mono Compatibility
    152152      // removed the InvokeRequired check because of Mono
    153153      mainForm.Invoke((Action)delegate {
    154         if (enabled)
     154        if (showProgress) {
     155          var progress = new Progress(string.Format("Saving file \"{0}\"...", Path.GetFileName(fileName ?? content.Filename)));
     156          mainForm.AddOperationProgressToContent(content, progress);
     157        } else
    155158          mainForm.RemoveOperationProgressFromContent(content);
    156         else
    157           mainForm.AddOperationProgressToContent(content, new Progress(string.Format("Saving file \"{0}\"...", Path.GetFileName(content.Filename))));
    158159      });
    159160      #endregion
Note: See TracChangeset for help on using the changeset viewer.