private void selectDefaultProjectFromSettings()
        {
            var projectID = Toggl.GetDefaultProjectId();
            var taskID    = Toggl.GetDefaultTaskId();

            var project = default(Toggl.TogglAutocompleteView);

            if (this.knownProjects != null)
            {
                project = this.knownProjects
                          .FirstOrDefault(p => p.ProjectID == projectID && p.TaskID == taskID);
            }

            if (project.ProjectID != projectID || project.TaskID != taskID)
            {
                project = new Toggl.TogglAutocompleteView
                {
                    ProjectLabel = Toggl.GetDefaultProjectName(),
                    ProjectID    = projectID,
                    TaskID       = taskID,
                };
            }

            this.selectDefaultProject(project);
        }
        private void selectDefaultProject(Toggl.TogglAutocompleteView?item)
        {
            var project = item ?? default(Toggl.TogglAutocompleteView);

            this.selectedDefaultProject = project;
            this.defaultProjectTextBox.SetText(project.ProjectLabel, project.TaskLabel);
            this.defaultProjectColorCircle.Background = Utils.ProjectColorBrushFromString(project.ProjectColor);
            this.defaultProjectTextBox.CaretIndex     = this.defaultProjectTextBox.Text.Length;
        }
예제 #3
0
        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;
            }
        }
예제 #4
0
 public ProjectInfo(Toggl.TogglAutocompleteView item)
 {
     this.projectId = item.ProjectID;
     this.taskId    = item.TaskID;
 }
예제 #5
0
 private void clearSelectedProject()
 {
     this.editProjectPanel.Visibility    = Visibility.Collapsed;
     this.editModeProjectLabel.ViewModel = null;
     completedProject = default;
 }
 private void selectProject(Toggl.TogglAutocompleteView? item)
 {
     var project = item ?? default(Toggl.TogglAutocompleteView);
     this.selectedProject = project;
     this.projectTextBox.SetText(project.ProjectLabel, project.TaskLabel);
     this.projectColorCircle.Background = Utils.ProjectColorBrushFromString(project.ProjectColor);
     this.projectTextBox.CaretIndex = this.projectTextBox.Text.Length;
 }
        private void selectDefaultProjectFromSettings()
        {
            var projectID = Toggl.GetDefaultProjectId();
            var taskID = Toggl.GetDefaultTaskId();

            var project = default(Toggl.TogglAutocompleteView);

            if (this.knownProjects != null)
            {
                project = this.knownProjects
                    .FirstOrDefault(p => p.ProjectID == projectID && p.TaskID == taskID);
            }

            if (project.ProjectID != projectID || project.TaskID != taskID)
            {
                project = new Toggl.TogglAutocompleteView
                {
                    ProjectLabel = Toggl.GetDefaultProjectName(),
                    ProjectID = projectID,
                    TaskID = taskID,
                }; 
            }

            this.selectDefaultProject(project);
        }
예제 #8
0
 public static string GetFullProjectString(this Toggl.TogglAutocompleteView item)
 {
     return(item.GetProjectAndTaskString() + (item.ClientLabel.IsNullOrEmpty() ? "" : $". {item.ClientLabel}"));
 }
예제 #9
0
 public static string GetProjectAndTaskString(this Toggl.TogglAutocompleteView item)
 {
     return(item.ProjectLabel + (item.TaskLabel.IsNullOrEmpty() ? "" : $" - {item.TaskLabel}"));
 }