Exemple #1
0
        private void tsmiOpenSheduleFromFile_Click(object sender, EventArgs e)
        {
            OpenFileDialog frmOpen = new OpenFileDialog();

            frmOpen.DefaultExt = "xml";
            frmOpen.Filter     = "(*.xml)|*.xml";

            if (frmOpen.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                try
                {
                    Schedule = ScheduleSerializer.ReadData(frmOpen.FileName);

                    if (Schedule != null)
                    {
                        Schedule.Employments.Clear();
                    }

                    UpdateTableShedule();
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }

                if (dgvSchedule.ColumnCount <= 0)
                {
                    cmbView.Enabled = false;
                }
                else
                {
                    cmbView.Enabled = true;
                }
            }
        }