public SshProfilesPageViewModel(ISettingsService settingsService, IDialogService dialogService, IFileSystemService fileSystemService, IApplicationView applicationView, ITrayProcessCommunicationService trayProcessCommunicationService, IApplicationDataContainer historyContainer) { _settingsService = settingsService; _dialogService = dialogService; _fileSystemService = fileSystemService; _applicationView = applicationView; _trayProcessCommunicationService = trayProcessCommunicationService; _historyContainer = historyContainer; CreateSshProfileCommand = new RelayCommand(CreateSshProfile); CloneCommand = new RelayCommand <SshProfileViewModel>(Clone); foreach (var sshProfile in _settingsService.GetSshProfiles()) { var viewModel = new SshProfileViewModel(sshProfile, settingsService, dialogService, fileSystemService, applicationView, _trayProcessCommunicationService, historyContainer, false); viewModel.Deleted += OnSshProfileDeleted; SshProfiles.Add(viewModel); } if (SshProfiles.Count == 0) { CreateSshProfile(); } SelectedSshProfile = SshProfiles.First(); }
private void AddSshProfile(SshProfile sshProfile) { var viewModel = new SshProfileViewModel(sshProfile, _settingsService, _dialogService, _fileSystemService, _applicationView, _trayProcessCommunicationService, _historyContainer, true); viewModel.EditCommand.Execute(null); viewModel.Deleted += OnSshProfileDeleted; SshProfiles.Add(viewModel); SelectedSshProfile = viewModel; }
private void AddSshProfile(SshProfile sshProfile) { var viewModel = new SshProfileViewModel(sshProfile, _settingsService, _dialogService, _fileSystemService, _applicationView, _defaultValueProvider, _trayProcessCommunicationService, true); viewModel.EditCommand.Execute(null); viewModel.SetAsDefault += OnSshProfileSetAsDefault; viewModel.Deleted += OnSshProfileDeleted; SshProfiles.Add(viewModel); SelectedSshProfile = viewModel; }
public SshProfilesPageViewModel(ISettingsService settingsService, IDialogService dialogService, IFileSystemService fileSystemService, IApplicationView applicationView, ITrayProcessCommunicationService trayProcessCommunicationService) { _settingsService = settingsService; _dialogService = dialogService; _fileSystemService = fileSystemService; _applicationView = applicationView; _trayProcessCommunicationService = trayProcessCommunicationService; CreateSshProfileCommand = new RelayCommand(CreateSshProfile); CloneCommand = new RelayCommand <SshProfileViewModel>(Clone); var defaultSshProfileId = _settingsService.GetDefaultSshProfileId(); foreach (var sshProfile in _settingsService.GetSshProfiles()) { var viewModel = new SshProfileViewModel(sshProfile, settingsService, dialogService, fileSystemService, applicationView, _trayProcessCommunicationService, false); viewModel.Deleted += OnSshProfileDeleted; viewModel.SetAsDefault += OnSshProfileSetAsDefault; if (sshProfile.Id == defaultSshProfileId) { viewModel.IsDefault = true; } SshProfiles.Add(viewModel); } if (SshProfiles.Count == 0) { CreateSshProfile(); } SelectedSshProfile = SshProfiles.FirstOrDefault(p => p.IsDefault); if (SelectedSshProfile == null) { SelectedSshProfile = SshProfiles.First(); } }