Ejemplo n.º 1
0
        //Событие клика на кнопку "Выход" в тулстрипе трея
        private void выходToolStripMenuItem_Click(object sender, EventArgs e)
        {
            //Очистка файлов перед сериализацией
            StreamWriter Writer1 = new StreamWriter("Hours.xml", false, Encoding.UTF8);

            Writer1.WriteLine("");
            Writer1.Close();
            StreamWriter Writer2 = new StreamWriter("Minutes.xml", false, Encoding.UTF8);

            Writer2.WriteLine("");
            Writer2.Close();
            StreamWriter Writer3 = new StreamWriter("Dates.xml", false, Encoding.UTF8);

            Writer3.WriteLine("");
            Writer3.Close();
            StreamWriter Writer4 = new StreamWriter("Names.xml", false, Encoding.UTF8);

            Writer4.WriteLine("");
            Writer4.Close();
            StreamWriter Writer5 = new StreamWriter("DeadlineNames.xml", false, Encoding.UTF8);

            Writer5.WriteLine("");
            Writer5.Close();
            //Сериализация
            SerializeDeserialize.SerializeObject(frm.Hours, "Hours.xml");
            SerializeDeserialize.SerializeObject(frm.Minutes, "Minutes.xml");
            SerializeDeserialize.SerializeObject(frm.Dates, "Dates.xml");
            SerializeDeserialize.SerializeObject(frm.Names, "Names.xml");
            SerializeDeserialize.SerializeObject(frm.DeadlineNames, "DeadlineNames.xml");
            Application.Exit();//Закрытие приложения
        }
Ejemplo n.º 2
0
 private void FormMain_Load(object sender, EventArgs e)
 {
     notifyIconDeadLine.ContextMenuStrip = contextMenuStripNotify;
     this.Region = new Region(
         RoundedRect(
             new Rectangle(0, 0, this.Width, this.Height)
             , 10
             )
         );//Округление углов окна приложения
     //Десериализация
     try
     {
         SerializeDeserialize.Deserialize(frm.Hours, "Hours.xml");
         SerializeDeserialize.Deserialize(frm.Minutes, "Minutes.xml");
         SerializeDeserialize.Deserialize(frm.Dates, "Dates.xml");
         SerializeDeserialize.Deserialize(frm.Names, "Names.xml");
         SerializeDeserialize.Deserialize(frm.DeadlineNames, "DeadlineNames.xml");
     }
     catch { }
     iconButtonCalendar.PerformClick(); //Клик на кнопку
     iconButtonMenu.PerformClick();     //Клик на кнопку
 }