Example #1
0
        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);
        }
Example #4
0
        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;
        }
Example #5
0
        private void Clone(ShellProfileViewModel shellProfile)
        {
            var cloned = new ShellProfile(shellProfile.Model)
            {
                Id           = Guid.NewGuid(),
                PreInstalled = false,
                Name         = $"Copy of {shellProfile.Name}"
            };

            AddShellProfile(cloned);
        }
Example #6
0
        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);
        }
Example #7
0
        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;
        }