private void AddTask_BtnClick(object sender, RoutedEventArgs e) { var menuItem = (MenuItem)sender; var info = menuItem.DataContext as TaskItem; var add = new Detail(info) { Height = 200, Width = 600 }; if (add.ShowDialog() == true) { var item = new ItemMini(add.Unit); item.RunMeNow += mini => _backgroundPoller.StartProcess(mini.Unit); //item.RequirePause += PauseTask; item.RmoveNow += RemoveItem; ItemBox.Children.Add(item); item.SetOrder(ItemBox.Children.Count); } _backgroundPoller.TaskList = FluskTask(); _backgroundPoller.TimerLoop(); }
private void RemoveItem(ItemMini item) { ItemBox.Children.Remove(item); _backgroundPoller.TaskList = FluskTask(); }
private void PauseTask(ItemMini obj) { obj.Actived = false; var task = obj.Unit; //if (_undoDic.ContainsKey(task)) _undoDic[task].Join(); }