示例#1
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++;
            }
        }
示例#2
0
 //如果此為修改表格,則應先填入原本資料
 private void RefreshData()
 {
     if (_presentationModel.IsEdit())
     {
         Task task = _presentationModel.GetTargetTask();
         _titleBox.Text = task.Title;
         _assigneeComboBox.SelectedText  = task.Assignee;
         _priorityComboBox.SelectedIndex = task.Priority;
         _descriptionTextBox.Text        = task.Description;
         _deadline.Value = Convert.ToDateTime(task.Deadline);
     }
 }
示例#3
0
        public NewTaskForm(PresentationModel presentationModel)
        {
            _presentationModel = presentationModel;

            InitializeComponent();
            _assigneeComboBox.Items.Clear();
            foreach (string username in _presentationModel.GetProjectUsers())
            {
                _assigneeComboBox.Items.Add(username);
            }
            if (_presentationModel.IsEdit())
            {
                Task task = _presentationModel.GetTargetTask();
                _titleBox.Text                  = task.Title;
                _descriptionTextBox.Text        = task.Description;
                _priorityComboBox.SelectedIndex = task.Priority;
                _deadline.Value                 = Convert.ToDateTime(task.Deadline);
                _assigneeComboBox.Text          = task.Assignee;
            }
        }
示例#4
0
        public NewTaskForm(PresentationModel presentationModel)
        {
            _presentationModel = presentationModel;

            InitializeComponent();
            _assigneeComboBox.Items.Clear();
            foreach (string username in _presentationModel.GetProjectUsers())
            {
                _assigneeComboBox.Items.Add(username);
            }
            if (_presentationModel.IsEdit())
            {
                Task task = _presentationModel.GetTargetTask();
                _titleBox.Text = task.Title;
                _descriptionTextBox.Text = task.Description;
                _priorityComboBox.SelectedIndex = task.Priority;
                _deadline.Value = Convert.ToDateTime(task.Deadline);
                _assigneeComboBox.Text = task.Assignee;
            }
        }