private void setProject(ProjectSuggestion projectSuggestion) { if (TextFieldInfo.WorkspaceId.HasValue) { clearTagsIfNeeded(TextFieldInfo.WorkspaceId.Value, projectSuggestion.WorkspaceId); } TextFieldInfo = TextFieldInfo .RemoveProjectQueryFromDescriptionIfNeeded() .WithProjectInfo( projectSuggestion.WorkspaceId, projectSuggestion.ProjectId, projectSuggestion.ProjectName, projectSuggestion.ProjectColor); }
private void toggleProjectSuggestions() { if (IsSuggestingProjects) { TextFieldInfo = TextFieldInfo.RemoveProjectQueryFromDescriptionIfNeeded(); return; } if (TextFieldInfo.ProjectId != null) { queryByTypeSubject.OnNext(AutocompleteSuggestionType.Projects); return; } var newText = TextFieldInfo.Text.Insert(TextFieldInfo.CursorPosition, QuerySymbols.ProjectsString); TextFieldInfo = TextFieldInfo.WithTextAndCursor(newText, TextFieldInfo.CursorPosition + 1); }
private void setTask(TaskSuggestion taskSuggestion) { if (TextFieldInfo.WorkspaceId.HasValue) { clearTagsIfNeeded(TextFieldInfo.WorkspaceId.Value, taskSuggestion.WorkspaceId); } TextFieldInfo = TextFieldInfo .RemoveProjectQueryFromDescriptionIfNeeded() .WithProjectAndTaskInfo( taskSuggestion.WorkspaceId, taskSuggestion.ProjectId, taskSuggestion.ProjectName, taskSuggestion.ProjectColor, taskSuggestion.TaskId, taskSuggestion.Name ); }
private void selectSuggestion(AutocompleteSuggestion suggestion) { switch (suggestion) { case QuerySymbolSuggestion querySymbolSuggestion: TextFieldInfo = TextFieldInfo.WithTextAndCursor(querySymbolSuggestion.Symbol, 1); break; case TimeEntrySuggestion timeEntrySuggestion: TextFieldInfo = TextFieldInfo.WithTextAndCursor( timeEntrySuggestion.Description, timeEntrySuggestion.Description.Length); if (!timeEntrySuggestion.ProjectId.HasValue) { TextFieldInfo = TextFieldInfo.RemoveProjectInfo(); return; } if (timeEntrySuggestion.TaskId == null) { TextFieldInfo = TextFieldInfo.WithProjectInfo( timeEntrySuggestion.ProjectId.Value, timeEntrySuggestion.ProjectName, timeEntrySuggestion.ProjectColor); break; } TextFieldInfo = TextFieldInfo.WithProjectAndTaskInfo( timeEntrySuggestion.ProjectId.Value, timeEntrySuggestion.ProjectName, timeEntrySuggestion.ProjectColor, timeEntrySuggestion.TaskId.Value, timeEntrySuggestion.TaskName); break; case ProjectSuggestion projectSuggestion: TextFieldInfo = TextFieldInfo .RemoveProjectQueryFromDescriptionIfNeeded() .WithProjectInfo( projectSuggestion.ProjectId, projectSuggestion.ProjectName, projectSuggestion.ProjectColor); break; case TaskSuggestion taskSuggestion: TextFieldInfo = TextFieldInfo .RemoveProjectQueryFromDescriptionIfNeeded() .WithProjectAndTaskInfo( taskSuggestion.ProjectId, taskSuggestion.ProjectName, taskSuggestion.ProjectColor, taskSuggestion.TaskId, taskSuggestion.Name ); break; case TagSuggestion tagSuggestion: TextFieldInfo = TextFieldInfo .RemoveTagQueryFromDescriptionIfNeeded() .AddTag(tagSuggestion); break; } }