public int EditSettings(ConsoleOptions options) { var settings = this.settingRepository.Load(options.SettingsFile); var message = string.Empty; this.consoleWriter .WriteLine() .WriteLine(Resources.SettingsEditorLaunching) .WriteLine(Resources.SettingsEditorCloseWarning); using (var viewModel = new SettingsViewModel(settings)) { var view = this.viewFactory.CreateSettings(viewModel); var result = view.ShowDialog(); if (result.HasValue && result.Value) { this.settingRepository.Save(settings, options.SettingsFile); message = string.Format(Resources.SettingsEditorSavedFormat, options.SettingsFile); } else { message = Resources.SettingsEditorCanceled; } } this.consoleWriter .WriteLine() .WriteLine(message); return 0; }
public IView CreateSettings(SettingsViewModel viewModel) { var view = new SettingsView() { DataContext = viewModel }; viewModel.View = view; return view; }
private void OnProjectNodeSettings(object sender, EventArgs e) { var project = this.Environment.SelectedItems.Item(1).Project; var model = this.VisualStudioJSLintProvider.LoadSettings(project, false).TypedClone(); using (var viewModel = new SettingsViewModel(model)) { var view = this.viewFactory.CreateSettings(viewModel); var result = view.ShowDialog(); if (result.HasValue && result.Value) { this.VisualStudioJSLintProvider.SaveSettings(project, model); } } }