/// <summary> /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void RemoveClicked(object sender, EventArgs e) { if (workspaceList.SelectedItems.Count == 0) { return; } ScmWorkspaceSettings Settings = workspaceList.SelectedItems[0].Tag as ScmWorkspaceSettings; Program.Settings.ScmWorkspaces.Remove(Settings); Program.SaveSettings(); RefreshItems(); }
/// <summary> /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void AddClicked(object sender, EventArgs e) { Settings = new ScmWorkspaceSettings(); Settings.ProviderType = (ScmProviderType)WorkspaceTypeComboBox.SelectedIndex; Settings.Server = ServerNameTextBox.Text.Trim(); Settings.Username = UsernameTextBox.Text.Trim(); Settings.Password = PasswordTextBox.Text.Trim(); Settings.Location = LocalFolderTextBox.Text.Trim(); // Check no other workspaces exist with same local folder. foreach (ScmWorkspaceSettings Workspace in Program.Settings.ScmWorkspaces) { if (FileUtils.NormalizePath(Settings.Location) == FileUtils.NormalizePath(Workspace.Location)) { MessageBox.Show("A workspace is already configured that exists at the same location.", "Duplicate Workspace", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } } DialogResult = DialogResult.OK; Close(); }