Esempio n. 1
0
 public void check_MouseClick_Multi(object sender, EventArgs e)
 {
     ec[position].Eventlist.RemoveAt(0);
     if (ec[position].Eventlist.Count == 0)
     {
         ec[position].IsFinished   = true;
         ec[position].IsMultiEvent = false;
         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 < ec.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);
             }
         }
     }
     else
     {
         subtitle.Text        = ec[position].Eventlist[0];
         eventPanel.Visible   = true;
         controlPanel.Visible = false;
     }
 }
Esempio n. 2
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;
            }
        }
Esempio n. 3
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);
        }
Esempio n. 4
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 { }
 }