internal async Task <ObservableCollection <MyTask> > GetMyTasksAsync(GrpcChannel channel, int personId) { var tasksClient = new Tasks.TasksClient(channel); var input = new Int32Value { Value = personId }; using var result = tasksClient.GetMyTasks(input); var tasks = new ObservableCollection <MyTask>(); while (await result.ResponseStream.MoveNext()) { if (result.ResponseStream.Current.TaskId == 0) { return(tasks); } var task = new MyTask(true) { TaskId = result.ResponseStream.Current.TaskId, AssignedEmployee = result.ResponseStream.Current.EmployeeId, Description = result.ResponseStream.Current.Description, FinalDate = result.ResponseStream.Current.FinalDate.ToDateTime().ToLocalTime(), CreatedDate = result.ResponseStream.Current.CreatedDate.ToDateTime().ToLocalTime(), Priority = ConvertStringToProretyEnum(result.ResponseStream.Current.Priority), Subject = result.ResponseStream.Current.Subject, IsArchive = result.ResponseStream.Current.IsArchive, IsCompleted = result.ResponseStream.Current.IsCompleted }; task.SetInitModeFalse(); var comments = await _commentApi.GetCommentsOfTaskAsync(channel, task.TaskId); task.Comments = comments; tasks.Add(task); } return(tasks); }