private void RenameSnapshotSet(SnapshotEditorsContainer snapshotEditorsContainer)
 {
     if (snapshotEditorsContainer == null)
     {
         return;
     }
     using (var form = new FormSnapshotName())
     {
         form.SnapshotName = snapshotEditorsContainer.SnapshotData.Name;
         if (form.ShowDialog(Controller.Instance.FormMain) != DialogResult.OK)
         {
             return;
         }
         snapshotEditorsContainer.SnapshotData.Name = form.SnapshotName;
         snapshotEditorsContainer.Text = form.SnapshotName;
         settingsContainer.UpdateSettingsAccordingDataChanges(SnapshotEditorType.Schedule);
         SettingsNotSaved = true;
     }
 }
 private void AddSnapshotSet()
 {
     using (var form = new FormSnapshotName())
     {
         if (form.ShowDialog(Controller.Instance.FormMain) != DialogResult.OK)
         {
             return;
         }
         var snapshot = new Snapshot(EditedContent);
         snapshot.Name = form.SnapshotName;
         EditedContent.Snapshots.Add(snapshot);
         EditedContent.RebuildSnapshotIndexes();
         var snapshotEditorsContainer = AddSnapshotSetEditorsContainerControl(snapshot);
         xtraTabControlContentEditors.SelectedTabPage = snapshotEditorsContainer;
         Summary.UpdateView();
         UpdateSplash();
         SettingsNotSaved = true;
     }
 }
 private void CloneSnapshotSet(SnapshotEditorsContainer snapshotEditorsContainer)
 {
     using (var form = new FormSnapshotName())
     {
         form.SnapshotName = String.Format("{0} (Clone)", snapshotEditorsContainer.SnapshotData.Name);
         if (form.ShowDialog(Controller.Instance.FormMain) != DialogResult.OK)
         {
             return;
         }
         var snapshot = snapshotEditorsContainer.SnapshotData.Clone <Snapshot, Snapshot>();
         snapshot.Name   = form.SnapshotName;
         snapshot.Index += 0.5;
         EditedContent.Snapshots.Add(snapshot);
         EditedContent.RebuildSnapshotIndexes();
         var newControl = AddSnapshotSetEditorsContainerControl(snapshot, (Int32)snapshot.Index);
         xtraTabControlContentEditors.SelectedTabPage = newControl;
         Summary.UpdateView();
         SettingsNotSaved = true;
     }
 }
		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);
			}
		}