示例#1
0
 public void finish_MouseClick(object sender, MouseEventArgs e)
 {
     listPanel.Controls.Clear();
     try
     {
         List <EventClass> ec2 = EventReader.DeserializeFromXML();
         int b = 0;
         int c = 0;
         for (int i = 0; i < ec2.Count; i++)
         {
             if (ec2[i].IsFinished == true)
             {
                 Event list = new Event(ec2, i);
                 if (ec2[i].IsMultiEvent == false)
                 {
                     list.Size     = new Size(300 - 2, 60);
                     list.Location = new Point(0, (b++) * 60 + c * 85 + b + c - 1);
                 }
                 else
                 {
                     list.Size     = new Size(300 - 2, 85);
                     list.Location = new Point(0, b * 60 + (c++) * 85 + b + c - 1);
                 }
                 listPanel.Controls.Add(list);
             }
         }
     }
     catch { }
 }
示例#2
0
        public void check_MouseClick(object sender, EventArgs e)
        {
            ec[position].IsFinished = true;
            EventWriter.SerializeToXML(ec);
            Control control = this.Parent;

            control.Controls.Clear();
            List <EventClass> ec2 = EventReader.DeserializeFromXML();
            int b = 0;
            int c = 0;

            for (int i = 0; i < ec2.Count; i++)
            {
                if (ec2[i].IsFinished != true)
                {
                    Event list = new Event(ec2, i);
                    if (ec2[i].IsMultiEvent == false)
                    {
                        list.Size     = new Size(300 - 2, 60);
                        list.Location = new Point(0, (b++) * 60 + c * 85 + b + c - 1);
                    }
                    else
                    {
                        list.Size     = new Size(300 - 2, 85);
                        list.Location = new Point(0, b * 60 + (c++) * 85 + b + c - 1);
                    }
                    control.Controls.Add(list);
                }
            }
        }
示例#3
0
        public void edit_MouseClick(object sender, EventArgs e)
        {
            CreateEventForm form = new CreateEventForm(ec[position]);

            ec.RemoveAt(position);
            EventWriter.SerializeToXML(ec);
            form.ShowDialog();
            Control control = this.Parent;

            control.Controls.Clear();
            List <EventClass> ec2 = EventReader.DeserializeFromXML();
            int b = 0;
            int c = 0;

            for (int i = 0; i < ec2.Count; i++)
            {
                if (ec2[i].IsFinished != true)
                {
                    Event list = new Event(ec2, i);
                    if (ec2[i].IsMultiEvent == false)
                    {
                        list.Size     = new Size(300 - 2, 60);
                        list.Location = new Point(0, (b++) * 60 + c * 85 + b + c - 1);
                    }
                    else
                    {
                        list.Size     = new Size(300 - 2, 85);
                        list.Location = new Point(0, b * 60 + (c++) * 85 + b + c - 1);
                    }
                    control.Controls.Add(list);
                }
            }
            eventPanel.Visible   = true;
            controlPanel.Visible = false;
        }
示例#4
0
        void ok_Click(object sender, EventArgs e)
        {
            EventClass        newEvent;
            int               importanceNum = 1;
            List <EventClass> elist         = new List <EventClass>();

            try
            {
                elist = EventReader.DeserializeFromXML();
            }
            catch { }
            switch ((String)importanceComboBox.SelectedItem)
            {
            case "Whatever":
                importanceNum = 0;
                break;

            case "Normal":
                importanceNum = 1;
                break;

            case "Important":
                importanceNum = 2;
                break;
            }
            switch ((String)typeComboBox.SelectedItem)
            {
            case "Single":
                newEvent = new EventClass(nameTextBox.Text, picker.Value, importanceNum, false, false, null);
                elist.Add(newEvent);
                break;

            case "Multiple":
                events = new List <string>();
                for (int i = 1; i <= totalNum; i++)
                {
                    if (seriesTextBox[i].Text != "")
                    {
                        events.Add(seriesTextBox[i].Text);
                    }
                }
                if (events.Count == 0)
                {
                    newEvent = new EventClass(nameTextBox.Text, picker.Value, importanceNum, false, false, null);
                }
                else
                {
                    newEvent = new EventClass(nameTextBox.Text, picker.Value, importanceNum, false, true, events);
                }
                elist.Add(newEvent);
                break;
            }
            EventWriter.SerializeToXML(elist);
            this.Close();
        }
示例#5
0
        public void keyDown(object senderm, KeyEventArgs e)
        {
            switch (e.KeyCode)
            {
            case Keys.Escape:
                if (isEdit)
                {
                    Console.WriteLine("!");
                    List <EventClass> elist = new List <EventClass>();
                    try
                    {
                        elist = EventReader.DeserializeFromXML();
                    }
                    catch { }
                    elist.Add(eventClass);
                    EventWriter.SerializeToXML(elist);
                }
                this.Dispose();
                break;

            case Keys.Enter:
                break;
            }
        }
示例#6
0
        private void InitializeComponent()
        {
            this.SuspendLayout();

            // titleBar
            titleBar           = new TitleBar();
            titleBar.Size      = new Size(300 - 2, 40);
            titleBar.Location  = new Point(0 + 1, 1);
            titleBar.BackColor = Color.DimGray;

            // adder
            adder             = new PictureBox();
            adder.Size        = new Size(30, 30);
            adder.Image       = Image.FromFile("adder.png");
            adder.SizeMode    = PictureBoxSizeMode.StretchImage;
            adder.Location    = new Point(0, 470);
            adder.MouseClick += adder_MouseClick;

            // sort
            sort             = new PictureBox();
            sort.Size        = new Size(30, 30);
            sort.Image       = Image.FromFile("sort.png");
            sort.SizeMode    = PictureBoxSizeMode.StretchImage;
            sort.Location    = new Point(50, 470);
            sort.MouseClick += sort_MouseClick;

            // finish
            finish             = new PictureBox();
            finish.Size        = new Size(30, 30);
            finish.Image       = Image.FromFile("finish.png");
            finish.SizeMode    = PictureBoxSizeMode.StretchImage;
            finish.Location    = new Point(100, 470);
            finish.MouseClick += finish_MouseClick;

            //Event
            listPanel          = new Panel();
            listPanel.Size     = new Size(300 - 2, 430 - 4);
            listPanel.Location = new Point(0 + 1, 40 + 2);
            try
            {
                List <EventClass> ec = EventReader.DeserializeFromXML();
                int b = 0;
                int c = 0;
                for (int i = 0; i < ec.Count; i++)
                {
                    if (ec[i].IsFinished != true)
                    {
                        Event list = new Event(ec, i);
                        if (ec[i].IsMultiEvent == false)
                        {
                            list.Size     = new Size(300 - 2, 60);
                            list.Location = new Point(0, (b++) * 60 + c * 85 + b + c - 1);
                        }
                        else
                        {
                            list.Size     = new Size(300 - 2, 85);
                            list.Location = new Point(0, b * 60 + (c++) * 85 + b + c - 1);
                        }
                        listPanel.Controls.Add(list);
                    }
                }
            }
            catch { }
            listPanel.AutoScroll = true;

            // MainForm
            this.FormBorderStyle = FormBorderStyle.None;
            this.Name            = "MainForm";
            this.Size            = new Size(300, 500);
            this.BackColor       = Color.FromArgb(45, 45, 48);
            this.Controls.Add(titleBar);
            this.Controls.Add(adder);
            this.Controls.Add(sort);
            this.Controls.Add(finish);
            this.Controls.Add(listPanel);

            Sort();

            // timer
            timer          = new Timer();
            timer.Interval = 30000;
            timer.Enabled  = true;
            timer.Tick    += timer_Tick;

            this.ResumeLayout(false);
        }
示例#7
0
 public void Sort()
 {
     try
     {
         if (sortMethod == 1)
         {
             sortMethod = 0;
             listPanel.Controls.Clear();
             List <EventClass> ec2 = EventReader.DeserializeFromXML();
             ec2.Sort((x, y) => { return(x.Due.CompareTo(y.Due)); });
             int b = 0;
             int c = 0;
             for (int i = 0; i < ec2.Count; i++)
             {
                 if (ec2[i].IsFinished != true)
                 {
                     Event list = new Event(ec2, i);
                     if (ec2[i].IsMultiEvent == false)
                     {
                         list.Size     = new Size(300 - 2, 60);
                         list.Location = new Point(0, (b++) * 60 + c * 85 + b + c - 1);
                     }
                     else
                     {
                         list.Size     = new Size(300 - 2, 85);
                         list.Location = new Point(0, b * 60 + (c++) * 85 + b + c - 1);
                     }
                     listPanel.Controls.Add(list);
                 }
             }
         }
         else if (sortMethod == 0)
         {
             sortMethod = 1;
             listPanel.Controls.Clear();
             List <EventClass> ec2 = EventReader.DeserializeFromXML();
             ec2.Sort((x, y) => { return(-x.Importance.CompareTo(y.Importance)); });
             int b = 0;
             int c = 0;
             for (int i = 0; i < ec2.Count; i++)
             {
                 if (ec2[i].IsFinished != true)
                 {
                     Event list = new Event(ec2, i);
                     if (ec2[i].IsMultiEvent == false)
                     {
                         list.Size     = new Size(300 - 2, 60);
                         list.Location = new Point(0, (b++) * 60 + c * 85 + b + c - 1);
                     }
                     else
                     {
                         list.Size     = new Size(300 - 2, 85);
                         list.Location = new Point(0, b * 60 + (c++) * 85 + b + c - 1);
                     }
                     listPanel.Controls.Add(list);
                 }
             }
         }
     }
     catch { }
 }