public override MenuItem MergeMenu() { TaskMenuItem taskMenuItem = (TaskMenuItem)base.MergeMenu(); ; taskMenuItem.taskId = this.taskId; taskMenuItem.rectangle = this.rectangle; taskMenuItem.Pick = this.Pick; return(taskMenuItem); }
private void mnuTaskSetTo_Click(object sender, EventArgs e) { TaskMenuItem mnu = (TaskMenuItem)sender; foreach (ListViewItem item in this.taskList.SelectedItems) { if (item.Tag is Log) //see bug 2253519 { Log log = (Log)item.Tag; Logs.UpdateLogTaskId(log.Id, mnu.TaskId); } } }
private void CreateNotifyMenu() { MenuItem exitContextMenuItem = new MenuItem(); MenuItem menuItem1 = new MenuItem(); menuItem1.Text = "-"; TaskMenuItem idleMenuItem = new TaskMenuItem(Tasks.IdleTask.Id); idleMenuItem.Text = Tasks.IdleTask.Description; idleMenuItem.Pick += new EventHandler(mnuTaskAdd_Click); this.notifyContextMenu = new ContextMenu(); this.notifyContextMenu.MenuItems.AddRange(new MenuItem[] { exitContextMenuItem, menuItem1, idleMenuItem }); exitContextMenuItem.Index = 0; exitContextMenuItem.Text = "Exit"; exitContextMenuItem.Click += new EventHandler(exitContextMenuItem_Click); ArrayList a = new ArrayList(); Task[] tasks; tasks = Tasks.GetChildTasks(Tasks.RootTask.Id); foreach (Task task in tasks) { if (task.Id == Tasks.IdleTask.Id) { continue; } if (task.Hidden) { continue; } TaskMenuItem menuItem = new TaskMenuItem(task.Id); menuItem.Text = task.Description; menuItem.Pick += new EventHandler(mnuTaskAdd_Click); a.Add(menuItem); AddSubTasks(task, menuItem, new EventHandler(mnuTaskAdd_Click)); } ContextMenu defaultTasksMenu = new ContextMenu((TaskMenuItem[])a.ToArray(typeof(TaskMenuItem))); this.notifyContextMenu.MergeMenu(defaultTasksMenu); this.notifyIcon.ContextMenu = this.notifyContextMenu; }
private void AddSubTasks(Task parentTask, TaskMenuItem menuItem, EventHandler handler) { //ArrayList a = new ArrayList(); Task[] tasks; tasks = Tasks.GetChildTasks(parentTask.Id); if (tasks.Length == 0) { return; } foreach (Task task in tasks) { TaskMenuItem subMenu = new TaskMenuItem(task.Id); subMenu.Text = task.Description; subMenu.Pick += handler; //a.Add(subMenu); menuItem.MenuItems.Add(subMenu); AddSubTasks(task, subMenu, handler); } //menuItem.MenuItems.AddRange((TaskMenuItem[]) a.ToArray(typeof (TaskMenuItem))); }
private void mnuTaskAdd_Click(object sender, EventArgs e) { TaskMenuItem mnu = (TaskMenuItem)sender; AddTaskLog(mnu.TaskId, (int)ConfigurationHelper.GetConfiguration(ConfigurationKey.TasksLogDuration).Value); }
private void CreateRigthClickMenu() { MenuItem mnuEdit = new MenuItem(); MenuItem mnuShowProperties = new MenuItem(); MenuItem mnuDelete = new MenuItem(); MenuItem mnuCopy = new MenuItem(); MenuItem mnuPaste = new MenuItem(); MenuItem menuItem11 = new MenuItem(); TaskMenuItem idleMenuItem = new TaskMenuItem(Tasks.IdleTask.Id); idleMenuItem.Text = Tasks.IdleTask.Description; idleMenuItem.Pick += new EventHandler(mnuTaskSetTo_Click); this.rigthClickMenu.MenuItems.Clear(); this.rigthClickMenu.MenuItems.AddRange(new MenuItem[] { mnuEdit, mnuShowProperties, mnuDelete, mnuCopy, mnuPaste, menuItem11, idleMenuItem }); mnuEdit.DefaultItem = true; mnuEdit.Index = 0; mnuEdit.Text = "Edit..."; mnuEdit.Click += new EventHandler(this.mnuEdit_Click); mnuShowProperties.Index = 1; mnuShowProperties.Shortcut = Shortcut.CtrlP; mnuShowProperties.Text = "Show task properties..."; mnuShowProperties.Click += new EventHandler(this.mnuShowProperties_Click); mnuDelete.Index = 2; mnuDelete.Shortcut = Shortcut.Del; mnuDelete.Text = "Delete"; mnuDelete.Click += new EventHandler(this.mnuDelete_Click); mnuCopy.Index = 3; mnuCopy.Shortcut = Shortcut.CtrlC; mnuCopy.Text = "Copy"; mnuCopy.Click += new EventHandler(this.mnuCopy_Click); mnuPaste.Index = 4; mnuPaste.Shortcut = Shortcut.CtrlV; mnuPaste.Text = "Paste"; mnuPaste.Click += new EventHandler(this.mnuPaste_Click); menuItem11.Index = 5; menuItem11.Text = "-"; ArrayList a = new ArrayList(); Task[] tasks; tasks = Tasks.GetChildTasks(Tasks.RootTask.Id); foreach (Task task in tasks) { if (task.Id == Tasks.IdleTask.Id) { continue; } if (task.Hidden) { continue; } TaskMenuItem menuItem = new TaskMenuItem(task.Id); menuItem.Text = task.Description; menuItem.Pick += new EventHandler(mnuTaskSetTo_Click); a.Add(menuItem); AddSubTasks(task, menuItem, new EventHandler(mnuTaskSetTo_Click)); } ContextMenu defaultTasksMenu = new ContextMenu((TaskMenuItem[])a.ToArray(typeof(TaskMenuItem))); this.rigthClickMenu.MergeMenu(defaultTasksMenu); }
private void CreateRigthClickMenu() { MenuItem mnuEdit = new MenuItem(); MenuItem mnuShowProperties = new MenuItem(); MenuItem mnuDelete = new MenuItem(); MenuItem mnuCopy = new MenuItem(); MenuItem mnuPaste = new MenuItem(); MenuItem menuItem11 = new MenuItem(); TaskMenuItem idleMenuItem = new TaskMenuItem(Tasks.IdleTask.Id); idleMenuItem.Text = Tasks.IdleTask.Description; idleMenuItem.Pick += new EventHandler(mnuTaskSetTo_Click); this.rigthClickMenu.MenuItems.Clear(); this.rigthClickMenu.MenuItems.AddRange(new MenuItem[] { mnuEdit, mnuShowProperties, mnuDelete, mnuCopy, mnuPaste, menuItem11, idleMenuItem }); mnuEdit.DefaultItem = true; mnuEdit.Index = 0; mnuEdit.Text = "Edit..."; mnuEdit.Click += new EventHandler(this.mnuEdit_Click); mnuShowProperties.Index = 1; mnuShowProperties.Shortcut = Shortcut.CtrlP; mnuShowProperties.Text = "Show task properties..."; mnuShowProperties.Click += new EventHandler(this.mnuShowProperties_Click); mnuDelete.Index = 2; mnuDelete.Shortcut = Shortcut.Del; mnuDelete.Text = "Delete"; mnuDelete.Click += new EventHandler(this.mnuDelete_Click); mnuCopy.Index = 3; mnuCopy.Shortcut = Shortcut.CtrlC; mnuCopy.Text = "Copy"; mnuCopy.Click += new EventHandler(this.mnuCopy_Click); mnuPaste.Index = 4; mnuPaste.Shortcut = Shortcut.CtrlV; mnuPaste.Text = "Paste"; mnuPaste.Click += new EventHandler(this.mnuPaste_Click); menuItem11.Index = 5; menuItem11.Text = "-"; ArrayList a = new ArrayList(); Task[] tasks; tasks = Tasks.GetChildTasks(Tasks.RootTask.Id); foreach (Task task in tasks) { if (task.Id == Tasks.IdleTask.Id) continue; if (task.Hidden) continue; TaskMenuItem menuItem = new TaskMenuItem(task.Id); menuItem.Text = task.Description; menuItem.Pick += new EventHandler(mnuTaskSetTo_Click); a.Add(menuItem); AddSubTasks(task, menuItem, new EventHandler(mnuTaskSetTo_Click)); } ContextMenu defaultTasksMenu = new ContextMenu((TaskMenuItem[]) a.ToArray(typeof (TaskMenuItem))); this.rigthClickMenu.MergeMenu(defaultTasksMenu); }
private void CreateNotifyMenu() { MenuItem exitContextMenuItem = new MenuItem(); MenuItem menuItem1 = new MenuItem(); menuItem1.Text = "-"; TaskMenuItem idleMenuItem = new TaskMenuItem(Tasks.IdleTask.Id); idleMenuItem.Text = Tasks.IdleTask.Description; idleMenuItem.Pick += new EventHandler(mnuTaskAdd_Click); this.notifyContextMenu = new ContextMenu(); this.notifyContextMenu.MenuItems.AddRange(new MenuItem[] { exitContextMenuItem, menuItem1, idleMenuItem }); exitContextMenuItem.Index = 0; exitContextMenuItem.Text = "Exit"; exitContextMenuItem.Click += new EventHandler(exitContextMenuItem_Click); ArrayList a = new ArrayList(); Task[] tasks; tasks = Tasks.GetChildTasks(Tasks.RootTask.Id); foreach (Task task in tasks) { if (task.Id == Tasks.IdleTask.Id) continue; if(task.Hidden) continue; TaskMenuItem menuItem = new TaskMenuItem(task.Id); menuItem.Text = task.Description; menuItem.Pick += new EventHandler(mnuTaskAdd_Click); a.Add(menuItem); AddSubTasks(task, menuItem, new EventHandler(mnuTaskAdd_Click)); } ContextMenu defaultTasksMenu = new ContextMenu((TaskMenuItem[]) a.ToArray(typeof (TaskMenuItem))); this.notifyContextMenu.MergeMenu(defaultTasksMenu); this.notifyIcon.ContextMenu = this.notifyContextMenu; }
private void AddSubTasks(Task parentTask, TaskMenuItem menuItem, EventHandler handler) { //ArrayList a = new ArrayList(); Task[] tasks; tasks = Tasks.GetChildTasks(parentTask.Id); if (tasks.Length == 0) return; foreach (Task task in tasks) { TaskMenuItem subMenu = new TaskMenuItem(task.Id); subMenu.Text = task.Description; subMenu.Pick += handler; //a.Add(subMenu); menuItem.MenuItems.Add(subMenu); AddSubTasks(task, subMenu, handler); } //menuItem.MenuItems.AddRange((TaskMenuItem[]) a.ToArray(typeof (TaskMenuItem))); }