public ProfilesPageViewModel(ISettingsService settingsService, IDialogService dialogService, IDefaultValueProvider defaultValueProvider) { _settingsService = settingsService; _dialogService = dialogService; _defaultValueProvider = defaultValueProvider; CreateShellProfileCommand = new RelayCommand(CreateShellProfile); var defaultShellProfileId = _settingsService.GetDefaultShellProfileId(); foreach (var shellProfile in _settingsService.GetShellProfiles()) { var viewModel = new ShellProfileViewModel(shellProfile, settingsService, dialogService); viewModel.Deleted += OnShellProfileDeleted; viewModel.SetAsDefault += OnShellProfileSetAsDefault; if (shellProfile.Id == defaultShellProfileId) { viewModel.IsDefault = true; } ShellProfiles.Add(viewModel); } SelectedShellProfile = ShellProfiles.First(p => p.IsDefault); }
public ProfilesPageViewModel(ISettingsService settingsService, IDialogService dialogService, IDefaultValueProvider defaultValueProvider, IFileSystemService fileSystemService, IApplicationView applicationView) { _settingsService = settingsService; _dialogService = dialogService; _defaultValueProvider = defaultValueProvider; _fileSystemService = fileSystemService; _applicationView = applicationView; CreateShellProfileCommand = new RelayCommand(CreateShellProfile); CloneCommand = new RelayCommand <ShellProfileViewModel>(Clone); var defaultShellProfileId = _settingsService.GetDefaultShellProfileId(); foreach (var shellProfile in _settingsService.GetShellProfiles()) { var viewModel = new ShellProfileViewModel(shellProfile, settingsService, dialogService, fileSystemService, applicationView, defaultValueProvider, false); viewModel.Deleted += OnShellProfileDeleted; viewModel.SetAsDefault += OnShellProfileSetAsDefault; if (shellProfile.Id == defaultShellProfileId) { viewModel.IsDefault = true; } ShellProfiles.Add(viewModel); } SelectedShellProfile = ShellProfiles.First(p => p.IsDefault); }
private void Clone(ShellProfileViewModel shellProfile) { var cloned = shellProfile.Model.Clone(); cloned.Id = Guid.NewGuid(); cloned.PreInstalled = false; cloned.Name = $"Copy of {shellProfile.Name}"; AddShellProfile(cloned); }
private void AddShellProfile(ShellProfile shellProfile) { var viewModel = new ShellProfileViewModel(shellProfile, _settingsService, _dialogService, _fileSystemService, _applicationView, _defaultValueProvider, true); viewModel.EditCommand.Execute(null); viewModel.SetAsDefault += OnShellProfileSetAsDefault; viewModel.Deleted += OnShellProfileDeleted; ShellProfiles.Add(viewModel); SelectedShellProfile = viewModel; }
private void Clone(ShellProfileViewModel shellProfile) { var cloned = new ShellProfile(shellProfile.Model) { Id = Guid.NewGuid(), PreInstalled = false, Name = $"Copy of {shellProfile.Name}" }; AddShellProfile(cloned); }
private void Clone(ShellProfileViewModel shellProfile) { var cloned = shellProfile.ProfileVm.Model.Clone(); cloned.Id = Guid.NewGuid(); cloned.PreInstalled = false; cloned.Name = $"Copy of {shellProfile.Name}"; cloned.KeyBindings = new List <KeyBinding>(); AddShellProfile(cloned); }
private void CreateShellProfile() { var shellProfile = new ShellProfile { Id = Guid.NewGuid(), PreInstalled = false, Name = "New profile" }; _settingsService.SaveShellProfile(shellProfile); var viewModel = new ShellProfileViewModel(shellProfile, _settingsService, _dialogService); viewModel.EditCommand.Execute(null); viewModel.SetAsDefault += OnShellProfileSetAsDefault; viewModel.Deleted += OnShellProfileDeleted; ShellProfiles.Add(viewModel); SelectedShellProfile = viewModel; }