private void workspaceAutoComplete_OnConfirmCompletion(object sender, AutoCompleteItem e)
        {
            var asWorkspaceItem = e as ModelItem;
            if (asWorkspaceItem == null)
                return;

            var item = asWorkspaceItem.Item;

            this.selectWorkspace(item);

            this.clientTextBox.Focus();
        }
        private void descriptionAutoComplete_OnConfirmCompletion(object sender, AutoCompleteItem e)
        {
            var asTimerItem = e as TimerItem;
            if (asTimerItem == null)
                return;

            if (!this.hasTimeEntry())
            {
                Console.WriteLine("Cannot apply description change: No time entry.");
                return;
            }

            var item = asTimerItem.Item;

            this.descriptionTextBox.SetText(item.Description);

            Toggl.SetTimeEntryDescription(this.timeEntry.GUID, item.Description);
            Toggl.SetTimeEntryProject(this.timeEntry.GUID, item.TaskID, item.ProjectID, "");
        }
        private void projectAutoComplete_OnConfirmCompletion(object sender, AutoCompleteItem e)
        {
            var asProjectItem = e as ProjectItem;
            if (asProjectItem == null)
                return;

            var item = asProjectItem.Item;

            this.setProjectIfDifferent(item.TaskID, item.ProjectID, item.ProjectLabel, item.TaskLabel, item.ProjectColor);
        }
        private void selectIndex(int index)
        {
            if(index < -1 || index >= this.currentlyVisible.Count)
                throw new ArgumentOutOfRangeException("index");

            this.selectedIndex = index;
            var newItem = index == -1 ? null : this.currentlyVisible[index];
            if (newItem == this.selectedItem)
                return;

            if (this.selectedItem != null)
                this.selectedItem.Selected = false;

            this.selectedItem = newItem;

            if (this.selectedItem != null)
                this.selectedItem.Selected = true;
        }
        private void clientAutoComplete_OnConfirmCompletion(object sender, AutoCompleteItem e)
        {
            var asClientItem = e as ModelItem;
            if (asClientItem == null)
                return;

            var item = asClientItem.Item;

            this.selectClient(item);

            this.projectTextBox.Focus();
        }
        private void descriptionAutoComplete_OnConfirmCompletion(object sender, AutoCompleteItem e)
        {
            var asItem = e as TimerItem;
            if (asItem == null)
                return;

            var item = asItem.Item;

            this.descriptionTextBox.SetText(item.Description);

            this.completedProject = new ProjectInfo(item);

            if (item.ProjectID != 0)
            {
                this.projectLabel.Text = "• " + item.ProjectLabel;
                this.projectLabel.Foreground = getProjectColorBrush(ref item);

                setOptionalTextBlockText(this.taskLabel, string.IsNullOrEmpty(item.TaskLabel) ? "" : item.TaskLabel + " -");
                setOptionalTextBlockText(this.clientLabel, item.ClientLabel);

                this.projectGridRow.Height = GridLength.Auto;
                this.cancelProjectSelectionButton.Visibility = Visibility.Visible;
            }
            else
            {
                this.projectGridRow.Height = new GridLength(0);
                this.cancelProjectSelectionButton.Visibility = Visibility.Collapsed;
            }
        }
 public void SelectItem(AutoCompleteItem item)
 {
     var i = item == null ? -1 : this.currentlyVisible.IndexOf(item);
     this.selectIndex(i);
 }
 private void select(AutoCompleteItem item)
 {
     this.select(item, false);
 }
        private void select(AutoCompleteItem item, bool withKeyboard)
        {
            if (withKeyboard || !this.KeepOpenWhenSelectingWithMouse)
                this.popup.IsOpen = false;

            if (item == null)
            {
                if (this.ConfirmWithoutCompletion != null)
                    this.ConfirmWithoutCompletion(this, this.textbox.Text);
                return;
            }

            if (this.FillTextBoxOnComplete)
            {
                this.textbox.SetText(item.Text);
                this.textbox.CaretIndex = this.textbox.Text.Length;
                this.textbox.Focus();
            }

            if (this.ConfirmCompletion != null)
                this.ConfirmCompletion(this, item);
        }
        private void projectAutoComplete_OnConfirmCompletion(object sender, AutoCompleteItem e)
        {
            var asProjectItem = e as ProjectItem;
            if (asProjectItem == null)
                return;

            var item = asProjectItem.Item;

            this.selectProject(item);
        }
示例#11
0
        private void autoComplete_OnConfirmCompletion(object sender, AutoCompleteItem e)
        {
            var asStringItem = e as StringItem;
            if (asStringItem == null)
                return;

            var tag = asStringItem.Text;
            this.tryAddTag(tag);
            this.textBox.SetText("");

            if(this.autoComplete.IsOpen)
                this.autoComplete.OpenAndShowAll();
        }
示例#12
0
        private void descriptionAutoComplete_OnConfirmCompletion(object sender, AutoCompleteItem e)
        {
            var asTimerItem = e as TimerItem;
            if (asTimerItem == null)
                return;

            if (!this.hasTimeEntry())
            {
                Console.WriteLine("Cannot apply description change: No time entry.");
                return;
            }

            var item = asTimerItem.Item;

            // TODO: fill in project already if possible (instead of waiting for dll)?

            Toggl.SetTimeEntryDescription(this.timeEntry.GUID, item.Description);
            Toggl.SetTimeEntryProject(this.timeEntry.GUID, item.TaskID, item.ProjectID, "");
        }
        private void select(AutoCompleteItem item)
        {
            this.popup.IsOpen = false;

            if (item == null)
            {
                if (this.ConfirmWithoutCompletion != null)
                    this.ConfirmWithoutCompletion(this, this.textbox.Text);
                return;
            }

            this.textbox.SetText(item.Text);
            this.textbox.CaretIndex = this.textbox.Text.Length;
            if (this.ConfirmCompletion != null)
                this.ConfirmCompletion(this, item);
        }
示例#14
0
        public void SelectItem(AutoCompleteItem item)
        {
            var i = item == null ? -1 : this.currentlyVisible.IndexOf(item);

            this.selectIndex(i);
        }