private void RenameOptionSet(OptionSetEditorsContainer optionSetEditorsContainer)
 {
     if (optionSetEditorsContainer == null)
     {
         return;
     }
     using (var form = new FormOptionSetName())
     {
         form.OptionSetName = optionSetEditorsContainer.OptionSetData.Name;
         if (form.ShowDialog(Controller.Instance.FormMain) != DialogResult.OK)
         {
             return;
         }
         optionSetEditorsContainer.OptionSetData.Name = form.OptionSetName;
         optionSetEditorsContainer.Text = form.OptionSetName;
         settingsContainer.UpdateSettingsAccordingDataChanges(OptionEditorType.Schedule);
         SettingsNotSaved = true;
     }
 }
 private void AddOptionSet()
 {
     using (var form = new FormOptionSetName())
     {
         if (form.ShowDialog(Controller.Instance.FormMain) != DialogResult.OK)
         {
             return;
         }
         var optionSet = new OptionSet(EditedContent);
         optionSet.Name = form.OptionSetName;
         EditedContent.Options.Add(optionSet);
         EditedContent.RebuildOptionSetIndexes();
         var optionControl = AddOptionSetEditorsContainerControl(optionSet);
         xtraTabControlContentEditors.SelectedTabPage = optionControl;
         Summary.UpdateView();
         UpdateSplash();
         SettingsNotSaved = true;
     }
 }
 private void CloneOptionSet(OptionSetEditorsContainer optionControl)
 {
     using (var form = new FormOptionSetName())
     {
         form.OptionSetName = String.Format("{0} (Clone)", optionControl.OptionSetData.Name);
         if (form.ShowDialog(Controller.Instance.FormMain) != DialogResult.OK)
         {
             return;
         }
         var optionSet = optionControl.OptionSetData.Clone <OptionSet, OptionSet>();
         optionSet.Name   = form.OptionSetName;
         optionSet.Index += 0.5;
         EditedContent.Options.Add(optionSet);
         EditedContent.RebuildOptionSetIndexes();
         var newControl = AddOptionSetEditorsContainerControl(optionSet, (Int32)optionSet.Index);
         xtraTabControlContentEditors.SelectedTabPage = newControl;
         Summary.UpdateView();
         SettingsNotSaved = true;
     }
 }
		private void OnScheduleConvertToOptionsSetClick(object sender, EventArgs e)
		{
			using (var form = new FormOptionSetName())
			{
				form.OptionSetName = SectionData.Name;
				if (form.ShowDialog(Controller.Instance.FormMain) == DialogResult.OK)
				{
					var newOptionSet = SectionData.CopyScheduleToOptionsSet(form.OptionSetName);
					RaiseDataChanged(new SectionDataChangedEventArgs { OptionsSetsChanged = true });
					using (var confirmation = new FormCopyContentConfirmation())
					{
						confirmation.Text = "Create Flex-Grid";
						confirmation.labelControlTitle.Text = String.Format(confirmation.labelControlTitle.Text, "Flex-Grid successfully added");
						confirmation.buttonXOK.Text = String.Format("Go to {0}", Controller.Instance.TabOptions.Text);
						if (confirmation.ShowDialog(Controller.Instance.FormMain) == DialogResult.OK)
							ContentRibbonManager<MediaScheduleChangeInfo>.ShowRibbonTab(
								ContentIdentifiers.Options,
								new OptionsSetOpenEventArgs
								{
									OptionsSetId = newOptionSet.UniqueID,
									EditorType = OptionEditorType.Schedule
								});
					}
				}
			}
		}
		private void OnTabControlMouseDown(object sender, MouseEventArgs e)
		{
			if (e.Button != MouseButtons.Right) return;
			var menuHitInfo = xtraTabControl.CalcHitInfo(new Point(e.X, e.Y));
			if (menuHitInfo.HitTest != XtraTabHitTest.PageHeader) return;
			if (menuHitInfo.Page == _sectionControl && SectionData.Programs.Any())
				contextMenuStripSchedule.Show((Control)sender, e.Location);
			else if (menuHitInfo.Page == _digitalInfoControl && SectionData.DigitalInfo.Records.Any())
			{
				toolStripMenuItemDigitalToSnapshot.DropDownItems.Clear();
				toolStripMenuItemDigitalToSnapshot.DropDownItems.Add(new ToolStripMenuItem(
					"Create New...",
					null,
					(s, args) =>
					{
						_digitalInfoControl.SaveData();
						using (var form = new FormSnapshotName())
						{
							form.SnapshotName = SectionData.Name;
							if (form.ShowDialog(Controller.Instance.FormMain) == DialogResult.OK)
							{
								var newSnapshot = SectionData.CopyDigitalToSnapshot(form.SnapshotName);
								RaiseDataChanged(new SectionDataChangedEventArgs { SnapshotsChanged = true });
								using (var confirmation = new FormCopyContentConfirmation())
								{
									confirmation.Text = "Send to Snapshot";
									confirmation.labelControlTitle.Text = String.Format(confirmation.labelControlTitle.Text, "Digital successfully copied");
									confirmation.buttonXOK.Text = String.Format("Go to {0}", Controller.Instance.TabSnapshot.Text);
									if (confirmation.ShowDialog(Controller.Instance.FormMain) == DialogResult.OK)
										ContentRibbonManager<MediaScheduleChangeInfo>.ShowRibbonTab(
											ContentIdentifiers.Snapshots,
											new SnapshotOpenEventArgs
											{
												SnapshotId = newSnapshot.UniqueID,
												EditorType = SnapshotEditorType.DigitalInfo
											});
								}
							}
						}
					}));
				foreach (var snapshot in SectionData.ParentSchedule.SnapshotContent.Snapshots)
				{
					toolStripMenuItemDigitalToSnapshot.DropDownItems.Add(new ToolStripMenuItem(
					snapshot.Name.Replace("&", "&&"),
					null,
					(s, args) =>
					{
						_digitalInfoControl.SaveData();
						SectionData.CopyDigitalToSnapshot(snapshot);
						RaiseDataChanged(new SectionDataChangedEventArgs { SnapshotsChanged = true });
						using (var confirmation = new FormCopyContentConfirmation())
						{
							confirmation.Text = "Send to Snapshot";
							confirmation.labelControlTitle.Text = String.Format(confirmation.labelControlTitle.Text, "Digital successfully copied");
							confirmation.buttonXOK.Text = String.Format("Go to {0}", Controller.Instance.TabSnapshot.Text);
							if (confirmation.ShowDialog(Controller.Instance.FormMain) == DialogResult.OK)
								ContentRibbonManager<MediaScheduleChangeInfo>.ShowRibbonTab(
									ContentIdentifiers.Snapshots,
									new SnapshotOpenEventArgs
									{
										SnapshotId = snapshot.UniqueID,
										EditorType = SnapshotEditorType.DigitalInfo
									});
						}
					}));
				}

				toolStripMenuItemDigitalToOptions.DropDownItems.Clear();
				toolStripMenuItemDigitalToOptions.DropDownItems.Add(new ToolStripMenuItem(
					"Create New...",
					null,
					(s, args) =>
					{
						_digitalInfoControl.SaveData();
						using (var form = new FormOptionSetName())
						{
							form.OptionSetName = SectionData.Name;
							if (form.ShowDialog(Controller.Instance.FormMain) == DialogResult.OK)
							{
								var newOptionsSet = SectionData.CopyDigitalToOptionsSet(form.OptionSetName);
								RaiseDataChanged(new SectionDataChangedEventArgs { OptionsSetsChanged = true });
								using (var confirmation = new FormCopyContentConfirmation())
								{
									confirmation.Text = "Send to Flex-Grid";
									confirmation.labelControlTitle.Text = String.Format(confirmation.labelControlTitle.Text, "Digital successfully copied");
									confirmation.buttonXOK.Text = String.Format("Go to {0}", Controller.Instance.TabOptions.Text);
									if (confirmation.ShowDialog(Controller.Instance.FormMain) == DialogResult.OK)
										ContentRibbonManager<MediaScheduleChangeInfo>.ShowRibbonTab(
											ContentIdentifiers.Options,
											new OptionsSetOpenEventArgs
											{
												OptionsSetId = newOptionsSet.UniqueID,
												EditorType = OptionEditorType.DigitalInfo
											});
								}
							}
						}
					}));
				foreach (var optionSet in SectionData.ParentSchedule.OptionsContent.Options)
				{
					toolStripMenuItemDigitalToOptions.DropDownItems.Add(new ToolStripMenuItem(
					optionSet.Name.Replace("&", "&&"),
					null,
					(s, args) =>
					{
						_digitalInfoControl.SaveData();
						SectionData.CopyDigitalToOptionsSet(optionSet);
						RaiseDataChanged(new SectionDataChangedEventArgs { OptionsSetsChanged = true });
						using (var confirmation = new FormCopyContentConfirmation())
						{
							confirmation.Text = "Send to Flex-Grid";
							confirmation.labelControlTitle.Text = String.Format(confirmation.labelControlTitle.Text, "Digital successfully copied");
							confirmation.buttonXOK.Text = String.Format("Go to {0}", Controller.Instance.TabOptions.Text);
							if (confirmation.ShowDialog(Controller.Instance.FormMain) == DialogResult.OK)
								ContentRibbonManager<MediaScheduleChangeInfo>.ShowRibbonTab(
									ContentIdentifiers.Options,
									new OptionsSetOpenEventArgs
									{
										OptionsSetId = optionSet.UniqueID,
										EditorType = OptionEditorType.DigitalInfo
									});
						}
					}));
				}

				contextMenuStripDigital.Show((Control)sender, e.Location);
			}
		}