public WindowViewModel() : base(MessageManager.GetInstance()) { m_Preferences = new PreferencesViewModel(); try { var settingsLoader = new SettingsFileLoader(PREFS_FILENAME); m_Preferences.LoadFromStorage(settingsLoader); } catch (FileNotFoundException) { // ignore this. if we caught this, no prefs file exists. don't bother // showing a nasty error as this can happen on a fresh install etc. } catch (Exception ex) { MessageBox.Show(ex.Message, "Preferences Load Failure", MessageBoxButtons.OK, MessageBoxIcon.Warning); } m_Views = new ObservableCollection <ViewBase>(); int viewIdCtr = 0; MessageManager mgr = MessageManager.GetInstance(); var assemblyEditorView = new AssemblyEditorView(viewIdCtr++, mgr, m_Preferences); var dbgView = new DebugView(viewIdCtr++, mgr); var hexEditorView = new HexExplorerView(viewIdCtr++, mgr); m_Views.Add(assemblyEditorView); m_Views.Add(dbgView); m_Views.Add(hexEditorView); m_ChangeActiveIdxCmd = new RelayCommand <int>((param) => ActiveViewIndex = param, true); m_NewFileCmd = new RelayCommand(() => SendFileMessage(MessageType.CreateFileRequest), true); m_OpenFileCmd = new RelayCommand(() => SendFileMessage(MessageType.OpenFileRequest), true); m_SaveFileCmd = new RelayCommand(() => SendFileMessage(MessageType.SaveFileRequest), true); m_SaveFileAsCmd = new RelayCommand(() => SendFileMessage(MessageType.SaveFileAsRequest), true); m_DisassembleFileCmd = new RelayCommand(() => SendFileMessage(MessageType.DisassembleFileRequest), true); m_AssembleFileCmd = new RelayCommand <OutputTypes>((param) => SendFileAssemblyCommand(param), true); m_CloseWindowCmd = new RelayCommand(() => SendFileMessage(MessageType.WindowClosingNotification), true); m_ShowPreferencesCmd = new RelayCommand(() => ShowPreferences(), true); }
public void CloneValues(PreferencesViewModel other) { ReplaceTabsWithSpaces = other.ReplaceTabsWithSpaces; NumSpacesToReplaceTabWith = other.NumSpacesToReplaceTabWith; ShowLineNumbers = other.ShowLineNumbers; }