private void ScheduleAdd_Click(object sender, EventArgs e)
 {
     try
     {
         GXSchedule  schedule = new GXSchedule();
         SchedultDlg dlg      = new SchedultDlg(schedule);
         if (dlg.ShowDialog(panel1.Parent) == DialogResult.OK)
         {
             List <GXSchedule> list = new List <GXSchedule>();
             list.Add(schedule);
             ami.AddSchedules(list);
             ListViewItem li = SchedulesView.Items.Add(schedule.Start);
             li.SubItems.Add(schedule.Name);
             li.Tag = schedule;
         }
     }
     catch (Exception Ex)
     {
         MessageBox.Show(panel1.Parent, Ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
 private void ScheduleEdit_Click(object sender, EventArgs e)
 {
     try
     {
         if (SchedulesView.SelectedItems.Count == 1)
         {
             GXSchedule  schedule = (GXSchedule)SchedulesView.SelectedItems[0].Tag;
             SchedultDlg dlg      = new SchedultDlg(schedule);
             if (dlg.ShowDialog(panel1.Parent) == DialogResult.OK)
             {
                 List <GXSchedule> list = new List <GXSchedule>();
                 list.Add(schedule);
                 ami.UpdateSchedules(list);
                 SchedulesView.SelectedItems[0].Text             = schedule.Start;
                 SchedulesView.SelectedItems[0].SubItems[1].Text = schedule.Name;
             }
         }
     }
     catch (Exception Ex)
     {
         MessageBox.Show(panel1.Parent, Ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }