Example #1
0
 private void EditSelectedShow()
 {
     if (listViewItems.SelectedItems.Count == 1)
     {
         ListViewItem lvItem       = listViewItems.SelectedItems[0];
         ScheduleItem scheduleItem = lvItem.Tag as ScheduleItem;
         Shows.Show   show         = scheduleItem.Show;
         if (show != null)
         {
             using (Shows.ShowEditorForm f = new Shows.ShowEditorForm(show))
             {
                 if (f.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                 {
                     UpdateListItem(scheduleItem);
                 }
             }
         }
         else
         {
             //messageBox Arguments are (Text, Title, No Button Visible, Cancel Button Visible)
             MessageBoxForm.msgIcon = SystemIcons.Error;                     //this is used if you want to add a system icon to the message form.
             var messageBox = new MessageBoxForm("The selected schedule does not have a show associated with it.", "Edit a Show", false, true);
             messageBox.ShowDialog();
         }
     }
 }
Example #2
0
        private void buttonOK_Click(object sender, EventArgs e)
        {
            if (dateStart.Value > dateStop.Value)
            {
                MessageBox.Show("The end date of a show must fall after the start date.", "Date Error", MessageBoxButtons.OKCancel, MessageBoxIcon.Error);
                return;
            }
            _scheduleItem.StartDate = dateStart.Value;
            _scheduleItem.EndDate   = dateStop.Value;
            _scheduleItem.Sunday    = checkSunday.Checked;
            _scheduleItem.Monday    = checkMonday.Checked;
            _scheduleItem.Tuesday   = checkTuesday.Checked;
            _scheduleItem.Wednesday = checkWednesday.Checked;
            _scheduleItem.Thursday  = checkThursday.Checked;
            _scheduleItem.Friday    = checkFriday.Checked;
            _scheduleItem.Saturday  = checkSaturday.Checked;
            _scheduleItem.StartTime = dateStartTime.Value;
            _scheduleItem.EndTime   = dateEndTime.Value;
            _scheduleItem.Enabled   = checkEnabled.Checked;

            if (comboBoxShow.SelectedIndex >= 0)
            {
                Shows.Show show = ((comboBoxShow.SelectedItem as Common.Controls.ComboBoxItem).Value) as Shows.Show;
                _scheduleItem.ShowID = show.ID;
            }
            DialogResult = System.Windows.Forms.DialogResult.OK;
            Close();
        }
Example #3
0
        private void PopulateShowList()
        {
            List <Shows.Show> shows = Shows.ShowsData.ShowList;

            if (shows != null)
            {
                foreach (Shows.Show show in shows)
                {
                    bool foundIt = false;
                    foreach (Common.Controls.ComboBoxItem oldItem in comboBoxShows.Items)
                    {
                        Shows.Show comboBoxScheduleItem = oldItem.Value as Shows.Show;
                        if (comboBoxScheduleItem.ID == show.ID)
                        {
                            oldItem.Text = show.Name;
                            foundIt      = true;
                            break;
                        }
                    }

                    if (!foundIt)
                    {
                        Common.Controls.ComboBoxItem newItem = new Common.Controls.ComboBoxItem(show.Name, show);
                        comboBoxShows.Items.Add(newItem);
                    }
                }
            }
        }
Example #4
0
        private void buttonOK_Click(object sender, EventArgs e)
        {
            if (dateStart.Value > dateStop.Value)
            {
                //messageBox Arguments are (Text, Title, No Button Visible, Cancel Button Visible)
                MessageBoxForm.msgIcon = SystemIcons.Error;                 //this is used if you want to add a system icon to the message form.
                var messageBox = new MessageBoxForm("The end date of a show must fall after the start date.", "Date Error", false, true);
                messageBox.ShowDialog();
                return;
            }
            _scheduleItem.StartDate = dateStart.Value;
            _scheduleItem.EndDate   = dateStop.Value;
            _scheduleItem.Sunday    = checkSunday.Checked;
            _scheduleItem.Monday    = checkMonday.Checked;
            _scheduleItem.Tuesday   = checkTuesday.Checked;
            _scheduleItem.Wednesday = checkWednesday.Checked;
            _scheduleItem.Thursday  = checkThursday.Checked;
            _scheduleItem.Friday    = checkFriday.Checked;
            _scheduleItem.Saturday  = checkSaturday.Checked;
            _scheduleItem.StartTime = dateStartTime.Value;
            _scheduleItem.EndTime   = dateEndTime.Value;
            _scheduleItem.Enabled   = checkEnabled.Checked;

            if (comboBoxShow.SelectedIndex >= 0)
            {
                Shows.Show show = ((comboBoxShow.SelectedItem as Common.Controls.ComboBoxItem).Value) as Shows.Show;
                _scheduleItem.ShowID = show.ID;
            }
            DialogResult = System.Windows.Forms.DialogResult.OK;
            Close();
        }
Example #5
0
        private void buttonPlayShowNow_Click(object sender, EventArgs e)
        {
            Common.Controls.ComboBoxItem item = comboBoxShows.SelectedItem as Common.Controls.ComboBoxItem;
            if (item != null)
            {
                Shows.Show show = item.Value as Shows.Show;
                Executor.Stop(false);

                ScheduleItem scheduleItem = new ScheduleItem();
                scheduleItem.ShowID = show.ID;
                scheduleItem.Start(true);
            }
        }
Example #6
0
        private void AddListItem(ScheduleItem item)
        {
            string status = item.Enabled ? "Enabled" : "Disabled";

            Shows.Show show     = Shows.ShowsData.GetShow(item.ShowID);
            string     showName = show != null ? show.Name : "None Selected";

            ListViewItem lvItem = new ListViewItem(showName);

            lvItem.Tag = item;
            listViewItems.Items.Add(lvItem);
            lvItem.SubItems.Add(ScheduleString(item));
            lvItem.SubItems.Add(status);
        }
Example #7
0
        private void UpdateListItem(ScheduleItem item)
        {
            foreach (ListViewItem listItem in listViewItems.Items)
            {
                if ((listItem.Tag as ScheduleItem) == item)
                {
                    string     status   = item.Enabled ? "Enabled" : "Disabled";
                    Shows.Show show     = Shows.ShowsData.GetShow(item.ShowID);
                    string     showName = show != null ? show.Name : "None Selected";

                    listItem.Text             = showName;
                    listItem.SubItems[1].Text = ScheduleString(item);
                    listItem.SubItems[2].Text = status;
                }
            }
        }
Example #8
0
 private void EditSelectedShow()
 {
     if (listViewItems.SelectedItems.Count == 1)
     {
         ListViewItem lvItem       = listViewItems.SelectedItems[0];
         ScheduleItem scheduleItem = lvItem.Tag as ScheduleItem;
         Shows.Show   show         = scheduleItem.Show;
         if (show != null)
         {
             using (Shows.ShowEditorForm f = new Shows.ShowEditorForm(show))
             {
                 if (f.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                 {
                     UpdateListItem(scheduleItem);
                 }
             }
         }
         else
         {
             MessageBox.Show("The selected schedule does not have a show associated with it.", "Edit a Show", MessageBoxButtons.OKCancel, MessageBoxIcon.Error);
         }
     }
 }