Exemplo n.º 1
0
        private void TodoText_KeyPress(object sender, KeyPressEventArgs e)
        {
            MyAutoSizeTextbox tb = (MyAutoSizeTextbox)sender;
            Control           p  = base.Parent;
            int index            = p.Controls.IndexOf(this);

            if (e.KeyChar == (char)Keys.Enter)
            {
                content = TodoText.Text;
                updateTodo();

                MyTodoItem td = new MyTodoItem();
                e.Handled = true;
                p.Controls.Add(td);
                p.Controls.SetChildIndex(td, index + 1);
                td.TodoText.Focus();
            }
            else if (e.KeyChar == (char)Keys.Back && tb.Text == "")
            {
                if (index > 0)
                {
                    p.Controls[index - 1].Focus();
                }
                p.Controls.Remove(this);
                if (MainForm.Data.todoIs.ContainsKey(Id))
                {
                    MainForm.Data.todoIs.Remove(Id);
                }
            }
        }
        public override void updateData()
        {
            base.updateData();
            base.Todos.Controls.Clear();
            MainForm.Data.todoItems.Sort((a, b) => a.Due.CompareTo(b.Due));

            foreach (MyTodoItem td in MainForm.Data.todoItems)
            {
                if (td.Cstate == MyImage.clickedCheckbox)
                {
                    continue;
                }
                if (td.IsDelete == true)
                {
                    continue;
                }
                //if (td.Due.ToString("yyyy-MM-dd") == DateTime.Now.ToString("yyyy-MM-dd"))
                //{
                MyTodoItem tdi = new MyTodoItem(td.Content, td.Cstate, td.Id);
                tdi.Due           = td.Due;
                tdi.TodoText.Text = td.Due.ToString() + ": " + td.Content;
                Todos.Controls.Add(tdi);
                //}
            }
        }
Exemplo n.º 3
0
        public MyInputBox(FlowLayoutPanel parent, MyTodoItem todo = null)
        {
            shortTodoPanel = todo;
            container      = parent;

            AutoSize  = true;
            BackColor = shadowGrey;

            innerPanel               = new FlowLayoutPanel();
            innerPanel.Location      = new Point(1, 1);
            innerPanel.Margin        = new Padding(0, 0, 1, 1);
            innerPanel.BackColor     = Color.White;
            innerPanel.WrapContents  = false;
            innerPanel.FlowDirection = FlowDirection.TopDown;
            innerPanel.Size          = new Size(429, 118);
            innerPanel.AutoSize      = true;

            AddTodoItemToInnerPanel();
            AddShortcutToInnerPanel();
            AddOptionPanelToInnerPanel();

            InitInputBox();

            Controls.Add(innerPanel);

            addLostFocusEvent(this);
        }
Exemplo n.º 4
0
 public override void updateData()
 {
     base.updateData();
     Todos.Controls.Clear();
     foreach (MyTodoItem td in MainForm.Data.todoItems)
     {
         if (td.IsDelete == true)
         {
             MyTodoItem tdi = new MyTodoItem(td.Content, td.Cstate, td.Id);
             tdi.Due      = td.Due;
             tdi.IsDelete = true;
             Todos.Controls.Add(tdi);
         }
     }
 }
Exemplo n.º 5
0
 public void updateTodo()
 {
     content    = todoText.Text;
     ParentName = MainForm.Data.nowDisplayList.TitleName;
     if (Id == -1)
     {
         Id = MainForm.Data.idNum++;
         MainForm.Data.todoItems.Add(this);
         MainForm.Data.todoIs[Id] = this;
     }
     else if (MainForm.Data.todoIs.ContainsKey(Id))
     {
         MyTodoItem his = MainForm.Data.todoIs[Id];
         his.content  = content;
         his.Due      = Due;
         his.IsDelete = IsDelete;
         his.cstate   = checkBox.Image;
     }
 }
Exemplo n.º 6
0
        public override void updateData()
        {
            base.updateData();
            Todos.Controls.Clear();

            foreach (MyTodoItem td in MainForm.Data.todoItems)
            {
                if (td.IsDelete == true)
                {
                    continue;
                }
                if (td.Cstate == MyImage.clickedCheckbox)
                {
                    continue;
                }
                MyTodoItem tdi = new MyTodoItem(td.Content, td.Cstate, td.Id);
                tdi.Due = td.Due;
                Todos.Controls.Add(tdi);
            }
        }