public MainWindowViewModel() { FileVersionInfo fInfo = FileVersionInfo.GetVersionInfo(Assembly.GetEntryAssembly().Location); _applicationRegKey = $"HKEY_CURRENT_USER\\{fInfo.CompanyName}\\{fInfo.ProductName}\\{fInfo.ProductVersion}"; RecentFiles = new LinkedList <string>(); object mruObj = Registry.GetValue(_applicationRegKey, MRU_REG_KEY, null); if (mruObj != null) { var items = (string[])(mruObj); foreach (string mruItem in items) { RecentFiles.AddLast(mruItem); } } _cmdExec = new CommandExecutor(); DlgModel = new DialogueModel(_cmdExec); _undoCommand = new UndoCommand(_cmdExec); _redoCommand = new RedoCommand(_cmdExec); _saveCommand = new SaveCommand(this); _saveAsCommand = new SaveAsCommand(this); Dirty = false; }
public void OpenFile(string filepath) { var mgr = DialogueManager.LoadFile(filepath); if (mgr == null) { MessageBox.Show(string.Format("Failed to load {0}", filepath), "Loading Error", MessageBoxButton.OK, MessageBoxImage.Error); } else { CurrentFile = filepath; CurrentDir = new DirectoryInfo(CurrentFile).Parent.FullName; DlgModel = new DialogueModel(mgr, _cmdExec); if (!RecentFiles.Contains(filepath)) { RecentFiles.AddFirst(filepath); } } }
public DeleteDialogueCmd(string name, DialogueModel model, DialogueManager mgr) { _dialogueName = name; _model = model; _mgr = mgr; }