void OnTimeEntryEditor( bool open, ref KopsikApi.KopsikTimeEntryViewItem te, string focused_field_name) { DisplayTimeEntryEditor(open, focused_field_name); }
public static List <KopsikApi.KopsikTimeEntryViewItem> ConvertToTimeEntryList( IntPtr first) { List <KopsikApi.KopsikTimeEntryViewItem> list = new List <KopsikApi.KopsikTimeEntryViewItem>(); if (IntPtr.Zero == first) { return(list); } KopsikApi.KopsikTimeEntryViewItem n = (KopsikApi.KopsikTimeEntryViewItem)Marshal.PtrToStructure( first, typeof(KopsikApi.KopsikTimeEntryViewItem)); while (true) { list.Add(n); if (n.Next == IntPtr.Zero) { break; } n = (KopsikApi.KopsikTimeEntryViewItem)Marshal.PtrToStructure( n.Next, typeof(KopsikApi.KopsikTimeEntryViewItem)); } ; return(list); }
void DisplayTimeEntryEditor( KopsikApi.KopsikTimeEntryViewItem te, string focused_field_name) { if (InvokeRequired) { Invoke((MethodInvoker) delegate { DisplayTimeEntryEditor(te, focused_field_name); }); return; } GUID = te.GUID; if (!comboBoxDescription.Focused) { comboBoxDescription.Text = te.Description; } if (!comboBoxProject.Focused) { comboBoxProject.Text = te.ProjectAndTaskLabel; } if (!textBoxDuration.Focused) { textBoxDuration.Text = te.Duration; } if (!textBoxStartTime.Focused) { textBoxStartTime.Text = te.StartTimeString; } if (!textBoxEndTime.Focused) { textBoxEndTime.Text = te.EndTimeString; } if (!dateTimePickerStartDate.Focused) { dateTimePickerStartDate.Value = KopsikApi.DateTimeFromUnix(te.Started); } checkBoxBillable.Tag = this; try { checkBoxBillable.Checked = te.Billable; } finally { checkBoxBillable.Tag = null; } if (te.UpdatedAt >= 0) { DateTime updatedAt = KopsikApi.DateTimeFromUnix(te.UpdatedAt); toolStripStatusLabelLastUpdate.Text = updatedAt.ToString(); toolStripStatusLabelLastUpdate.Visible = true; } else { toolStripStatusLabelLastUpdate.Visible = false; } textBoxEndTime.Enabled = (te.DurationInSeconds >= 0); }
void OnTimerState(IntPtr te) { if (te == IntPtr.Zero) { DisplayStoppedTimerState(); return; } KopsikApi.KopsikTimeEntryViewItem view = (KopsikApi.KopsikTimeEntryViewItem)Marshal.PtrToStructure( te, typeof(KopsikApi.KopsikTimeEntryViewItem)); KopsikApi.KopsikTimeEntryViewItem copy = view; DisplayRunningTimerState(copy); }
void DisplayTimeEntryEditor( bool open, KopsikApi.KopsikTimeEntryViewItem te, string focused_field_name) { if (InvokeRequired) { Invoke((MethodInvoker) delegate { DisplayTimeEntryEditor(open, te, focused_field_name); }); return; } if (open) { Controls.Remove(loginViewController); Controls.Remove(timeEntryListViewController); Controls.Add(timeEntryEditViewController); timeEntryEditViewController.SetAcceptButton(this); timeEntryEditViewController.SetFocus(focused_field_name); } }
void DisplayRunningTimerState(KopsikApi.KopsikTimeEntryViewItem te) { if (InvokeRequired) { Invoke((MethodInvoker) delegate { DisplayRunningTimerState(te); }); return; } duration_in_seconds = te.DurationInSeconds; timerRunningDuration.Enabled = true; buttonStart.Text = "Stop"; linkLabelDescription.Top = comboBoxDescription.Top; linkLabelDescription.Left = comboBoxDescription.Left; linkLabelDescription.Text = te.Description; if (linkLabelDescription.Text == "") { linkLabelDescription.Text = "(no description)"; } linkLabelDescription.Visible = true; comboBoxDescription.Visible = false; comboBoxDescription.Text = ""; linkLabelDuration.Top = textBoxDuration.Top; linkLabelDuration.Left = textBoxDuration.Left; linkLabelDuration.Text = te.Duration; linkLabelDuration.Visible = true; textBoxDuration.Visible = false; textBoxDuration.Text = ""; linkLabelProject.Text = te.ProjectAndTaskLabel; linkLabelProject.Visible = true; task_id = 0; project_id = 0; }
public static List <KopsikApi.KopsikTimeEntryViewItem> ConvertToTimeEntryList( ref KopsikApi.KopsikTimeEntryViewItem first) { List <KopsikApi.KopsikTimeEntryViewItem> list = new List <KopsikApi.KopsikTimeEntryViewItem>(); if (Object.ReferenceEquals(null, first)) { return(list); } KopsikApi.KopsikTimeEntryViewItem n = first; while (true) { list.Add(n); if (n.Next == IntPtr.Zero) { break; } n = (KopsikApi.KopsikTimeEntryViewItem)Marshal.PtrToStructure( n.Next, typeof(KopsikApi.KopsikTimeEntryViewItem)); } ; return(list); }
internal void Setup(KopsikApi.KopsikTimeEntryViewItem item) { this.TimeEntry = item; this.Render(); }
void OnTimeEntryList(bool open, ref KopsikApi.KopsikTimeEntryViewItem te) { List <KopsikApi.KopsikTimeEntryViewItem> list = KopsikApi.ConvertToTimeEntryList(ref te); DisplayTimeEntryList(open, list); }
void DisplayTimeEntryEditor( KopsikApi.KopsikTimeEntryViewItem te, string focused_field_name) { timeEntry = te; if (InvokeRequired) { Invoke((MethodInvoker) delegate { DisplayTimeEntryEditor(te, focused_field_name); }); return; } GUID = te.GUID; Boolean can_see_billable = false; if (!KopsikApi.kopsik_user_can_see_billable_flag(KopsikApi.ctx, GUID, ref can_see_billable)) { return; } checkBoxBillable.Visible = can_see_billable; checkBoxBillable.Tag = this; try { checkBoxBillable.Checked = te.Billable; } finally { checkBoxBillable.Tag = null; } Boolean can_add_projects = false; if (!KopsikApi.kopsik_user_can_add_projects(KopsikApi.ctx, timeEntry.WID, ref can_add_projects)) { return; } if (!can_add_projects) { this.linkAddProject.Visible = !can_add_projects; } if (!comboBoxDescription.Focused) { comboBoxDescription.Text = te.Description; } if (!comboBoxProject.Focused) { comboBoxProject.Text = te.ProjectAndTaskLabel; } if (!textBoxDuration.Focused) { textBoxDuration.Text = te.Duration; } if (!textBoxStartTime.Focused) { textBoxStartTime.Text = te.StartTimeString; } if (!textBoxEndTime.Focused) { textBoxEndTime.Text = te.EndTimeString; } if (!dateTimePickerStartDate.Focused) { dateTimePickerStartDate.Value = KopsikApi.DateTimeFromUnix(te.Started); } this.textBoxEndTime.Visible = !timeEntry.DurOnly; if (te.UpdatedAt >= 0) { DateTime updatedAt = KopsikApi.DateTimeFromUnix(te.UpdatedAt); toolStripStatusLabelLastUpdate.Text = updatedAt.ToString(); toolStripStatusLabelLastUpdate.Visible = true; } else { toolStripStatusLabelLastUpdate.Visible = false; } textBoxEndTime.Enabled = (te.DurationInSeconds >= 0); for (int i = 0; i < this.checkedListBoxTags.Items.Count; i++) { this.checkedListBoxTags.SetItemChecked(i, false); } if (te.Tags != null) { string[] tags = te.Tags.Split(','); // Tick selected Tags for (int i = 0; i < tags.Length; i++) { int index = this.checkedListBoxTags.Items.IndexOf(tags[i]); if (index != -1) { this.checkedListBoxTags.SetItemChecked(index, true); } } } }
internal void Setup(KopsikApi.KopsikTimeEntryViewItem item) { this.TimeEntry = item; this.Render(); }
void OnTimeEntryList(bool open, ref KopsikApi.KopsikTimeEntryViewItem te) { DisplayTimeEntryList(open); }
void DisplayTimeEntryEditor( KopsikApi.KopsikTimeEntryViewItem te, string focused_field_name) { timeEntry = te; if (InvokeRequired) { Invoke((MethodInvoker)delegate { DisplayTimeEntryEditor(te, focused_field_name); }); return; } GUID = te.GUID; Boolean can_see_billable = false; if (!KopsikApi.kopsik_user_can_see_billable_flag(KopsikApi.ctx, GUID, ref can_see_billable)) { return; } checkBoxBillable.Visible = can_see_billable; checkBoxBillable.Tag = this; try { checkBoxBillable.Checked = te.Billable; } finally { checkBoxBillable.Tag = null; } Boolean can_add_projects = false; if (!KopsikApi.kopsik_user_can_add_projects(KopsikApi.ctx, timeEntry.WID, ref can_add_projects)) { return; } if (!can_add_projects) { this.linkAddProject.Visible = !can_add_projects; } if (!comboBoxDescription.Focused) { comboBoxDescription.Text = te.Description; } if (!comboBoxProject.Focused) { comboBoxProject.Text = te.ProjectAndTaskLabel; } if (!textBoxDuration.Focused) { textBoxDuration.Text = te.Duration; } if (!textBoxStartTime.Focused) { textBoxStartTime.Text = te.StartTimeString; } if (!textBoxEndTime.Focused) { textBoxEndTime.Text = te.EndTimeString; } if (!dateTimePickerStartDate.Focused) { dateTimePickerStartDate.Value = KopsikApi.DateTimeFromUnix(te.Started); } this.textBoxEndTime.Visible = !timeEntry.DurOnly; if (te.UpdatedAt >= 0) { DateTime updatedAt = KopsikApi.DateTimeFromUnix(te.UpdatedAt); toolStripStatusLabelLastUpdate.Text = updatedAt.ToString(); toolStripStatusLabelLastUpdate.Visible = true; } else { toolStripStatusLabelLastUpdate.Visible = false; } textBoxEndTime.Enabled = (te.DurationInSeconds >= 0); for (int i = 0; i < this.checkedListBoxTags.Items.Count; i++) { this.checkedListBoxTags.SetItemChecked(i, false); } if ( te.Tags != null) { string[] tags = te.Tags.Split(','); // Tick selected Tags for (int i = 0; i < tags.Length; i++) { int index = this.checkedListBoxTags.Items.IndexOf(tags[i]); if (index != -1) { this.checkedListBoxTags.SetItemChecked(index, true); } } } }