private void treeView1_AfterSelect(object sender, TreeViewEventArgs e) { if (e.Node.Parent == null) { lvApplications.Visible = true; TsTask currentTask = (TsTask)e.Node.Tag; _supressChecked = true; foreach (ListViewItem appItem in lvApplications.Items) { TsApplication currentApp = (TsApplication)appItem.Tag; if (currentTask.AssignedApplications.Find(a => a.PID == currentApp.PID) == null) { appItem.Checked = false; } else { appItem.Checked = true; } } _supressChecked = false; } else { lvApplications.Visible = false; } }
void TsWinLoggerStateChanged(object sender, WindowLogger.AppWindowChangedHandlerArgs args) { var prevApp = _applicationList.Find(app => app.Name == args.OldState.ProcesName && app.Description == args.OldState.ProcessDesc); var newApp = _applicationList.Find(app => app.Name == args.NewState.ProcesName && app.Description == args.NewState.ProcessDesc); if (prevApp != null) { TsApplication app = null; TsTask task = _taskList.Find(t => (app = t.AssignedApplications.Find(a => a.PID == prevApp.PID)) != null); if (task != null) { task.ActualTimeToSpend += DateTime.Now - app.StartTime; _taskDbs.UpdateTask(task); } //TODO : work with application's windows //var wind = new TsWindow(args.OldState.WindowTitle, args.OldState.Ts); //if (!actApp.RunningWindows.Contains(wind)) // actApp.RunningWindows.Add(wind); } if (newApp != null) { newApp.StartTime = DateTime.Now; } }
public void NewTask(TsTask task) { if (!_taskList.Contains(task)) { _taskDbs.NewTask(task); _taskList.Add(task); } }
public void UpdateTask(TsTask task) { //TODO : very bad code! //refactoring is needed var q = (from oldTask in _dtTasks.AsEnumerable() where (int)oldTask["Id"] == task.Id select oldTask).First(); q.SetField("ActualTimeToSpend", task.ActualTimeToSpend); }
private void AddTask(TsTask task) { TreeNode tn = new TreeNode(task.TaskName) { Name = task.TaskName, Tag = task }; if (!treeView1.Nodes.ContainsKey(task.TaskName)) { treeView1.Nodes.Add(tn); } }
private void textBox1_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Enter) { if (textBox1.Text != String.Empty) { TsTask _task = new TsTask(textBox1.Text, textBox1.Text, DateTime.Now); InvokeNewTask(new TsTask.NewTaskHandlerArgs(_task)); AddTask(_task); } textBox1.Text = String.Empty; } }
public void AddNewTask(TsTask task) { TsAppCore.Instance.NewTask(task); }
public void DelTask(TsTask task) { _dtTasks.Rows.Remove(_dtTasks.Rows.Find(task.Id)); }
public void NewTask(TsTask task) { _dtTasks.Rows.Add(task.ToDataRow()); }