private void txt_Category_TextChanged(object sender, EventArgs e) { if (AutoCompletionCache != null) { chk_Billable.Checked = AutoCompletionCache.BillableFlagByCategory(txt_Category.Text) ?? chk_Billable.Checked; } }
private void TaskInput_FormClosing(object sender, FormClosingEventArgs e) { if (this.DialogResult == DialogResult.OK) { if (!string.IsNullOrEmpty(txt_CompletedAt.Text) && TaskEndDate == null) { MessageBox.Show("The provided completion time is not a valid date/time.", "Invalid Completion Time", MessageBoxButtons.OK); e.Cancel = true; } if (TaskStartDate == null) { MessageBox.Show("A start time must be provided.", "Missing Start Time", MessageBoxButtons.OK); e.Cancel = true; } if (!e.Cancel && ((AutoCompletionCache.BillableFlagByCategory(txt_Category.Text) ?? chk_Billable.Checked) != chk_Billable.Checked) ) { if (MessageBox.Show("The \"Billable\" flag doesn't match previous values for the given Category; would you like to continue with the provided value?", "Billable mismatch - continue?", MessageBoxButtons.YesNo) != DialogResult.Yes) { e.Cancel = true; } } } }
private void txt_Description_TextChanged(object sender, EventArgs e) { if (AutoCompletionCache != null) { txt_Category.AutoCompleteCustomSource = AutoCompletionCache.CategorySource(txt_Description.Text); if (txt_Category.AutoCompleteCustomSource.Count == 1) { txt_Category.Text = txt_Category.AutoCompleteCustomSource[0]; } chk_Billable.Checked = AutoCompletionCache.BillableFlagByDescription(txt_Description.Text) ?? chk_Billable.Checked; } }