private void addClientButton_Click(object sender, EventArgs e) { if (addClientTextBox.Text.Length == 0) { addClientLinkLabel_Click(null, null); return; } ulong workspaceID = timeEntry.WID; if (comboBoxWorkspace.Items.Count == 1) { workspaceID = ((Toggl.Model)comboBoxWorkspace.Items[0]).ID; } if (comboBoxWorkspace.Items.Count > 1) { workspaceID = selectedItemID(comboBoxWorkspace); } if (workspaceID == 0) { comboBoxWorkspace.Focus(); return; } // Client with the same name already in list if (comboBoxClient.FindStringExact(addClientTextBox.Text) != -1) { comboBoxClient.Text = addClientTextBox.Text; addClientLinkLabel_Click(null, null); return; } bool clientCreated = Toggl.AddClient(workspaceID, addClientTextBox.Text); if (clientCreated) { comboBoxClient.Text = addClientTextBox.Text; newestClient = addClientTextBox.Text; } addClientLinkLabel_Click(null, null); }