示例#1
0
        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;
        }
示例#2
0
        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);
                }
            }
        }
示例#3
0
 public DeleteDialogueCmd(string name, DialogueModel model, DialogueManager mgr)
 {
     _dialogueName = name;
     _model        = model;
     _mgr          = mgr;
 }