Пример #1
0
        private void Sticky_MouseDown(object sender, MouseEventArgs e)
        {
            Sticky sticky = ((Sticky)sender);

            if (e.Button == MouseButtons.Right)
            {
                _presentationModel.SetEditState(sticky.Task);

                /*
                 * if (sticky.Task.TaskState == TaskState.ToDo)
                 * {
                 *  _todoGroupBox.Controls.Remove(sticky);
                 * }
                 * else if (sticky.Task.TaskState == TaskState.Doing)
                 * {
                 *  _doingGroupBox.Controls.Remove(sticky);
                 * }
                 * else if (sticky.Task.TaskState == TaskState.Done)
                 * {
                 *  _doneGroupBox.Controls.Remove(sticky);
                 * }
                 * */
                this.Controls.Add(sticky);
                sticky.BringToFront();
            }
            //RefreshSticky 必須更新所有sticky
        }
Пример #2
0
        private void RefreshGroupBox(GroupBox gb, List <Task> tasklist)
        {
            int i = 0;

            foreach (Sticky sticky in gb.Controls)
            {
                if (i < tasklist.Count)
                {
                    sticky.Task = tasklist[i];
                    sticky.Top  = i * sticky.Height;
                    if (tasklist[i] == _presentationModel.GetTargetTask())
                    {
                        sticky.BorderStyle = BorderStyle.Fixed3D;
                    }
                    else
                    {
                        sticky.BorderStyle = BorderStyle.FixedSingle;
                    }
                }
                else
                {
                    sticky.Dispose();
                }
                i++;
            }
            //如果有未加完的Task,需要New新的Sticky去承接剩下的
            while (i < tasklist.Count)
            {
                //新增sticky須新增事件
                Sticky sticky = new Sticky(tasklist[i]);
                sticky.DoubleClick += new System.EventHandler(this.Sticky_DoubleClick);
                sticky.Click       += new System.EventHandler(this.Sticky_Click);
                sticky.MouseDown   += new System.Windows.Forms.MouseEventHandler(this.Sticky_MouseDown);
                sticky.MouseUp     += new System.Windows.Forms.MouseEventHandler(this.Sticky_MouseUp);
                sticky.BringToFront();
                gb.Controls.Add(sticky);
                Task target = _presentationModel.GetTargetTask();
                if (target != null)
                {
                    if (tasklist[i].PrimeKey == target.PrimeKey)
                    {
                        sticky.BorderStyle = BorderStyle.Fixed3D;
                    }
                }
                else
                {
                    sticky.BorderStyle = BorderStyle.FixedSingle;
                }
                sticky.Top = i * sticky.Height;
                i++;
            }
        }
Пример #3
0
 private void RefreshGroupBox(GroupBox gb, List<Task> tasklist)
 {
     int i = 0;
     foreach (Sticky sticky in gb.Controls)
     {
         if (i < tasklist.Count)
         {
             sticky.Task = tasklist[i];
             sticky.Top = i * sticky.Height;
             if (tasklist[i] == _presentationModel.GetTargetTask())
             {
                 sticky.BorderStyle = BorderStyle.Fixed3D;
             }
             else
             {
                 sticky.BorderStyle = BorderStyle.FixedSingle;
             }
         }
         else
         {
             sticky.Dispose();
         }
         i++;
     }
     //如果有未加完的Task,需要New新的Sticky去承接剩下的
     while (i < tasklist.Count)
     {
         //新增sticky須新增事件
         Sticky sticky = new Sticky(tasklist[i]);
         sticky.DoubleClick += new System.EventHandler(this.Sticky_DoubleClick);
         sticky.Click += new System.EventHandler(this.Sticky_Click);
         sticky.MouseDown += new System.Windows.Forms.MouseEventHandler(this.Sticky_MouseDown);
         sticky.MouseUp += new System.Windows.Forms.MouseEventHandler(this.Sticky_MouseUp);
         sticky.BringToFront();
         gb.Controls.Add(sticky);
         Task target = _presentationModel.GetTargetTask();
         if(target != null){
             if (tasklist[i].PrimeKey == target.PrimeKey)
             {
                 sticky.BorderStyle = BorderStyle.Fixed3D;
             }
         }
         else
         {
             sticky.BorderStyle = BorderStyle.FixedSingle;
         }
         sticky.Top = i * sticky.Height;
         i++;
     }
 }