private bool tryCreatingNewProject(string text, string color) { if (!this.hasTimeEntry()) { Console.WriteLine("Cannot add new project: No time entry."); return(false); } this.isCreatingProject = true; var ret = Toggl.AddProject( this.timeEntry.GUID, this.selectedWorkspaceId, this.selectedClientId, this.selectedClientGUID, text, false, color) != null; this.isCreatingProject = false; return(ret); }
private Boolean applyAddProject() { if (!panelAddProject.Visible) { return(true); } if (textBoxProjectName.Text.Length == 0) { return(true); } bool is_public = checkBoxPublic.Checked; 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(false); } ulong clientID = selectedItemID(comboBoxClient); bool isBillable = timeEntry.Billable; bool projectAdded = Toggl.AddProject( timeEntry.GUID, workspaceID, clientID, textBoxProjectName.Text, !is_public); if (projectAdded && isBillable) { Toggl.SetTimeEntryBillable(timeEntry.GUID, isBillable); } return(projectAdded); }