//may be used as-is, or overridden to handle differently public virtual void FileNew() { StatusMessage = String.Empty; ErrorMessage = String.Empty; try { StartProgressBar("New...", null, _actionIconImages["New"], true, 33); if (SettingsController <TSettings> .Settings.Dirty) { //prompt before saving DialogResult messageBoxResult = MessageBox.Show("Save changes?", SettingsController <TSettings> .FilePath, MessageBoxButtons.YesNo, MessageBoxIcon.Question); switch (messageBoxResult) { case DialogResult.Yes: { //SAVE FileSaveAs(); break; } case DialogResult.No: { break; } default: { throw new InvalidEnumArgumentException(); } } } //NEW if ( !SettingsController <TSettings> .New() ) { throw new ApplicationException(String.Format("Unable to get New settings.\r\nPath: {0}", SettingsController <TSettings> .FilePath)); } ModelController <TModel> .Model.Refresh(); StopProgressBar("New completed."); } catch (Exception ex) { Log.Write(ex, MethodBase.GetCurrentMethod(), EventLogEntryType.Error); StopProgressBar("", String.Format("{0}", ex.Message)); } }
//public ICommand FileNewCommand { get; private set; } //public ICommand FileOpenCommand { get; private set; } //public ICommand FileSaveCommand { get; private set; } //public ICommand FileSaveAsCommand { get; private set; } //public ICommand FilePrintCommand { get; private set; } //public ICommand FileExitCommand { get; private set; } //public ICommand EditCopyToClipboardCommand { get; private set; } //public ICommand EditPropertiesCommand { get; private set; } //public ICommand HelpAboutCommand { get; private set; } #endregion Commands #endregion Declarations #region Constructors public FormsViewModel() { if (SettingsController <TSettings> .Settings == null) { SettingsController <TSettings> .New(); } #region Commands //ActionIconWinformsImage = #endregion Commands }
//public ICommand FileNewCommand { get; private set; } //public ICommand FileOpenCommand { get; private set; } //public ICommand FileSaveCommand { get; private set; } //public ICommand FileSaveAsCommand { get; private set; } //public ICommand FilePrintCommand { get; private set; } //public ICommand FileExitCommand { get; private set; } //public ICommand EditCopyToClipboardCommand { get; private set; } //public ICommand EditPropertiesCommand { get; private set; } //public ICommand HelpAboutCommand { get; private set; } #endregion Commands #endregion Declarations #region Constructors public ConsoleViewModel() { if (SettingsController <TSettings> .Settings == null) { SettingsController <TSettings> .New(); } #region Commands //this.FileNewCommand = new FileNewCommand(this); //this.FileOpenCommand = new FileOpenCommand(this); //this.FileSaveCommand = new FileSaveCommand(this); //this.FileSaveAsCommand = new FileSaveAsCommand(this); //this.FilePrintCommand = new FilePrintCommand(this); //this.FileExitCommand = new FileExitCommand(this); //this.EditCopyToClipboardCommand = new EditCopyToClipboardCommand(this); //this.EditPropertiesCommand = new EditPropertiesCommand(this); //this.HelpAboutCommand = new HelpAboutCommand(this); //ActionIconWinformsImage = #endregion Commands }