Changeset 11012 for trunk/sources


Ignore:
Timestamp:
06/12/14 14:15:20 (8 years ago)
Author:
mkommend
Message:

#2198: Improved file name suggestion when saving contents for the first time.

File:
1 edited

Legend:

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

    r9901 r11012  
    2525using System.Windows.Forms;
    2626using HeuristicLab.Common;
     27using HeuristicLab.Core;
    2728using HeuristicLab.MainForm;
    2829using HeuristicLab.PluginInfrastructure;
     
    120121          saveFileDialog.FilterIndex = 2;
    121122        }
    122         saveFileDialog.FileName = string.IsNullOrEmpty(content.Filename) ? "Item" : content.Filename;
     123
     124        INamedItem namedItem = content as INamedItem;
     125        string suggestedFileName = string.Empty;
     126        if (!string.IsNullOrEmpty(content.Filename)) suggestedFileName = content.Filename;
     127        else if (namedItem != null) suggestedFileName = namedItem.Name;
     128        else suggestedFileName = "Item";
     129
     130        saveFileDialog.FileName = suggestedFileName;
    123131
    124132        if (saveFileDialog.ShowDialog() == DialogResult.OK) {
Note: See TracChangeset for help on using the changeset viewer.