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.simpleLabelItemTitle.Text = String.Format(confirmation.simpleLabelItemTitle.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.simpleLabelItemTitle.Text = String.Format(confirmation.simpleLabelItemTitle.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.simpleLabelItemTitle.Text = String.Format(confirmation.simpleLabelItemTitle.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.simpleLabelItemTitle.Text = String.Format(confirmation.simpleLabelItemTitle.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.simpleLabelItemTitle.Text = String.Format(confirmation.simpleLabelItemTitle.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);
            }
        }
		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);
			}
		}
		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
								});
					}
				}
			}
		}
Esempio n. 5
0
		private IEnumerable<DXMenuItem> GetColumnContextMenuItems(ColumnView targetView, GridColumn targetColumn)
		{
			var items = new List<DXMenuItem>();
			if (_spotColumns.Any(sc => sc.Visible && sc == targetColumn))
			{
				items.Add(new DXMenuItem("Create Weekly Snapshot", (o, args) =>
				{
					targetView.CloseEditor();
					using (var form = new FormSnapshotFromSection())
					{
						form.SnapshotName = _sectionContainer.SectionData.Name;
						if (form.ShowDialog(Controller.Instance.FormMain) == DialogResult.OK)
						{
							var newSnapshot = _sectionContainer.SectionData.CopyScheduleToSnapshot(
								form.SnapshotName,
								(DateTime)((object[])targetColumn.Tag)[3],
								form.CopySpots);
							_sectionContainer.RaiseDataChanged(new SectionDataChangedEventArgs { SnapshotsChanged = true });
							using (var confirmation = new FormCopyContentConfirmation())
							{
								confirmation.Text = "Create Snapshot";
								confirmation.labelControlTitle.Text = String.Format(confirmation.labelControlTitle.Text, "Snapshot successfully added");
								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.Schedule
										});
							}
						}
					}
				}));
			}
			return items;
		}