private void projectAutoComplete_OnConfirmCompletion(object sender, IAutoCompleteItem e) { if (e is IModelItem <Toggl.TogglAutocompleteView> modelItemViewModel) { this.selectProject(modelItemViewModel.Model); } }
private void descriptionAutoComplete_OnConfirmCompletion(object sender, IAutoCompleteItem e) { if (e is IModelItem <Toggl.TogglAutocompleteView> asItem) { var item = asItem.Model; this.descriptionTextBox.SetText(item.Description); this.descriptionTextBox.CaretIndex = this.descriptionTextBox.Text.Length; this.editProjectPanel.ShowOnlyIf(item.ProjectID != 0); this.editModeProjectLabel.ViewModel = item.ToProjectLabelViewModel(); completedProject = item; } }
private void autoComplete_OnConfirmCompletion(object sender, IAutoCompleteItem e) { if (e is IModelItem <string> asStringItem) { var tag = asStringItem.Text; this.tryAddOrRemoveTag(tag); this.textBox.SetText(""); if (this.autoComplete.IsOpen) { this.autoComplete.OpenAndShowAll(); } } }
private void projectAutoComplete_OnConfirmCompletion(object sender, IAutoCompleteItem e) { switch (e) { case IModelItem <Toggl.TogglAutocompleteView> projectItem: { var item = projectItem.Model; this.setProjectIfDifferent(item); break; } default: return; } }
public void DescriptionAutoCompleteConfirm(IAutoCompleteItem e) { var asItem = e as IModelItem <Toggl.TogglAutocompleteView>; if (asItem == null) { return; } var item = asItem.Model; SetDescription(item.Description); ProjectLabelViewModel = item.ToProjectLabelViewModel(); completedProject = item; }
private void select(IAutoCompleteItem item, bool withKeyboard) { if (!this.KeepOpenWhenSelecting) { this.close(); } if (item == null) { ConfirmWithoutCompletion?.Invoke(this, this.textbox.Text); if (this.IsOpen) { // refresh the popup content this.open(); } return; } ConfirmCompletion?.Invoke(this, item); }
private void descriptionAutoComplete_OnConfirmCompletion(object sender, IAutoCompleteItem e) { var asTimerItem = e as IModelItem <Toggl.TogglAutocompleteView>; if (asTimerItem == null) { return; } if (!this.hasTimeEntry()) { Console.WriteLine("Cannot apply description change: No time entry."); return; } var item = asTimerItem.Model; this.descriptionTextBox.SetText(item.Description); this.descriptionTextBox.CaretIndex = this.descriptionTextBox.Text.Length; Toggl.SetTimeEntryDescription(this.timeEntry.GUID, item.Description); if (item.ProjectID != 0) { Toggl.SetTimeEntryProject(this.timeEntry.GUID, item.TaskID, item.ProjectID, ""); } this.billableCheckBox.IsChecked = item.Billable; this.billableCheckBox_OnClick(null, null); if (!string.IsNullOrEmpty(item.Tags) && this.tagList.TagCount == 0) { this.tagList.Clear(true); if (item.Tags != null) { this.tagList.AddTags(item.Tags.Split(new[] { Toggl.TagSeparator }, StringSplitOptions.RemoveEmptyEntries)); } this.saveTags(); } }
public static bool IsSelectable(this IAutoCompleteItem item) => (int)item.Type >= 0;
/// <summary> /// Registers the specified autocomplete item. /// </summary> /// <param name="item">The autocomplete item.</param> protected void Register(IAutoCompleteItem item) { _autocompleteItems.Add(item); }
/// <summary> /// Registers the specified autocomplete item. /// </summary> /// <param name="item">The autocomplete item.</param> protected void Register(IAutoCompleteItem item) { autocompleteItems.Add(item); }