public WorkItemDetails(DisplayTask root) { InitializeComponent(); WIC = Application.Current.Properties["WIC"] as WorkItemController; root.LinkedTasks = WIC.GetRelatedWorkItems(root.workItem); var tasks = new ObservableCollection <DisplayTask>(root.LinkedTasks); tasks.Insert(0, root); icDetailTasks.ItemsSource = tasks; detailTaskEditor.DataContext = root; }
public void CopyTaskToIteration(DisplayTask task, string iteration) { var workItem = GetWorkItemByID(task.ID); var newWorkItem = workItem.Copy(); foreach (Attachment attachment in workItem.Attachments) { var taskAttachment = new TaskAttachment(attachment, task); var tempFileName = taskAttachment.DownloadFile(); newWorkItem.Attachments.Add(new Attachment(tempFileName)); } newWorkItem.IterationPath = iteration; SaveWorkItem(newWorkItem); AllTasks.Add(new DisplayTask(newWorkItem)); }
private void LoadData(string filter) { UserStories = new ObservableCollection <DisplayTask>(AllTasks.Where(t => t.Type == "User Story").OrderByDescending(o => o.Iteration).ThenBy(o => o.Area)); var UnestimatedTask = new DisplayTask("User Story") { isPlaceHolder = true, Title = "Unestimated Tasks" }; UserStories.Insert(0, UnestimatedTask); UnestimatedTasks = new ObservableCollection <DisplayTask>(AllTasks.Where(t => t.Type != "User Story" && (string.IsNullOrEmpty(t.Estimated) || t.Estimated == "0"))); PlanningTasks = new ObservableCollection <DisplayTask>(AllTasks.Where(t => t.Type == "User Story" || (string.IsNullOrEmpty(t.Estimated) || t.Estimated == "0"))); var selectedArea = (string)cbArea.SelectedItem; var selectedAreaString = selectedArea == null ? "" : selectedArea.ToString(); Areas = new ObservableCollection <string>(); Areas.Add("All"); cbArea.ItemsSource = Areas; foreach (DisplayTask task in AllTasks) { if (!Areas.Contains(task.Area)) { Areas.Add(task.Area); } } if (Areas.Contains(selectedArea)) { cbArea.SelectedValue = selectedArea; } else { cbArea.SelectedValue = "All"; } cbArea.ItemsSource = Areas; FilterTasks(filter); }
private void btnNewLink_Click(object sender, RoutedEventArgs e) { var parentTask = detailTaskEditor.DataContext as DisplayTask; parentTask.BorderColor = "Aqua"; var newTask = new DisplayTask("Task") { Title = "New Task", Area = parentTask.Area, Iteration = parentTask.Iteration, BorderColor = "Red" }; newTask.Update.ParentID = parentTask.ID; newTask.Update.Type = "Task"; var associatedTasks = icDetailTasks.ItemsSource as ObservableCollection <DisplayTask>; associatedTasks.Add(newTask); detailTaskEditor.DataContext = newTask; }
private void icPlanningTasks_MouseUp(object sender, MouseButtonEventArgs e) { var itemsControl = sender as ItemsControl; var item = UICommon.FindAncestor <TaskControl>((DependencyObject)e.OriginalSource); if (item == null || item.DataContext == null) { return; } foreach (DisplayTask task in itemsControl.ItemsSource) { task.BorderColor = task.DefaultBorderColor; } PlanningSelectedTask = (DisplayTask)item.DataContext; PlanningSelectedTask.BorderColor = "Red"; planningTaskEditor.DataContext = PlanningSelectedTask; }
public async void LoadData() { prgLoadingBar.IsIndeterminate = true; await Task.Delay(20); var WIC = new WorkItemController(); var workItems = WIC.GetAllWorkItems(); prgLoadingBar.IsIndeterminate = false; prgLoadingBar.Maximum = workItems.Count; prgLoadingBar.Value = 0; await Task.Delay(20); var tasks = new ObservableCollection <DisplayTask>(); foreach (WorkItem workItem in workItems) { txtLoadingStatus.Text = string.Format("AreaPath: {0} Task Number: {1} Task Name: {2}", workItem.AreaPath, workItem.Id, workItem.Title); prgLoadingBar.Value++; var newTask = new DisplayTask(workItem); //newTask.LinkedTasks = WIC.GetRelatedWorkItems(workItem); tasks.Add(newTask); await Task.Delay(1); } var mainWindow = new MainWindow(tasks); Hide(); mainWindow.Show(); }
public TaskAttachment(Attachment attachment, DisplayTask parent) { this.attachment = attachment; this.parent = parent; NotifyPropertyChanged("FileName"); }
public async void ProcessQueue() { Task task = Task.Run(() => {; }); Task nextTask = task.ContinueWith(x => { while (true) { try { mainWindow.UpdateQueueProgress(0, 0); if (UpdateQueue.Count > 0) { if (UpdateQueue[0].IsReadRequest) { mainWindow.UpdateQueueProgress(-1, 1); var workItems = GetAllWorkItems(); mainWindow.UpdateQueueProgress(0, workItems.Count); var tasks = new ObservableCollection <DisplayTask>(); var i = 0; foreach (WorkItem workItem in workItems) { var newTask = new DisplayTask(workItem); //newTask.LinkedTasks = GetRelatedWorkItems(workItem); tasks.Add(newTask); i++; mainWindow.UpdateQueueProgress(i, workItems.Count); } mainWindow.ReloadTasks(tasks); mainWindow.UpdateQueueProgress(0, 0); lastRefresh = DateTime.Now; } else { mainWindow.UpdateQueueProgress(-1, 1); var savedCorrectly = SaveWorkItem(UpdateQueue[0]); if (!savedCorrectly) { mainWindow.UpdateQueueProgress(0, 0); return; } if (UpdateQueue[0].DisplayTask != null) { if (!AllTasks.Contains(UpdateQueue[0].DisplayTask)) { if (mainWindow != null) { mainWindow.AddTaskFromThread(UpdateQueue[0].DisplayTask); } } else { mainWindow.FilterTasksFromThread(); } } mainWindow.UpdateQueueProgress(0, 0); } if (UpdateQueue[0].DisplayTask != null) { UpdateQueue[0].DisplayTask.NotifyPropertyChanged("ID"); } UpdateQueue.RemoveAtOnUI(0); } else if ((DateTime.Now - lastRefresh).Seconds > Convert.ToInt32(ConfigurationManager.AppSettings["TFSUpdateInterval"]) * 60) { UpdateQueue.AddOnUI(new TaskUpdate { ID = -1, IsReadRequest = true }); } } catch (Exception ex) { MessageBox.Show( "An error was encountered. Whatever you were doing may have to be reattempted. \n" + ex.Message); } Thread.Sleep(1000); } }, CancellationToken.None, TaskContinuationOptions.OnlyOnRanToCompletion, TaskScheduler.Default); }
private void UserControl_DataContextChanged(object sender, DependencyPropertyChangedEventArgs e) { Task = DataContext as DisplayTask; ddState.ItemsSource = Task.StateList; icTaskAttachments.ItemsSource = Task.Attachments; }
private ObservableCollection <DisplayTask> GetAssociatedTasks(DisplayTask parentTask) { return(new ObservableCollection <DisplayTask>(AllTasks.Where(t => parentTask.Links.Contains(t.ID)))); }
public void AddTaskFromThread(DisplayTask task) { icNewTaskList.Dispatcher.Invoke(new AddTaskCallBack(AddTask), new object[] { task }); }
private void AddTask(DisplayTask task) { AllTasks.Add(task); FilterTasks(null); }