コード例 #1
0
        public override MenuItem MergeMenu()
        {
            TaskMenuItem taskMenuItem = (TaskMenuItem)base.MergeMenu();

            ;
            taskMenuItem.taskId    = this.taskId;
            taskMenuItem.rectangle = this.rectangle;
            taskMenuItem.Pick      = this.Pick;
            return(taskMenuItem);
        }
コード例 #2
0
        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);
                }
            }
        }
コード例 #3
0
        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;
        }
コード例 #4
0
        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)));
        }
コード例 #5
0
        private void mnuTaskAdd_Click(object sender, EventArgs e)
        {
            TaskMenuItem mnu = (TaskMenuItem)sender;

            AddTaskLog(mnu.TaskId, (int)ConfigurationHelper.GetConfiguration(ConfigurationKey.TasksLogDuration).Value);
        }
コード例 #6
0
        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);
        }
コード例 #7
0
ファイル: TasksLogControl.cs プロジェクト: ckolumbus/ptm
        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);
        }
コード例 #8
0
ファイル: TasksLogControl.cs プロジェクト: ckolumbus/ptm
        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;
        }
コード例 #9
0
ファイル: TasksLogControl.cs プロジェクト: ckolumbus/ptm
        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)));
        }