private void TaskManager_TaskRemoved(object sender, QueueableTaskEventArgs e)
        {
            var count = _taskManager.Count;
            DisplayName = count == 0 ? "Tasks" : $"Tasks ({count})";

            var tv = _taskViews.FirstOrDefault(v => v.Task == e.Task);
            if (tv == null)
                return;

            Application.Invoke(() =>
            {
                _taskViews.Remove(tv);
                _vBox.Remove(tv);
            });
        }
        private void TaskManager_TaskAdded(object sender, QueueableTaskEventArgs e)
        {
            var count = _taskManager.Count;
            DisplayName = count == 0 ? "Tasks" : $"Tasks ({count})";

            if (count == 1)
            {
                _taskViews.Clear();
                _taskManager.ClearCompleted();
            }
            Application.Invoke(() =>
            {
                var tv = new TaskView(e.Task);
                _taskViews.Add(tv);

                if (_tasksOfInterest.Contains(e.Task.GetType()))
                {
                    _mainView.SwitchToTab(4);

                    if (OperatingSystem.Detect() == SupportedOperatingSystem.Windows)
                        User32.SetForegroundWindow(Process.GetCurrentProcess().MainWindowHandle);
                }
                ReOrderTasks();
            });
        }
 private void TaskManager_TaskFinished(object sender, QueueableTaskEventArgs e)
 {
     var count = _taskManager.Count;
     DisplayName = count == 0 ? "Tasks" : $"Tasks ({count})";
 }
Пример #4
0
 /// <summary>
 ///     Raises the <see cref="E:TaskFinished" /> event.
 /// </summary>
 /// <param name="e">The <see cref="ParkitectNexus.Data.Tasks.QueueableTaskEventArgs" /> instance containing the event data.</param>
 protected virtual void OnTaskFinished(QueueableTaskEventArgs e)
 {
     TaskFinished?.Invoke(this, e);
 }