/// <summary> /// Adds the given <see cref="IBackgroundTask"/> to the view's list. If the <see cref="IBackgroundTask"/> /// already exists in the list, nothing is done. /// </summary> /// <param name="p_tskTask">The <see cref="IBackgroundTask"/> to add to the view's list.</param> protected void AddTaskToList(IBackgroundTask p_tskTask) { foreach (ActivityListViewItem lviExisitingActivity in lvwTasks.Items) { if (lviExisitingActivity.Task == p_tskTask) { return; } } p_tskTask.PropertyChanged -= new PropertyChangedEventHandler(Task_PropertyChanged); p_tskTask.PropertyChanged += new PropertyChangedEventHandler(Task_PropertyChanged); ActivityListViewItem lviActivity = new ActivityListViewItem(p_tskTask); lvwTasks.Items.Add(lviActivity); }
/// <summary> /// Adds the given <see cref="IBackgroundTask"/> to the view's list. If the <see cref="IBackgroundTask"/> /// already exists in the list, nothing is done. /// </summary> /// <param name="p_tskTask">The <see cref="IBackgroundTask"/> to add to the view's list.</param> protected void AddTaskToList(IBackgroundTask p_tskTask) { foreach (ActivityListViewItem lviExisitingActivity in lvwTasks.Items) if (lviExisitingActivity.Task == p_tskTask) return; p_tskTask.PropertyChanged -= new PropertyChangedEventHandler(Task_PropertyChanged); p_tskTask.PropertyChanged += new PropertyChangedEventHandler(Task_PropertyChanged); ActivityListViewItem lviActivity = new ActivityListViewItem(p_tskTask); lvwTasks.Items.Add(lviActivity); }