Пример #1
0
        public override IEnumerable <ComponentViewBase> LoadDiagram(Diagram diagram)
        {
            IEnumerable <ComponentViewBase> withoutViewHelpers = base.LoadDiagram(diagram);

            foreach (ComponentViewBase withoutViewHelper in withoutViewHelpers)
            {
                if (withoutViewHelper is PIMClassView)
                {
                    ((PIMClassView)withoutViewHelper).ViewHelper.X = RandomGenerator.Next(300);
                    ((PIMClassView)withoutViewHelper).ViewHelper.Y = RandomGenerator.Next(300);
                }
            }
            ExolutioContextMenu diagramMenu = MenuHelper.GetContextMenu(ScopeAttribute.EScope.PIMDiagram, this.Diagram);

            ExolutioCanvas.ContextMenu = diagramMenu;

            ((ExolutioContextMenu)ExolutioCanvas.ContextMenu).ScopeObject = PIMDiagram;
            ((ExolutioContextMenu)ExolutioCanvas.ContextMenu).Diagram     = PIMDiagram;

#if SILVERLIGHT
            ContextMenuService.SetContextMenu(ExolutioCanvas, diagramMenu);
            MenuHelper.CreateSubmenuForCommandsWithoutScope(diagramMenu);
#else
            ContextMenuItem otherItemsMenu = new ContextMenuItem("Other operations");
            MenuHelper.CreateSubmenuForCommandsWithoutScope(otherItemsMenu);
            ExolutioCanvas.ContextMenu.Items.Add(otherItemsMenu);
#endif

            return(withoutViewHelpers);
        }
        //private void ApplySecurity()
        //{
        //    var permissions = AgentUICoreMediator.GetAgentUICoreMediator.tableDrivedEntityManagerService.GetEntityAssignedPermissions(AgentUICoreMediator.GetAgentUICoreMediator.GetRequester(), EntitySelectArea.SelectedEntity.ID, false);
        //    if (!permissions.GrantedActions.Any(x => x == SecurityAction.LetterEdit))
        //    {
        //        LetterView.EnableAdd = false;
        //        LetterView.EnableDelete = false;
        //        LetterView.EnableEdit = false;
        //    }
        //    else
        //    {
        //        LetterView.EnableAdd = true;
        //        LetterView.EnableDelete = true;
        //        LetterView.EnableEdit = true;
        //    }
        //}


        private void LetterView_ContextMenuLoaded(object sender, MyUILibraryInterfaces.ContextMenu.ContextMenuArg e)
        {
            var letter = e.ContextObject as LetterDTO;

            if (letter != null)
            {
                List <ContextMenuItem> menus = new List <ContextMenuItem>();
                var permissions = AgentUICoreMediator.GetAgentUICoreMediator.tableDrivedEntityManagerService.GetEntityAssignedPermissions(AgentUICoreMediator.GetAgentUICoreMediator.GetRequester(), letter.DataItem.TargetEntityID, false);
                if (permissions.GrantedActions.Any(x => x == SecurityAction.LetterEdit))
                {
                    ContextMenuItem editMenu = new ContextMenuItem()
                    {
                        Title = "اصلاح نامه"
                    };
                    editMenu.Clicked += (sender1, e1) => EditMenu_Clicked(sender1, e1, letter);
                    menus.Add(editMenu);

                    ContextMenuItem deleteMenu = new ContextMenuItem()
                    {
                        Title = "حذف نامه"
                    };
                    deleteMenu.Clicked += (sender1, e1) => DeleteMenu_Clicked1(sender1, e1, letter);
                    menus.Add(deleteMenu);
                }
                e.ContextMenuManager.SetMenuItems(menus);
            }
        }
Пример #3
0
    public void CreateContextMenu(List <ContextMenuItem> items, Vector2 position)
    {
        // here we are creating and displaying Context Menu

        Image panel = Instantiate(contentPanel, new Vector3(position.x, position.y, 0), Quaternion.identity) as Image;

        panel.tag = "ContextPanel";
        panel.transform.SetParent(canvas.transform);
        panel.transform.SetAsLastSibling();
        panel.rectTransform.anchoredPosition = position;
        EventTrigger panelTrigger = panel.GetComponent <EventTrigger>();

        EventTrigger.Entry newEntry = new EventTrigger.Entry();
        newEntry.eventID = EventTriggerType.PointerExit;
        newEntry.callback.AddListener((data) => { DestroyContextMenu(); });
        panelTrigger.triggers.Add(newEntry);

        foreach (var item in items)
        {
            ContextMenuItem tempReference = item;
            Button          button        = Instantiate(item.button) as Button;
            Text            buttonText    = button.GetComponentInChildren <Text>();
            Image           buttonImage   = button.GetComponentInChildren <Image>();
            buttonText.text    = item.name;
            buttonImage.sprite = item.sprite;
            button.onClick.AddListener(delegate { tempReference.action(panel); });
            button.transform.SetParent(panel.transform);
        }
        GameState.Instance.popupOpen = true;
    }
        private void InitializeWidgetMenuBars()
        {
            if (AppConfig == null)
            {
                return;
            }

            WidgetMenuButton.Style = (this.CurrentApp.Resources.Contains("DropMenuButtonStyle")) ? (this.CurrentApp.Resources["DropMenuButtonStyle"] as Style) : (this.CurrentApp.Resources["defaultDropMenuButtonStyle"] as Style);

            foreach (WidgetConfig widget in AppConfig.WidgetsConfig)
            {
                ImageSource     iconSource = new BitmapImage(new Uri(widget.IconSource, UriKind.Relative));
                ContextMenuItem menuItem   = new ContextMenuItem()
                {
                    Text = widget.Title, IconSource = iconSource, UseSmallIcon = true, Margin = new Thickness(1)
                };
                menuItem.Background = new SolidColorBrush(Colors.Transparent);
                WidgetMenuButton.MenuItems.Add(menuItem);

                HyperlinkButton linkButton = new HyperlinkButton()
                {
                    Width = 40, Height = 40, Tag = widget.Title, Margin = new Thickness(1)
                };
                linkButton.Background = new ImageBrush()
                {
                    ImageSource = iconSource, Stretch = Stretch.None
                };
                linkButton.Click += new RoutedEventHandler(WidgetLinkButton_Click);
                ToolTipService.SetToolTip(linkButton, widget.Title);
                DockWidgetsStack.Children.Add(linkButton);
            }
        }
    protected void Page_Load(object sender, EventArgs e)
    {
        // Add "Section properties" menu item to context menu
        ContextMenuItem menuItem = new ContextMenuItem()
        {
            ID = "iSectionProperties", ResourceString = "general.edit"
        };

        menuItem.Attributes.Add("onclick", "SectionProperties(GetContextMenuParameter('nodeMenu'));");
        menuItem.AddCssClass("sectionPropertiesMenuItem");
        menuElem.AdditionalMenuItems.Controls.Add(menuItem);

        const string SCRIPT = @"// Section properties
function SectionProperties(nodeId) {
    if (!CheckChanges()) {
        return false;
    }
    if (!nodeId) {
        nodeId = GetSelectedNodeId();
    }
    if (nodeId != 0) {
        window.PerformContentRedirect('sectionEdit', '', nodeId, '');
        return true;
    }
    return false;
}";

        ScriptHelper.RegisterClientScriptBlock(Page, typeof(string), "SectionPropertiesFunction", ScriptHelper.GetScript(SCRIPT));
    }
Пример #6
0
        protected virtual CustomContextMenu CreateContextMenu()
        {
            CustomContextMenu menu = new CustomContextMenu();

            m_ItemCut            = new ContextMenuItem(Localization.ContextCmd_Cut);
            m_ItemCut.Icon       = UriResources.Images.Cut16;
            m_ItemCut.ItemClick += new EventHandler(itemCut_ItemClick);
            menu.AddMenuItem(m_ItemCut);
            m_ItemCopy            = new ContextMenuItem(Localization.ContextCmd_Copy);
            m_ItemCopy.Icon       = UriResources.Images.Copy16;
            m_ItemCopy.ItemClick += new EventHandler(itemCopy_ItemClick);
            menu.AddMenuItem(m_ItemCopy);
            m_ItemPaste            = new ContextMenuItem(Localization.ContextCmd_Paste);
            m_ItemPaste.Icon       = UriResources.Images.Paste16;
            m_ItemPaste.ItemClick += new EventHandler(itemPaste_ItemClick);
            menu.AddMenuItem(m_ItemPaste);
            m_ItemDelete            = new ContextMenuItem(Localization.ContextCmd_Delete);
            m_ItemDelete.Icon       = UriResources.Images.Delete16;
            m_ItemDelete.ItemClick += new EventHandler(itemDelete_ItemClick);
            menu.AddMenuItem(m_ItemDelete);
            menu.AddMenuSplitter();
            ContextMenuItem item = new ContextMenuItem(Localization.ContextCmd_SelectAll);

            item.ItemClick += new EventHandler(itemSelectAll_ItemClick);
            menu.AddMenuItem(item);

            return(menu);
        }
Пример #7
0
 /// <summary>
 /// If the selected file can be compressed to a data uri, this will place it on the clipboard
 /// </summary>
 /// <param name="e"></param>
 protected void AddCopyDataURIMenu(ContextMenuOpeningEventArgs e)
 {
     if (e.Items.Count == 1)
     {
         var item = e.Items.First();
         if (item is ISiteFile)
         {
             var path = (item as ISiteFile).Path;
             if (OrangeCompiler.CanGetDataURI(path))
             {
                 var menuItem = new ContextMenuItem("Copy Data URI", null, new DelegateCommand((filePath) =>
                 {
                     var scheduler = TaskScheduler.FromCurrentSynchronizationContext();
                     Task.Factory.StartNew(() =>
                     {
                         var data = "data:image/" +
                                    Path.GetExtension(filePath as string).Replace(".", "") +
                                    ";base64," +
                                    Convert.ToBase64String(File.ReadAllBytes(filePath as string));
                         return(data);
                     }).ContinueWith((x) =>
                     {
                         Clipboard.SetText(x.Result);
                     }, scheduler);
                 }), path);
                 e.AddMenuItem(menuItem);
             }
         }
     }
 }
        static void OnTreeViewButtonPress(object o, Gtk.ButtonPressEventArgs args)
        {
            args.RetVal = false;
            if (args.Event.Type != Gdk.EventType.ButtonPress || args.Event.Button != 3)
            {
                return;
            }

            var treeView  = (Gtk.TreeView)o;
            var selection = treeView.Selection;

            Gtk.TreePath path;
            if (treeView.GetPathAtPos((int)args.Event.X, (int)args.Event.Y, out path))
            {
                selection.SelectPath(path);
            }
            else
            {
                return;
            }

            args.RetVal = true;
            var menu = new ContextMenu();
            var mi   = new ContextMenuItem("Remove Row");

            mi.Context  = selection;
            mi.Clicked += OnPopupMenuActivated;
            menu.Add(mi);

            // FIXME: Coordinates
            menu.Show(treeView, (int)args.Event.X, (int)args.Event.Y);
        }
Пример #9
0
        private static IEnumerable <ContextMenuItem> ContextMenuControlCallback(IEnumerable <string> paths)
        {
            Console.WriteLine("Investigating {0}", string.Join(" ,", paths.ToArray()));

            List <ContextMenuItem> contextMenuItems = new List <ContextMenuItem> ();

            //if (paths.All (p => p == "/Users/sync/foo.txt"))
            //{
            var contextMenuItem = new ContextMenuItem("Nativity Test: " + started);

            contextMenuItem.Selected += MainClass.ContextMenuItem_HandleSelected;

            contextMenuItems.Add(contextMenuItem);

            contextMenuItem.AddSeparator();

            for (var ctr = 0; ctr < 3; ctr++)
            {
                var sub = new ContextMenuItem(string.Empty);
                sub.Selected += (s, p) => Console.WriteLine(sub.Uuid);
                sub.Title     = sub.Uuid.ToString();
                contextMenuItem.ContextMenuItems.Add(sub);
            }
            //}

            return(contextMenuItems);
        }
Пример #10
0
        void ShowPopup(Gdk.EventButton evt)
        {
            var menu = new ContextMenu();

            var help = new ContextMenuItem(GettextCatalog.GetString("Go to _Reference"));

            help.Clicked += OnShowReference;
            menu.Add(help);

            if (BuildOutput.IsFeatureEnabled)
            {
                var goBuild = new ContextMenuItem(GettextCatalog.GetString("Go to _Log"));
                goBuild.Clicked += async(s, e) => await OnGoToLog(s, e);

                menu.Add(goBuild);
            }

            var jump = new ContextMenuItem(GettextCatalog.GetString("_Go to Task"));

            jump.Clicked += OnTaskJumpto;
            menu.Add(jump);

            var columnsMenu = new ColumnSelectorMenu(view,
                                                     restoreID,
                                                     GettextCatalog.GetString("Type"),
                                                     GettextCatalog.GetString("Validity"));

            menu.Add(new SeparatorContextMenuItem());

            var copy = new ContextMenuItem(GettextCatalog.GetString("_Copy"));

            copy.Clicked += OnTaskCopied;
            menu.Add(copy);


            menu.Add(new SeparatorContextMenuItem());

            var columns = new ContextMenuItem(GettextCatalog.GetString("Columns"));

            columns.SubMenu = columnsMenu;
            menu.Add(columns);

            help.Sensitive = copy.Sensitive = jump.Sensitive =
                view.Selection != null &&
                view.Selection.CountSelectedRows() > 0 &&
                view.IsAColumnVisible();

            // Disable Help and Go To if multiple rows selected.
            if (help.Sensitive && view.Selection.CountSelectedRows() > 1)
            {
                help.Sensitive = false;
                jump.Sensitive = false;
            }

            string dummyString;

            help.Sensitive &= GetSelectedErrorReference(out dummyString);

            menu.Show(view, evt);
        }
        protected virtual CustomContextMenu CreateContextMenu()
        {
            CustomContextMenu contextMenu = new CustomContextMenu();
            ContextMenuItem   item;

            m_MoveUp_MenuItem      = new ContextMenuItem(Localization.MdxDesigner_ContextMenu_MoveUp);
            m_MoveUp_MenuItem.Icon = UriResources.Images.Up16;
            contextMenu.AddMenuItem(m_MoveUp_MenuItem);
            m_MoveUp_MenuItem.ItemClick += new EventHandler(MoveUp_ItemClick);

            m_MoveDown_MenuItem      = new ContextMenuItem(Localization.MdxDesigner_ContextMenu_MoveDown);
            m_MoveDown_MenuItem.Icon = UriResources.Images.Down16;
            contextMenu.AddMenuItem(m_MoveDown_MenuItem);
            m_MoveDown_MenuItem.ItemClick += new EventHandler(MoveDown_ItemClick);

            //contextMenu.AddMenuSplitter();

            item      = new ContextMenuItem(Localization.MdxDesigner_ContextMenu_RemoveField);
            item.Icon = UriResources.Images.RemoveHot16;
            contextMenu.AddMenuItem(item);
            item.ItemClick += new EventHandler(Remove_ItemClick);

            // Используем открытие и закрытие меню для работы с тултипом
            contextMenu.PopupControl.Closed -= new EventHandler(PopupControl_Closed);
            contextMenu.PopupControl.Closed += new EventHandler(PopupControl_Closed);
            contextMenu.PopupControl.Opened -= new EventHandler(PopupControl_Opened);
            contextMenu.PopupControl.Opened += new EventHandler(PopupControl_Opened);
            return(contextMenu);
        }
Пример #12
0
 public override void OnMenuItemClicked(ContextMenuItem menuItem)
 {
     if (menuItem.id == 1)
     {
         //Shuffle
         if (cardsHolderTransform.childCount > 1)
         {
             string warningString = "Are you sure you want to shuffle cards on " + LogEntry.ZoneLogEntryPart(this) + "?";
             string voteString    = "Allow " + LogEntry.PlayerLogEntryPart(Player.LocalPlayer) + " to shuffle cards on " + LogEntry.ZoneLogEntryPart(this) + "?";
             ShufflePermission.Check(Player.LocalPlayer, ownerNetId,
                                     () =>
             {
                 CommandProcessor.Instance.ExecuteClientCommand(new CommandShuffleDeck(Player.LocalPlayer, this));
             }, null, warningString, voteString);
         }
     }
     else if (menuItem.id == 2)
     {
         //Deal
         string warningString = "Are you sure you want to deal cards from " + LogEntry.ZoneLogEntryPart(this) + "?";
         string voteString    = "Allow " + LogEntry.PlayerLogEntryPart(Player.LocalPlayer) + " to deal cards from " + LogEntry.ZoneLogEntryPart(this) + "?";
         ShufflePermission.Check(Player.LocalPlayer, ownerNetId, OnDealMenuClicked, null, warningString, voteString);
     }
     else
     {
         base.OnMenuItemClicked(menuItem);
     }
 }
Пример #13
0
        /// <summary>
        /// Inserts the selected variable at the current cursor position.
        /// </summary>
        private void OnVariableSelected(ContextMenuItem menuItem)
        {
            int selStart = SelectionStart;

            Text           = Text.Insert(selStart, menuItem.Text);
            SelectionStart = selStart + menuItem.Text.Length;
        }
Пример #14
0
        /// <summary>
        /// Adds all context menu items based on the given variable names.
        /// </summary>
        private void RebuildContextMenu()
        {
            if (m_Customiser == null)
            {
                return;
            }

            m_Customiser.MenuItems.Clear();

            // No options for read only text boxes
            if (ReadOnly)
            {
                return;
            }

            if (m_VariableNames.Length > 0)
            {
                List <string> vars = new List <string>(m_VariableNames);
                vars.Sort();
                // We insert in reverse order
                vars.Reverse();

                // Add final separator
                m_Customiser.MenuItems.Add(new ContextMenuItem(string.Empty, 0));

                foreach (string var in vars)
                {
                    ContextMenuItem newItem = new ContextMenuItem("{" + var + "}", 0)
                    {
                        EventHandler = this.OnVariableSelected
                    };
                    m_Customiser.MenuItems.Add(newItem);
                }
            }

            // Add context menu item for multiline editor
            if (Multiline && m_EnableEditor)
            {
                // Add final separator
                m_Customiser.MenuItems.Add(new ContextMenuItem(string.Empty, 0));

                ContextMenuItem newItem = new ContextMenuItem("Editor...", 0)
                {
                    EventHandler = delegate
                    {
                        using (MultilineEditorDialog dialog = new MultilineEditorDialog())
                        {
                            dialog.Value = this.Text;
                            dialog.SetVariableNames(m_VariableNames);

                            if (dialog.ShowDialog(this) == DialogResult.OK)
                            {
                                this.Text = dialog.Value;
                            }
                        }
                    }
                };
                m_Customiser.MenuItems.Add(newItem);
            }
        }
Пример #15
0
        void ShowPopupMenu(Gdk.EventButton evnt)
        {
            var menu = new ContextMenu();

            columnsActions = new Dictionary <ContextMenuItem, int> ();

            var copy = new ContextMenuItem(GettextCatalog.GetString("Copy Task"));

            copy.Clicked += OnGenTaskCopied;
            menu.Add(copy);

            var jump = new ContextMenuItem(GettextCatalog.GetString("_Go to Task"));

            jump.Clicked += OnGenTaskJumpto;
            menu.Add(jump);

            var delete = new ContextMenuItem(GettextCatalog.GetString("_Delete Task"));

            delete.Clicked += OnGenTaskDelete;
            menu.Add(delete);

            var columns     = new ContextMenuItem(GettextCatalog.GetString("Columns"));
            var columnsMenu = new ColumnSelectorMenu(view, restoreID);

            columns.SubMenu = columnsMenu;
            menu.Add(columns);

            copy.Sensitive = jump.Sensitive = delete.Sensitive =
                view.Selection != null &&
                view.Selection.CountSelectedRows() > 0 &&
                view.IsAColumnVisible();

            menu.Show(view, evnt);
        }
Пример #16
0
        void ShowPopup(Gdk.EventButton evt)
        {
            TreeIter selected;

            if (!tree.Selection.GetSelected(out selected))
            {
                return;
            }
            var process = store.GetValue(selected, (int)Columns.Object) as ProcessInfo;

            if (process == null)
            {
                return;                //User right-clicked on thread and not process
            }
            var session           = store.GetValue(selected, (int)Columns.Session) as DebuggerSession;
            var context_menu      = new ContextMenu();
            var continueExecution = new ContextMenuItem(GettextCatalog.GetString("Resume"));

            continueExecution.Sensitive = !session.IsRunning;
            continueExecution.Clicked  += delegate {
                session.Continue();
            };
            context_menu.Items.Add(continueExecution);
            var pauseExecution = new ContextMenuItem(GettextCatalog.GetString("Pause"));

            pauseExecution.Sensitive = session.IsRunning;
            pauseExecution.Clicked  += delegate {
                session.Stop();
            };
            context_menu.Items.Add(pauseExecution);
            context_menu.Show(this, evt);
        }
        ContextMenu CreateContextMenu(FixMenuDescriptor entrySet)
        {
            var menu = new ContextMenu();

            foreach (var item in entrySet.Items)
            {
                if (item == FixMenuEntry.Separator)
                {
                    menu.Items.Add(new SeparatorContextMenuItem());
                    continue;
                }

                var menuItem = new ContextMenuItem(item.Label);
                menuItem.Context = item.Action;
                var subMenu = item as FixMenuDescriptor;
                if (subMenu != null)
                {
                    menuItem.SubMenu = CreateContextMenu(subMenu);
                }
                else
                {
                    menuItem.Clicked += (object sender, ContextMenuItemClickedEventArgs e) => ((System.Action)((ContextMenuItem)sender).Context)();
                }
                menu.Items.Add(menuItem);
            }

            return(menu);
        }
Пример #18
0
        public static ExolutioContextMenu GetContextMenu(ScopeAttribute.EScope scope, Diagram diagram)
        {
            ExolutioContextMenu result = new ExolutioContextMenu();

            result.Opened += ContextMenu_Opened;

            foreach (CommandDescriptor commandDescriptor in PublicCommandsHelper.publicCommandsByScope[scope])
            {
                ContextMenuItem m = CreateMenuItem(commandDescriptor);
                result.Items.Add(m);
            }

            if (localCommandsByScope.ContainsKey(scope))
            {
                result.Items.Add(new Separator());
                foreach (guiScopeCommand guiScopeCommand in localCommandsByScope[scope])
                {
                    ContextMenuItem contextMenuItem = new ContextMenuItem(guiScopeCommand.Text);
                    contextMenuItem.Icon    = guiScopeCommand.Icon;
                    contextMenuItem.Command = guiScopeCommand;
                    #if SILVERLIGHT
                    #else
                    contextMenuItem.ToolTip = guiScopeCommand.ScreenTipText;
                    #endif
                    result.Items.Add(contextMenuItem);
                }
            }
            return(result);
        }
Пример #19
0
        private ObservableCollection <ContextMenuItem> BuildMenu(List <DeviceBindingNode> deviceBindingNodes)
        {
            var menuList = new ObservableCollection <ContextMenuItem>();

            if (deviceBindingNodes == null)
            {
                return(menuList);
            }
            foreach (var deviceBindingNode in deviceBindingNodes)
            {
                RelayCommand cmd = null;
                if (deviceBindingNode.IsBinding)
                {
                    if (Category != null && deviceBindingNode.DeviceBinding.DeviceBindingCategory != Category)
                    {
                        continue;
                    }
                    cmd = new RelayCommand(c =>
                    {
                        DeviceBinding.SetDeviceGuid(GetSelectedDevice().Guid);
                        DeviceBinding.SetKeyTypeValue(deviceBindingNode.DeviceBinding.KeyType, deviceBindingNode.DeviceBinding.KeyValue, deviceBindingNode.DeviceBinding.KeySubValue);
                    });
                }
                var menu = new ContextMenuItem(deviceBindingNode.Title, BuildMenu(deviceBindingNode.ChildrenNodes), cmd);
                if (deviceBindingNode.IsBinding || !deviceBindingNode.IsBinding && menu.Children.Count > 0)
                {
                    menuList.Add(menu);
                }
            }
            return(menuList);
        }
Пример #20
0
        /// <summary>
        /// 删除二级菜单项
        /// </summary>
        /// <param name="item">要删除的菜单项</param>
        public static void DelSecondReg(ContextMenuItem item)
        {
            RegistryKey key = Registry.ClassesRoot.OpenSubKey(@"DesktopBackground\Shell\SchoolNet\shell", true);

            key.DeleteSubKeyTree(item.ToString());
            key.Close();
        }
Пример #21
0
 public override void OnMenuItemClicked(ContextMenuItem menuItem)
 {
     if (menuItem.id == 4)
     {
         DeckEditor cloned = Instantiate(this);
         copyProperties(cloned);
         cloned.transform.position = new Vector3(0, 0, 0f);
         clonedDecks.Add(cloned);
     }
     if (menuItem.id == 1)
     {
         //Zone settings
         DeckPermissionSettings.Show(this);
     }
     else if (menuItem.id == 2)
     {
         //Card settings
         DeckSettings.Show(this);
     }
     else
     {
         //Remove
         base.OnMenuItemClicked(menuItem);
     };
 }
Пример #22
0
        /// <summary>
        /// add an option to open a console here if it's a directory
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void host_ContextMenuOpening(object sender, ContextMenuOpeningEventArgs e)
        {
            // we only show the context menu if every item selected in the tree is valid to be compiled
            IList <string> paths           = new List <string>();
            var            showContextMenu = e.Items.Count > 0;

            foreach (ISiteItem item in e.Items)
            {
                if (item == null || !(item is ISiteFolder))
                {
                    showContextMenu = false;
                    break;
                }
                else
                {
                    paths.Add((item as ISiteFolder).Path);
                }
            }

            // if all of the files in the list are valid, show the command window option
            if (showContextMenu)
            {
                var menuItem = new ContextMenuItem("Open Command Window", null, new DelegateCommand(new Action <object>(OpenCMD)), paths);
                e.AddMenuItem(menuItem);
            }
        }
Пример #23
0
        public DiagramPage()
        {
            InitializeComponent();
            this.mainDiagram.DefaultTool = new WfToolManager();
            this.myOverview.Observed     = this.mainDiagram;
            this.WebMethod = new WebInterAction();
            this.mainDiagram.LayoutCompleted += UpdateRoutes;


            App myapp = App.Current as App;

            if (myapp.paras != null)
            {
                string enableSimulation = myapp.paras["enableSimulation"];
                bool   flag             = true;
                bool.TryParse(enableSimulation, out flag);

                if (this.processContextMenu != null)
                {
                    ContextMenuItem subMenuItem = this.processContextMenu.Items[5] as ContextMenuItem;

                    if (flag)
                    {
                        subMenuItem.Visibility = Visibility.Visible;
                    }
                    else
                    {
                        subMenuItem.Visibility = Visibility.Collapsed;
                    }
                }
            }
        }
        public ContextMenuItemBuilder Add()
        {
            ContextMenuItem item = new ContextMenuItem();

            container.Items.Add(item);

            return new ContextMenuItemBuilder(item, viewContext);
        }
Пример #25
0
 public static void CreateSubmenuForCommandsWithoutScope(ContextMenuItem otherItemsMenu)
 {
     foreach (CommandDescriptor commandDescriptor in PublicCommandsHelper.publicCommandsByScope[ScopeAttribute.EScope.None])
     {
         ContextMenuItem m = CreateMenuItem(commandDescriptor);
         otherItemsMenu.Items.Add(m);
     }
 }
Пример #26
0
    public ContextMenuItem AddItem(string label, Action action)
    {
        ContextMenuItem contextMenuItem = Instantiate(contextMenuItemPrefab, this.transform);

        contextMenuItem.Text = label;
        contextMenuItem.SetAction(action);
        return(contextMenuItem);
    }
Пример #27
0
 public virtual void OnMenuItemClicked(ContextMenuItem menuItem)
 {
     if (menuItem.id == 0)
     {
         //Remove
         Destroy(this.gameObject);
     }
 }
Пример #28
0
        public PSMDiagramView()
        {
            this.RepresentantsCollection.Registrations.Add(typeof(PSMClass), new RepresentantsCollection.RegistrationClass(
                                                               () => new PSMClassView(),
                                                               () => new PSMClassViewHelper(this.Diagram),
                                                               typeof(PSMClass),
                                                               typeof(PSMClassViewHelper),
                                                               typeof(PSMClassView)));

            this.RepresentantsCollection.Registrations.Add(typeof(PSMSchemaClass), new RepresentantsCollection.RegistrationClass(
                                                               () => new PSMSchemaClassView(),
                                                               () => new PSMSchemaClassViewHelper(this.Diagram),
                                                               typeof(PSMSchemaClass),
                                                               typeof(PSMSchemaClassViewHelper),
                                                               typeof(PSMSchemaClassView)));

            this.RepresentantsCollection.Registrations.Add(typeof(PSMContentModel), new RepresentantsCollection.RegistrationClass(
                                                               () => new PSMContentModelView(),
                                                               () => new PSMContentModelViewHelper(this.Diagram),
                                                               typeof(PSMContentModel),
                                                               typeof(PSMContentModelViewHelper),
                                                               typeof(PSMContentModelView)));

            this.RepresentantsCollection.Registrations.Add(typeof(PSMAssociation), new RepresentantsCollection.RegistrationClass(
                                                               () => new PSMAssociationView(),
                                                               () => new PSMAssociationViewHelper(this.Diagram),
                                                               typeof(PSMAssociation),
                                                               typeof(ConnectionViewHelper),
                                                               typeof(PSMAssociationView)));

            this.RepresentantsCollection.Registrations.Add(typeof(PSMGeneralization), new RepresentantsCollection.RegistrationClass(
                                                               () => new PSMGeneralizationView(),
                                                               () => new PSMGeneralizationViewHelper(this.Diagram),
                                                               typeof(PSMGeneralization),
                                                               typeof(ConnectionViewHelper),
                                                               typeof(PSMGeneralizationView)));

            LayoutManager = new LayoutManager();

            ExolutioCanvas.MouseLeftButtonUp += ExolutioCanvas_MouseLeftButtonUp;
            ExolutioCanvas.Loaded            += ExolutioCanvas_Loaded;
            ExolutioCanvas.ContentChanged    += ExolutioCanvas_ContentChanged;

            ExolutioContextMenu diagramMenu = MenuHelper.GetContextMenu(ScopeAttribute.EScope.PSMSchema, this.Diagram);

            ExolutioCanvas.ContextMenu = diagramMenu;

#if SILVERLIGHT
            ContextMenuService.SetContextMenu(ExolutioCanvas, diagramMenu);
            MenuHelper.CreateSubmenuForCommandsWithoutScope(diagramMenu);
#else
            ContextMenuItem otherItemsMenu = new ContextMenuItem("Other operations");
            MenuHelper.CreateSubmenuForCommandsWithoutScope(otherItemsMenu);
            ExolutioCanvas.ContextMenu.Items.Add(otherItemsMenu);
#endif
            ExolutioCanvas.Tag = "PSM";
        }
            NSMenuItem MakeItem(ContextMenuItem i, string title, bool isChecked)
            {
                var item = new NSMenuItem(title, (sender, e) => owner.viewEvents.OnMenuItemClicked(i, !isChecked));

                if (isChecked)
                {
                    item.State = NSCellStateValue.On;
                }
                return(item);
            }
 private void ShowResultsOnOutputWindow(ContextMenuItem _)
 {
     _ideScope.DeveroomOutputPaneServices.WriteLine($"Results for {_headerMenuItem.Header}:");
     foreach (var contextMenuItem in _contextMenuManager.GetContextMenuItems(_contextMenu).OfType <SourceLocationContextMenuItem>())
     {
         _ideScope.DeveroomOutputPaneServices.WriteLine(contextMenuItem.GetSearchResultLabel());
     }
     _isRedirectedToOutputPane = true;
     _ideScope.DeveroomOutputPaneServices.Activate();
 }
Пример #31
0
        /// <summary>
        /// Adds a submenu section to the context menu. The submenu can contain its own items, separators, and submenus.
        /// </summary>
        /// <param name="id">The unique identifier of this submenu. Becomes the id attribute of the html element.</param>
        /// <param name="name">The name to display for this submenu item.</param>
        /// <returns></returns>
        public ContextMenuItem AddSubMenu(string id, string name)
        {
            ContextMenuItem submenu = new ContextMenuItem {
                Id = id, Name = name, Type = "submenu"
            };

            items.Add(submenu);

            return(submenu);
        }
Пример #32
0
        public IContextMenuItem Convert()
        {
            ContextMenuItem item = new ContextMenuItem
            {
                Name = this.Name,
                Icon = this.IconName,
                Children = (this.Children ?? new List<MenuItemInfo>()).Select(x => x.Convert()).ToList(),
                Command = this.Command
            };

            return item;
        }
Пример #33
0
		public DockNotebook ()
		{
			pagesCol = new ReadOnlyCollection<DockNotebookTab> (pages);
			AddEvents ((Int32)(EventMask.AllEventsMask));

			tabStrip = new TabStrip (this);

			PackStart (tabStrip, false, false, 0);

			contentBox = new EventBox ();
			PackStart (contentBox, true, true, 0);

			ShowAll ();

			contentBox.NoShowAll = true;

			tabStrip.DropDownButton.Sensitive = false;

			tabStrip.DropDownButton.ContextMenuRequested = delegate {
				ContextMenu menu = new ContextMenu ();
				foreach (var tab in pages) {
					var item = new ContextMenuItem (tab.Markup ?? tab.Text);
					var locTab = tab;
					item.Clicked += (object sender, ContextMenuItemClickedEventArgs e) => {
						CurrentTab = locTab;
					};
					menu.Items.Add (item);
				}
				return menu;
			};

			Gtk.Drag.DestSet (this, Gtk.DestDefaults.Motion | Gtk.DestDefaults.Highlight | Gtk.DestDefaults.Drop, targetEntryTypes, Gdk.DragAction.Copy);
			DragDataReceived += new Gtk.DragDataReceivedHandler (OnDragDataReceived);

			DragMotion += delegate {
				// Bring this window to the front. Otherwise, the drop may end being done in another window that overlaps this one
				if (!Platform.IsWindows) {
					var window = ((Gtk.Window)Toplevel);
					if (window is DockWindow)
						window.Present ();
				}
			};

			allNotebooks.Add (this);
		}
Пример #34
0
        /// <summary>
        /// Returns the HTML to display in the VS IDE
        /// </summary>
        /// <returns>HTML string</returns>
        public override string GetDesignTimeHtml()
        {
            //System.Diagnostics.Debugger.Break();

            int numOfItems = _contextMenuInstance.ContextMenuItems.Count;

            if (numOfItems == 0)
            {
                _contextMenuInstance.ContextMenuItems.Clear();

                for(int i = 0; i < 5; i++)
                {
                    ContextMenuItem item = new ContextMenuItem("Item", "");
                    _contextMenuInstance.ContextMenuItems.Add(item);
                }
            }

            // Add the selected item
            int selectedItemPos = 1;
            ContextMenuItem selectedItem = new ContextMenuItem("Selected Item", "");
            _contextMenuInstance.ContextMenuItems.AddAt(selectedItemPos, selectedItem);

            // Pseudo-rendering
            StringWriter swTemp = new StringWriter();
            HtmlTextWriter writer = new HtmlTextWriter(swTemp);
            _contextMenuInstance.RenderControl(writer);
            writer.Close();
            swTemp.Close();

            // Modify the background color of the selected item
            Table menu = (Table) (_contextMenuInstance.Controls[0]).Controls[0];
            TableRow row = menu.Rows[selectedItemPos];
            row.BackColor = _contextMenuInstance.RolloverColor;

            StringWriter sw = new StringWriter();
            writer.InnerWriter = sw;
            menu.RenderControl(writer);

            if (numOfItems == 0)
                _contextMenuInstance.ContextMenuItems.Clear();
            else
                _contextMenuInstance.ContextMenuItems.RemoveAt(selectedItemPos);

            return sw.ToString();
        }
    protected void Page_Load(object sender, EventArgs e)
    {
        // Add "Section properties" menu item to context menu
        ContextMenuItem menuItem = new ContextMenuItem() { ID = "iSectionProperties", ResourceString = "general.edit" };
        menuItem.Attributes.Add("onclick", "SectionProperties(GetContextMenuParameter('nodeMenu'));");
        menuItem.AddCssClass("sectionPropertiesMenuItem");
        menuElem.AdditionalMenuItems.Controls.Add(menuItem);

        const string SCRIPT = @"// Section properties
        function SectionProperties(nodeId) {
        if (!CheckChanges()) {
        return false;
        }
        if (!nodeId) {
        nodeId = GetSelectedNodeId();
        }
        if (nodeId != 0) {
        window.PerformContentRedirect('sectionEdit', '', nodeId, '');
        return true;
        }
        return false;
        }";
        ScriptHelper.RegisterClientScriptBlock(Page, typeof(string), "SectionPropertiesFunction", ScriptHelper.GetScript(SCRIPT));
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        currentUser = MembershipContext.AuthenticatedUser;

        // Hide the add MVT/CP variant when Manage permission is not allowed
        if (!currentUser.IsAuthorizedPerResource("cms.contentpersonalization", "Manage"))
        {
            plcAddCPVariant.Visible = false;
        }

        if (!currentUser.IsAuthorizedPerResource("cms.mvtest", "Manage"))
        {
            plcAddMVTVariant.Visible = false;
        }

        // Main menu
        lblNewWebPart.Text = ResHelper.GetString("ZoneMenu.IconNewWebPart", UICulture);
        pnlNewWebPart.Attributes.Add("onclick", "ContextNewWebPart();");

        // Configure
        lblConfigureZone.Text = ResHelper.GetString("ZoneMenu.IconConfigureWebpartZone", UICulture);
        pnlConfigureZone.Attributes.Add("onclick", "ContextConfigureWebPartZone();");

        // Move to
        lblMoveTo.Text = ResHelper.GetString("ZoneMenu.IconMoveTo", UICulture);

        // Copy all web parts
        lblCopy.Text = ResHelper.GetString("ZoneMenu.CopyAll", UICulture);
        pnlCopyAllItem.Attributes.Add("onclick", "ContextCopyAllWebParts();");

        // Paste web part(s)
        lblPaste.Text = ResHelper.GetString("ZoneMenu.paste", UICulture);
        pnlPaste.Attributes.Add("onclick", "ContextPasteWebPartZone();");
        pnlPaste.ToolTip = ResHelper.GetString("ZoneMenu.pasteTooltip", UICulture);

        // Delete all web parts
        lblDelete.Text = ResHelper.GetString("ZoneMenu.RemoveAll", UICulture);
        pnlDelete.Attributes.Add("onclick", "ContextRemoveAllWebParts();");

        // Add new MVT variants
        lblAddMVTVariant.Text = ResHelper.GetString("ZoneMenu.AddZoneVariant", UICulture);

        // Add new Content personalization variant
        lblAddCPVariant.Text = ResHelper.GetString("ZoneMenu.AddZoneVariant", UICulture);

        // Add new variant
        pnlAddMVTVariant.Attributes.Add("onclick", "ContextAddWebPartZoneMVTVariant();");
        pnlAddCPVariant.Attributes.Add("onclick", "ContextAddWebPartZoneCPVariant();");

        // List all variants
        lblMVTVariants.Text = ResHelper.GetString("ZoneMenu.ZoneMVTVariants", UICulture);
        lblCPVariants.Text = ResHelper.GetString("ZoneMenu.ZonePersonalizationVariants", UICulture);

        // No MVT variants
        lblNoZoneMVTVariants.Text = ResHelper.GetString("ZoneMenu.NoVariants", UICulture);

        // No CP variants
        lblNoZoneCPVariants.Text = ResHelper.GetString("ZoneMenu.NoVariants", UICulture);

        if (PortalManager.CurrentPlaceholder != null)
        {
            // Build the list of web part zones
            var webPartZones = new List<CMSWebPartZone>();

            if (PortalManager.CurrentPlaceholder.WebPartZones != null)
            {
                foreach (CMSWebPartZone zone in PortalManager.CurrentPlaceholder.WebPartZones)
                {
                    // Add only standard zones to the list
                    if ((zone.ZoneInstance.WidgetZoneType == WidgetZoneTypeEnum.None) && zone.AllowModifyWebPartCollection)
                    {
                        webPartZones.Add(zone);
                    }
                }
            }

            repZones.DataSource = webPartZones;
            repZones.DataBind();
        }

        if (PortalContext.MVTVariantsEnabled || PortalContext.ContentPersonalizationEnabled)
        {
            var loadingMenu = new ContextMenuItem { ResourceString = "ContextMenu.Loading" }.GetRenderedHTML();

            menuMoveToZoneVariants.LoadingContent = loadingMenu;
            menuMoveToZoneVariants.OnReloadData += menuMoveToZoneVariants_OnReloadData;
            repMoveToZoneVariants.ItemDataBound += repZoneVariants_ItemDataBound;

            // Display the MVT menu part in the CMSDesk->Design only. Hide the context menu in the SM->PageTemplates->Design
            if (PortalContext.MVTVariantsEnabled && (DocumentContext.CurrentPageInfo != null) && (DocumentContext.CurrentPageInfo.DocumentID > 0) && currentUser.IsAuthorizedPerResource("cms.mvtest", "read"))
            {
                // Set Display='none' for the MVT panel. Show dynamically only if required.
                pnlContextMenuMVTVariants.Visible = true;
                pnlContextMenuMVTVariants.Style.Add("display", "none");
                menuZoneMVTVariants.LoadingContent = loadingMenu;
                menuZoneMVTVariants.OnReloadData += menuZoneMVTVariants_OnReloadData;
                repZoneMVTVariants.ItemDataBound += repVariants_ItemDataBound;

                string script = "zoneMVTVariantContextMenuId = '" + pnlContextMenuMVTVariants.ClientID + "';";
                ScriptHelper.RegisterStartupScript(this, typeof(string), "zoneMVTVariantContextMenuId", ScriptHelper.GetScript(script));
            }
            else
            {
                // Hide the MVT variant context menu items when MVT is not enabled for the current document
                pnlUIMVTVariants.Visible = false;
            }

            // Display the Content personalization menu part in the CMSDesk->Design only. Hide the context menu in the SM->PageTemplates->Design
            if ((PortalContext.ContentPersonalizationEnabled) && (DocumentContext.CurrentPageInfo != null) && (DocumentContext.CurrentPageInfo.DocumentID > 0) && currentUser.IsAuthorizedPerResource("cms.contentpersonalization", "read"))
            {
                // Set Display='none' for the MVT panel. Show dynamically only if required.
                pnlContextMenuCPVariants.Visible = true;
                pnlContextMenuCPVariants.Style.Add("display", "none");
                menuZoneCPVariants.LoadingContent = loadingMenu;
                menuZoneCPVariants.OnReloadData += menuZoneCPVariants_OnReloadData;
                repZoneCPVariants.ItemDataBound += repVariants_ItemDataBound;

                string script = "zoneCPVariantContextMenuId = '" + pnlContextMenuCPVariants.ClientID + "';";
                ScriptHelper.RegisterStartupScript(this, typeof(string), "zoneCPVariantContextMenuId", ScriptHelper.GetScript(script));
            }
            else
            {
                // Hide the Content personalization variant context menu items when the Content Personalization is not enabled.
                pnlUICPVariants.Visible = false;
            }
        }
    }
Пример #37
0
        private void BindingContextMenuItems()
        {
            _menuItems = new ContextMenuItems
            {
                new ContextMenuItem
                {
                    Command=OpenCommand,
                    Title="Open",
                    StatusColor=Brushes.Orange,
                    ImagePath = Geometry.Parse("M5.388822,5.0339882L22.943006,5.0339882 18.721215,15.256989 1.6100047,15.256989z M0,0L6.6660105,0 8.0000125,2.9348083 18.70703,2.9348083 18.70403,3.8337495 4.5530072,3.8337495 0.33200061,15.257004 0,15.257004z"),
                },

                 new ContextMenuItem
                 {
                    Command = SaveCommand,
                    Parameter = "Device",
                    Title="Save",
                    StatusColor=Brushes.DodgerBlue,
                    ImagePath = Geometry.Parse("M8.1099597,36.94997L8.1099597,41.793968 39.213959,41.793968 39.213959,36.94997z M12.42,0.049999889L18.4,0.049999889 18.4,12.252 12.42,12.252z M0,0L7.9001866,0 7.9001866,14.64218 39.210766,14.64218 39.210766,0 47.401001,0 47.401001,47.917 0,47.917z"),
                },

                new ContextMenuItem
                {
                    Command=SettingsCommand(),
                    Title="Settings",
                    StatusColor=Brushes.Silver,
                    ImagePath = Geometry.Parse("M383.518,230.427C299.063,230.427 230.355,299.099 230.355,383.554 230.355,468.009 299.063,536.644 383.518,536.644 467.937,536.644 536.645,468.009 536.645,383.554 536.645,299.099 467.937,230.427 383.518,230.427z M340.229,0L426.771,0C436.838,0,445.035,8.19732,445.035,18.2643L445.035,115.303C475.165,122.17,503.532,133.928,529.634,150.43L598.306,81.6869C601.721,78.3074 606.359,76.3653 611.213,76.3653 616.031,76.3653 620.704,78.3074 624.12,81.6869L685.278,142.916C692.397,150.035,692.397,161.648,685.278,168.767L616.677,237.402C633.108,263.54,644.866,291.907,651.733,322.001L748.736,322.001C758.803,322.001,767,330.198,767,340.265L767,426.806C767,436.873,758.803,445.07,748.736,445.07L651.769,445.07C644.901,475.235,633.108,503.531,616.677,529.669L685.278,598.305C688.694,601.72 690.635,606.358 690.635,611.212 690.635,616.102 688.694,620.705 685.278,624.12L624.085,685.313C620.525,688.872 615.851,690.67 611.177,690.67 606.503,690.67 601.865,688.872 598.269,685.313L529.67,616.678C503.567,633.109,475.2,644.937,445.035,651.804L445.035,748.771C445.035,758.838,436.838,767,426.771,767L340.229,767C330.162,767,321.965,758.838,321.965,748.771L321.965,651.804C291.8,644.937,263.433,633.109,237.366,616.678L168.731,685.313C165.315,688.693 160.677,690.67 155.823,690.67 151.005,690.67 146.296,688.693 142.916,685.313L81.7221,624.12C74.6033,617.036,74.6033,605.424,81.7221,598.305L150.323,529.669C133.892,503.603,122.099,475.235,115.267,445.07L18.2643,445.07C8.19734,445.07,0,436.873,0,426.806L0,340.265C0,330.198,8.19734,322.001,18.2643,322.001L115.267,322.001C122.135,291.907,133.892,263.54,150.323,237.402L81.7221,168.767C78.3064,165.351 76.3655,160.713 76.3655,155.859 76.3655,150.97 78.3064,146.332 81.7221,142.916L142.916,81.7582C146.476,78.1988 151.149,76.4016 155.823,76.4016 160.497,76.4016 165.171,78.1988 168.731,81.7582L237.366,150.43C263.469,133.928,291.837,122.17,321.965,115.303L321.965,18.2643C321.965,8.19732,330.162,0,340.229,0z"),
                },

            };

            powerItem = new ContextMenuItem
            {
                Command = ConnectCommand(),
                Title = "Connect",
                StatusColor = Brushes.Silver,
                ImagePath =
                    Geometry.Parse(
                        "M14.800615,5.6499605L14.800615,14.800346C10.630442,17.910477 7.8903284,22.840685 7.8903284,28.44092 7.9003286,37.871319 15.530646,45.511639 24.961039,45.521641 34.391431,45.511639 42.011749,37.871319 42.04175,28.44092 42.03175,22.840685 39.291636,17.910477 35.121462,14.800346L35.121462,5.6599612C43.841825,9.5601254,49.912077,18.280493,49.912077,28.44092L49.922077,28.44092C49.912077,42.231503 38.741611,53.391972 24.961039,53.391972 11.170465,53.391972 0,42.231503 0,28.44092 0,18.270493 6.0902529,9.5501251 14.800615,5.6499605z M19.570043,0L30.237043,0 30.237043,33.917 19.570043,33.917z"),
            };

            _menuItems.Add(powerItem);
        }
    protected void Page_Load(object sender, EventArgs e)
    {
        string loadingContent = new ContextMenuItem { ResourceString = "ContextMenu.Loading" }.GetRenderedHTML();

        menuNew.LoadingContent = loadingContent;
        menuProperties.LoadingContent = loadingContent;

        menuNew.OnReloadData += menuNew_OnReloadData;
        repNew.ItemDataBound += repNew_ItemDataBound;

        // Main menu
        iNew.Attributes.Add("onclick", "NewItem(GetContextMenuParameter('nodeMenu'), true);");

        iDelete.Attributes.Add("onclick", "DeleteItem(GetContextMenuParameter('nodeMenu'), true);");

        iCopy.Attributes.Add("onclick", "CopyRef(GetContextMenuParameter('nodeMenu'));");

        iMove.Attributes.Add("onclick", "MoveRef(GetContextMenuParameter('nodeMenu'));");

        iUp.Attributes.Add("onclick", "MoveUp(GetContextMenuParameter('nodeMenu'));");

        iDown.Attributes.Add("onclick", "MoveDown(GetContextMenuParameter('nodeMenu'));");

        // Refresh subsection
        iRefresh.Attributes.Add("onclick", "RefreshTree(GetContextMenuParameter('nodeMenu'), null);");

        // Sort menu
        iAlphaAsc.Attributes.Add("onclick", "SortAlphaAsc(GetContextMenuParameter('nodeMenu'));");
        iAlphaDesc.Attributes.Add("onclick", "SortAlphaDesc(GetContextMenuParameter('nodeMenu'));");
        iDateAsc.Attributes.Add("onclick", "SortDateAsc(GetContextMenuParameter('nodeMenu'));");
        iDateDesc.Attributes.Add("onclick", "SortDateDesc(GetContextMenuParameter('nodeMenu'));");

        // Up menu
        iTop.Text = GetString("UpMenu.IconTop");
        iTop.Attributes.Add("onclick", "MoveTop(GetContextMenuParameter('nodeMenu'));");

        // Down menu
        iBottom.Text = GetString("DownMenu.IconBottom");
        iBottom.Attributes.Add("onclick", "MoveBottom(GetContextMenuParameter('nodeMenu'));");

        // New menu
        iNewLink.Attributes.Add("onclick", "LinkRef(GetContextMenuParameter('nodeMenu'));");

        // Variant
        iNewVariant.Attributes.Add("onclick", "NewVariant(GetContextMenuParameter('nodeMenu'), true);");
    }
    protected void ContextMenu_OnReloadData(object sender, EventArgs e)
    {
        int nodeId = ValidationHelper.GetInteger(ContextMenu.Parameter, 0);

        // Get the node
        var tree = new TreeProvider(MembershipContext.AuthenticatedUser);
        var node = tree.SelectSingleNode(nodeId);

        if (node != null)
        {
            if (plcProperties.Visible)
            {
                // Properties menu
                var elements = UIElementInfoProvider.GetChildUIElements("CMS.Content", "Properties");
                if (!DataHelper.DataSourceIsEmpty(elements))
                {
                    var index = 0;
                    UserInfo user = MembershipContext.AuthenticatedUser;

                    foreach (var element in elements)
                    {
                        // Skip elements not relevant for given node
                        if (DocumentUIHelper.IsElementHiddenForNode(element, node))
                        {
                            continue;
                        }

                        var elementName = element.ElementName.ToLowerCSafe();

                        // If UI element is available and user has permission to show it then add it
                        if (UIContextHelper.CheckElementAvailabilityInUI(element) && user.IsAuthorizedPerUIElement(element.ElementResourceID, elementName))
                        {
                            switch (elementName)
                            {
                                case "properties.languages":
                                    if (!CultureSiteInfoProvider.IsSiteMultilingual(SiteContext.CurrentSiteName) || !CultureSiteInfoProvider.LicenseVersionCheck())
                                    {
                                        continue;
                                    }
                                    break;

                                case "properties.variants":
                                    if (!LicenseHelper.IsFeatureAvailableInUI(FeatureEnum.ContentPersonalization, ModuleName.ONLINEMARKETING)
                                        || !ResourceSiteInfoProvider.IsResourceOnSite("CMS.ContentPersonalization", SiteContext.CurrentSiteName)
                                        || !PortalContext.ContentPersonalizationEnabled
                                        || (VariantHelper.GetVariantID(VariantModeEnum.ContentPersonalization, node.GetUsedPageTemplateId(), String.Empty) <= 0))
                                    {
                                        continue;
                                    }
                                    break;

                                case "properties.workflow":
                                case "properties.versions":
                                    if (node.GetWorkflow() == null)
                                    {
                                        continue;
                                    }
                                    break;
                            }

                            var item = new ContextMenuItem();
                            item.ID = "p" + index;
                            item.Attributes.Add("onclick", String.Format("Properties(GetContextMenuParameter('nodeMenu'), '{0}');", elementName));

                            // UI elements could have a different display name if content only document is selected
                            item.Text = DocumentUIHelper.GetUIElementDisplayName(element, node);

                            pnlPropertiesMenu.Controls.Add(item);

                            index++;
                        }
                    }

                    if (index == 0)
                    {
                        // Hide 'Properties' menu if user has no permission for at least one properties section
                        plcProperties.Visible = false;
                    }
                }
            }
        }
        else
        {
            iNoNode.Visible = true;
            plcFirstLevelContainer.Visible = false;
        }
    }
Пример #40
0
 public ToolStripItem CreateItem(ContextMenuItem item)
 {
     switch (item)
     {
         case ContextMenuItem.Separator:
             return CreateSeparator();
         case ContextMenuItem.NewInvoice:
             return CreateNewInvoice();
         case ContextMenuItem.NewDTP:
             return CreateNewDTP();
         case ContextMenuItem.NewViolation:
             return CreateNewViolation();
         case ContextMenuItem.NewPolicy:
             return CreateNewPolicy();
         case ContextMenuItem.NewDiagCard:
             return CreateNewDiagCard();
         case ContextMenuItem.NewMileage:
             return CreateNewMileage();
         case ContextMenuItem.NewTempMove:
             return CreateNewTempMove();
         case ContextMenuItem.ToSale:
             return CreateToSale();
         case ContextMenuItem.DeleteFromSale:
             return CreateDeleteFromSale();
         case ContextMenuItem.LotusMail:
             return CreateLotusMail();
         case ContextMenuItem.SendPolicyOsago:
             return CreateSendPolicyOsago();
         case ContextMenuItem.SendPolicyKasko:
             return CreateSendPolicyKasko();
         case ContextMenuItem.Copy:
             return CreateCopy();
         case ContextMenuItem.Print:
             return CreatePrint();
         case ContextMenuItem.PrintWayBill:
             return CreatePrintWayBill();
         case ContextMenuItem.ShowWayBill:
             return CreateShowWayBill();
         case ContextMenuItem.ShowWayBillDaily:
             return CreateShowWayBillDaily();
         //------------------------------
         case ContextMenuItem.ShowInvoice:
             return CreateShowInvoice();
         case ContextMenuItem.ShowAttacheToOrder:
             return CreateShowAttacheToOrder();
         case ContextMenuItem.ShowProxyOnSTO:
             return CreateShowProxyOnSTO();
         case ContextMenuItem.PrintProxyOnSTO:
             return CreatePrintProxyOnSTO();
         case ContextMenuItem.ShowPolicyKasko:
             return CreateShowPolicyKasko();
         case ContextMenuItem.ShowActFuelCard:
             return CreateShowActFuelCard();
         case ContextMenuItem.ShowNotice:
             return CreateShowNotice();
         case ContextMenuItem.ShowSTS:
             return CreateShowSTS();
         case ContextMenuItem.ShowDriverLicense:
             return CreateShowDriverLicense();
         //----------------------------------
         case ContextMenuItem.Exit:
             return CreateExit();
         case ContextMenuItem.Documents:
             return CreateDocuments();
         case ContextMenuItem.NewCar:
             return CreateNewCar();
         case ContextMenuItem.NewAccount:
             return CreateNewAccount();
         case ContextMenuItem.NewFuelCard:
             return CreateNewFuelCard();
         case ContextMenuItem.ShowPolicyList:
             return CreateShowPolicyList();
         case ContextMenuItem.PrintAllTable:
             return CreatePrintAllTable();
         case ContextMenuItem.ShowAllTable:
             return CreateShowAllTable();
         //---------------------------------
         case ContextMenuItem.Driver:
             return CreateDriver();
         case ContextMenuItem.Region:
             return CreateRegion();
         case ContextMenuItem.SuppyAddress:
             return CreateSuppyAddress();
         case ContextMenuItem.Employee:
             return CreateEmployee();
         case ContextMenuItem.Mark:
             return CreateMark();
         case ContextMenuItem.Model:
             return CreateModel();
         case ContextMenuItem.Grade:
             return CreateGrade();
         case ContextMenuItem.EngineType:
             return CreateEngineType();
         case ContextMenuItem.Color:
             return CreateColor();
         case ContextMenuItem.Dealer:
             return CreateDiler();
         case ContextMenuItem.Owner:
             return CreateOwner();
         case ContextMenuItem.Comp:
             return CreateComp();
         case ContextMenuItem.ServiceStantion:
             return CreateServiceStantion();
         case ContextMenuItem.ServiceStantionComp:
             return CreateServiceStantionComp();
         case ContextMenuItem.Culprit:
             return CreateCulprit();
         case ContextMenuItem.RepairType:
             return CreateRepairType();
         case ContextMenuItem.StatusAfterDTP:
             return CreateStatusAfterDTP();
         case ContextMenuItem.CurrentStatusAfterDTP:
             return CreateCurrentStatusAfterDTP();
         case ContextMenuItem.ViolationType:
             return CreateViolationType();
         case ContextMenuItem.ProxyType:
             return CreateProxyType();
         case ContextMenuItem.FuelCardType:
             return CreateFuelCardType();
         case ContextMenuItem.MailText:
             return CreateMailText();
         case ContextMenuItem.Template:
             return CreateTemplate();
         case ContextMenuItem.UserAccess:
             return CreateUserAccess();
         case ContextMenuItem.Profession:
             return CreateProfession();
         case ContextMenuItem.Sort:
             return CreateSort();
         case ContextMenuItem.Filter:
             return CreateFilter();
         case ContextMenuItem.AddDriver:
             return CreateAddDriver();
         case ContextMenuItem.DeleteDriver:
             return CreateDeleteDriver();
         case ContextMenuItem.MyPointList:
             return CreateMyPointList();
         case ContextMenuItem.RouteList:
             return CreateRouteList();
         case ContextMenuItem.MileageFill:
             return CreateMileageFill();
         case ContextMenuItem.FuelLoad:
             return CreateFuelLoad();
         default:
             throw new NotImplementedException();
     }
 }
    protected void Page_Load(object sender, EventArgs e)
    {
        currentUser = MembershipContext.AuthenticatedUser;

        // Hide the add MVT/CP variant when Manage permission is not allowed
        if (!currentUser.IsAuthorizedPerResource("cms.mvtest", "Manage"))
        {
            plcAddMVTVariant.Visible = false;
        }

        if (!currentUser.IsAuthorizedPerResource("cms.contentpersonalization", "Manage"))
        {
            plcAddCPVariant.Visible = false;
        }

        if (PortalContext.ViewMode.IsWireframe())
        {
            pnlUIPaste.AlwaysVisible = true;
            pnlUIDelete.AlwaysVisible = true;
            pnlUIProperties.AlwaysVisible = true;
        }

        string click = null;

        // Main menu
        iProperties.Text = ResHelper.GetString("WebPartMenu.IconProperties", UICulture);
        iProperties.Attributes.Add("onclick", "ContextConfigureWebPart();");

        // Up menu - Bottom
        iTop.Text = ResHelper.GetString("UpMenu.IconTop", UICulture);

        iForwardAll.Text = ResHelper.GetString("WebPartMenu.IconForward", UICulture);

        click = "ContextMoveWebPartTop();";
        iForwardAll.Attributes.Add("onclick", click);
        iTop.Attributes.Add("onclick", click);

        // Up
        iUp.Text = ResHelper.GetString("WebPartMenu.IconUp", UICulture);

        click = "ContextMoveWebPartUp();";
        iUp.Attributes.Add("onclick", click);

        // Down
        iDown.Text = ResHelper.GetString("WebPartMenu.IconDown", UICulture);

        click = "ContextMoveWebPartDown();";
        iDown.Attributes.Add("onclick", click);

        // Down menu - Bottom
        iBottom.Text = ResHelper.GetString("DownMenu.IconBottom", UICulture);

        iBackwardAll.Text = ResHelper.GetString("WebPartMenu.IconBackward", UICulture);

        click = "ContextMoveWebPartBottom();";
        iBackwardAll.Attributes.Add("onclick", click);
        iBottom.Attributes.Add("onclick", click);

        // Move to
        iMoveTo.Text = ResHelper.GetString("WebPartMenu.IconMoveTo", UICulture);

        // Copy
        iCopy.Text = ResHelper.GetString("WebPartMenu.copy", UICulture);
        iCopy.Attributes.Add("onclick", "ContextCopyWebPart(this);");

        // Paste
        iPaste.Text = ResHelper.GetString("WebPartMenu.paste", UICulture);
        iPaste.Attributes.Add("onclick", "ContextPasteWebPart(this);");
        iPaste.ToolTip = ResHelper.GetString("WebPartMenu.pasteTooltip", UICulture);

        // Delete
        iDelete.Text = ResHelper.GetString("general.remove", UICulture);
        iDelete.Attributes.Add("onclick", "ContextRemoveWebPart();");

        // Add new MVT variant
        lblAddMVTVariant.Text = ResHelper.GetString("WebPartMenu.AddWebPartVariant", UICulture);
        pnlAddMVTVariant.Attributes.Add("onclick", "ContextAddWebPartMVTVariant();");

        // Add new Content personalization variant
        lblAddCPVariant.Text = ResHelper.GetString("WebPartMenu.AddWebPartVariant", UICulture);
        pnlAddCPVariant.Attributes.Add("onclick", "ContextAddWebPartCPVariant();");

        // List all variants
        lblMVTVariants.Text = ResHelper.GetString("WebPartMenu.WebPartMVTVariants", UICulture);
        lblCPVariants.Text = ResHelper.GetString("WebPartMenu.WebPartPersonalizationVariants", UICulture);

        // No MVT variants
        lblNoWebPartMVTVariants.Text = ResHelper.GetString("ZoneMenu.NoVariants", UICulture);

        // No CP variants
        lblNoWebPartCPVariants.Text = ResHelper.GetString("ZoneMenu.NoVariants", UICulture);

        if (PortalManager.CurrentPlaceholder != null)
        {
            // Build the list of web part zones
            var webPartZones = new List<CMSWebPartZone>();

            if (PortalManager.CurrentPlaceholder.WebPartZones != null)
            {
                foreach (CMSWebPartZone zone in PortalManager.CurrentPlaceholder.WebPartZones)
                {
                    // Add only standard zones to the list
                    if ((zone.ZoneInstance.WidgetZoneType == WidgetZoneTypeEnum.None) && zone.AllowModifyWebPartCollection)
                    {
                        webPartZones.Add(zone);
                    }
                }
            }

            repZones.DataSource = webPartZones;
            repZones.DataBind();
        }

        if (PortalContext.MVTVariantsEnabled || PortalContext.ContentPersonalizationEnabled)
        {
            var loadingMenu = new ContextMenuItem { ResourceString = "ContextMenu.Loading" }.GetRenderedHTML();

            menuMoveToZoneVariants.LoadingContent = loadingMenu;
            menuMoveToZoneVariants.OnReloadData += menuMoveToZoneVariants_OnReloadData;
            repMoveToZoneVariants.ItemDataBound += repMoveToZoneVariants_ItemDataBound;

            // Display the MVT menu part in the CMSDesk->Design only. Hide the context menu in the SM->PageTemplates->Design
            if (PortalContext.MVTVariantsEnabled && (DocumentContext.CurrentPageInfo != null) && (DocumentContext.CurrentPageInfo.DocumentID > 0))
            {
                // Set Display='none' for the MVT panel. Show dynamically only if required.
                pnlContextMenuMVTVariants.Visible = true;
                pnlContextMenuMVTVariants.Style.Add("display", "none");
                menuWebPartMVTVariants.LoadingContent = loadingMenu;
                menuWebPartMVTVariants.OnReloadData += menuWebPartMVTVariants_OnReloadData;
                repWebPartMVTVariants.ItemDataBound += repWebPartVariants_ItemDataBound;

                string script = "webPartMVTVariantContextMenuId = '" + pnlContextMenuMVTVariants.ClientID + "';";
                ScriptHelper.RegisterStartupScript(this, typeof(string), "webPartMVTVariantContextMenuId", ScriptHelper.GetScript(script));
            }
            else
            {
                // Hide the MVT variant context menu items when MVT is not enabled for the current document
                pnlUIMVTVariants.Visible = false;
            }

            // Display the Content personalization menu part in the CMSDesk->Design only. Hide the context menu in the SM->PageTemplates->Design
            if ((PortalContext.ContentPersonalizationEnabled) && (DocumentContext.CurrentPageInfo != null) && (DocumentContext.CurrentPageInfo.DocumentID > 0))
            {
                // Set Display='none' for the MVT panel. Show dynamically only if required.
                pnlContextMenuCPVariants.Visible = true;
                pnlContextMenuCPVariants.Style.Add("display", "none");
                menuWebPartCPVariants.LoadingContent = loadingMenu;
                menuWebPartCPVariants.OnReloadData += menuWebPartCPVariants_OnReloadData;
                repWebPartCPVariants.ItemDataBound += repWebPartVariants_ItemDataBound;

                string script = "webPartCPVariantContextMenuId = '" + pnlContextMenuCPVariants.ClientID + "';";
                ScriptHelper.RegisterStartupScript(this, typeof(string), "webPartCPVariantContextMenuId", ScriptHelper.GetScript(script));
            }
            else
            {
                // Hide the Content personalization variant context menu items when the Content Personalization is not enabled.
                pnlUICPVariants.Visible = false;
            }
        }
    }
        /// <summary>
        /// add an option to open a console here if it's a directory
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void host_ContextMenuOpening(object sender, ContextMenuOpeningEventArgs e)
        {
            // we only show the context menu if every item selected in the tree is valid to be compiled 
            IList<string> paths = new List<string>();
            var showContextMenu = e.Items.Count > 0;
            foreach (ISiteItem item in e.Items)
            {
                if (item == null || !(item is ISiteFolder))
                {
                    showContextMenu = false;
                    break;
                }
                else
                {
                    paths.Add((item as ISiteFolder).Path);
                }
            }

            // if all of the files in the list are valid, show the command window option
            if (showContextMenu)
            {
                var menuItem = new ContextMenuItem("Open Command Window", null, new DelegateCommand(new Action<object>(OpenCMD)), paths);
                e.AddMenuItem(menuItem);
            }
        }
Пример #43
0
        public TrailerPanel()
        {
            this.MouseDown += new MouseEventHandler(TextPanel_MouseDown);
            this.MouseMove += new MouseEventHandler(TextPanel_MouseMove);
            this.MouseUp += new MouseEventHandler(TextPanel_MouseUp);
            this.MouseLeave += new EventHandler(TextPanel_MouseLeave);
            this.MouseEnter += new EventHandler(TextPanel_MouseEnter);
            this.PreviewKeyDown += new PreviewKeyDownEventHandler(TextPanel_PreviewKeyDown);
            this.BackgroundImageLayout = ImageLayout.Stretch;
            this.BackColor = Color.Transparent;
            this.BorderStyle = BorderStyle.FixedSingle;

            textLabel = new Label();
            textLabel.AutoSize = false;
            textLabel.Font = new Font("Microsoft Sans Serif", 11F, FontStyle.Regular, GraphicsUnit.Point, ((byte)(0)));
            textLabel.Dock = DockStyle.Fill;
            textLabel.TextAlign = ContentAlignment.MiddleLeft;
            textLabel.DoubleClick += new EventHandler(TextLabel_DoubleClick);
            textLabel.MouseDown += new MouseEventHandler(TextPanel_MouseDown);
            textLabel.MouseMove += new MouseEventHandler(TextPanel_MouseMove);
            textLabel.MouseUp += new MouseEventHandler(TextPanel_MouseUp);
            textLabel.MouseLeave += new EventHandler(TextPanel_MouseLeave);
            textLabel.MouseEnter += new EventHandler(TextPanel_MouseEnter);
            this.Controls.Add(textLabel);

            textBox = new AdjHeightTextBox();
            textBox.Dock = DockStyle.Fill;
            textBox.TextAlign = HorizontalAlignment.Left;
            textBox.Leave += new EventHandler(textBox_Leave);
            textBox.KeyPress += new KeyPressEventHandler(textBox_KeyPress);
            textBox.Visible = false;
            textLabel.Controls.Add(textBox);

            DeleteBox = new PictureBox();
            DeleteBox.Width = 20;
            DeleteBox.Dock = DockStyle.Right;
            DeleteBox.BackgroundImageLayout = ImageLayout.Zoom;
            DeleteBox.BackgroundImage = global::MetaVideoEditor.Properties.Resources.delete;
            DeleteBox.MouseLeave += new EventHandler(TextPanel_MouseLeave);
            DeleteBox.MouseEnter += new EventHandler(TextPanel_MouseEnter);
            DeleteBox.Visible = false;
            this.Controls.Add(DeleteBox);

            contextMenu = new ContextMenuStrip();
            ContextMenuItem playMenu = new ContextMenuItem();
            playMenu.Text = Kernel.Instance.GetString("PlayTraTab");
            playMenu.DefaultItem = true;
            playMenu.Image = global::MetaVideoEditor.Properties.Resources.play;
            playMenu.Click += new EventHandler(playMenu_Click);

            dlMenu = new ContextMenuItem();
            dlMenu.Text = Kernel.Instance.GetString("DownloadTraTab");
            dlMenu.Image = global::MetaVideoEditor.Properties.Resources.download;
            dlMenu.Click += new EventHandler(dlMenu_Click);

            ContextMenuItem editMenu = new ContextMenuItem();
            editMenu.Text = Kernel.Instance.GetString("EditMW");
            editMenu.Image = global::MetaVideoEditor.Properties.Resources.edit;
            editMenu.Click += new EventHandler(editMenu_Click);

            ContextMenuItem deleteMenu = new ContextMenuItem();
            deleteMenu.Text = Kernel.Instance.GetString("DeleteMW");
            deleteMenu.Image = global::MetaVideoEditor.Properties.Resources.delete;
            deleteMenu.Click += new EventHandler(deleteMenu_Click);

            contextMenu.Items.Add(playMenu);
            contextMenu.Items.Add(editMenu);
            contextMenu.Items.Add(dlMenu);
            contextMenu.Items.Add(deleteMenu);
            this.ContextMenuStrip = contextMenu;
        }
Пример #44
0
        public CrewMemberPanel()
        {
            this.MouseDown += new MouseEventHandler(CrewPanel_MouseDown);
            this.MouseMove += new MouseEventHandler(CrewPanel_MouseMove);
            this.MouseUp += new MouseEventHandler(CrewPanel_MouseUp);
            this.MouseLeave += new EventHandler(CrewPanel_MouseLeave);
            this.MouseEnter += new EventHandler(CrewPanel_MouseEnter);
            this.PreviewKeyDown += new PreviewKeyDownEventHandler(CrewPanel_PreviewKeyDown);
            this.AllowDrop = true;
            this.BackgroundImageLayout = ImageLayout.Stretch;
            this.BackColor = Color.Transparent;
            this.BorderStyle = BorderStyle.FixedSingle;

            nameLabel = new Label();
            nameLabel.AutoSize = false;
            nameLabel.Location = new Point(0, 0);
            nameLabel.TextAlign = ContentAlignment.MiddleLeft;
            nameLabel.DoubleClick += new EventHandler(NameLabel_DoubleClick);
            nameLabel.MouseDown += new MouseEventHandler(CrewPanel_MouseDown);
            nameLabel.MouseMove += new MouseEventHandler(CrewPanel_MouseMove);
            nameLabel.MouseUp += new MouseEventHandler(CrewPanel_MouseUp);
            nameLabel.MouseLeave += new EventHandler(CrewPanel_MouseLeave);
            nameLabel.MouseEnter += new EventHandler(CrewPanel_MouseEnter);
            nameLabel.BorderStyle = BorderStyle.FixedSingle;
            this.Controls.Add(nameLabel);

            activityLabel = new Label();
            activityLabel.AutoSize = false;
            activityLabel.TextAlign = ContentAlignment.MiddleLeft;
            activityLabel.DoubleClick += new EventHandler(activityLabel_DoubleClick);
            activityLabel.MouseDown += new MouseEventHandler(CrewPanel_MouseDown);
            activityLabel.MouseMove += new MouseEventHandler(CrewPanel_MouseMove);
            activityLabel.MouseUp += new MouseEventHandler(CrewPanel_MouseUp);
            activityLabel.MouseLeave += new EventHandler(CrewPanel_MouseLeave);
            activityLabel.MouseEnter += new EventHandler(CrewPanel_MouseEnter);
            activityLabel.BorderStyle = BorderStyle.FixedSingle;
            this.Controls.Add(activityLabel);

            nameBox = new AdjHeightTextBox();
            nameBox.Dock = DockStyle.Fill;
            nameBox.TextAlign = HorizontalAlignment.Left;
            nameBox.Leave += new EventHandler(nameBox_Leave);
            nameBox.KeyPress += new KeyPressEventHandler(nameBox_KeyPress);
            nameBox.Visible = false;
            nameLabel.Controls.Add(nameBox);

            activityBox = new AdjHeightTextBox();
            activityBox.Dock = DockStyle.Fill;
            activityBox.TextAlign = HorizontalAlignment.Left;
            activityBox.Leave += new EventHandler(roleBox_Leave);
            activityBox.KeyPress += new KeyPressEventHandler(roleBox_KeyPress);
            activityBox.Visible = false;
            activityLabel.Controls.Add(activityBox);

            DeleteBox = new PictureBox();
            DeleteBox.Width = 20;
            DeleteBox.Dock = DockStyle.Right;
            DeleteBox.BackgroundImageLayout = ImageLayout.Zoom;
            DeleteBox.BackgroundImage = global::MetaVideoEditor.Properties.Resources.delete;
            DeleteBox.MouseLeave += new EventHandler(CrewPanel_MouseLeave);
            DeleteBox.MouseEnter += new EventHandler(CrewPanel_MouseEnter);
            DeleteBox.Visible = false;
            this.Controls.Add(DeleteBox);

            ContextMenuStrip contextMenu = new ContextMenuStrip();
            ContextMenuItem editNameMenu = new ContextMenuItem();
            editNameMenu.Text = Kernel.Instance.GetString("EditNameActTab");
            editNameMenu.DefaultItem = true;
            editNameMenu.Click += new EventHandler(NameLabel_DoubleClick);
            ContextMenuItem editActivityMenu = new ContextMenuItem();
            editActivityMenu.Text = Kernel.Instance.GetString("EditActivityCreTab");
            editActivityMenu.Click += new EventHandler(activityLabel_DoubleClick);
            ContextMenuItem deleteMenu = new ContextMenuItem();
            deleteMenu.Text = Kernel.Instance.GetString("DeleteMW");
            deleteMenu.Click += new EventHandler(deleteMenu_Click);

            contextMenu.Items.Add(editNameMenu);
            contextMenu.Items.Add(editActivityMenu);
            contextMenu.Items.Add(deleteMenu);
            this.ContextMenuStrip = contextMenu;
        }
Пример #45
0
		internal void ShowDockPopupMenu (Gtk.Widget parent, Gdk.EventButton evt)
		{
			var menu = new ContextMenu ();
			ContextMenuItem citem;

			// Hide menuitem
			if ((Behavior & DockItemBehavior.CantClose) == 0) {
				citem = new ContextMenuItem (Catalog.GetString ("Hide"));
				citem.Clicked += delegate { Visible = false; };
				menu.Add (citem);
			}

			// Auto Hide menuitem
			if ((Behavior & DockItemBehavior.CantAutoHide) == 0 && Status != DockItemStatus.AutoHide) {
				citem = new ContextMenuItem (Catalog.GetString ("Minimize"));
				citem.Clicked += delegate { Status = DockItemStatus.AutoHide; };
				menu.Add (citem);
			}

			if (Status != DockItemStatus.Dockable) {
				// Dockable menuitem
				citem = new ContextMenuItem (Catalog.GetString ("Dock"));
				citem.Clicked += delegate { Status = DockItemStatus.Dockable; };
				menu.Add (citem);
			}

			// Floating menuitem
			if ((Behavior & DockItemBehavior.NeverFloating) == 0 && Status != DockItemStatus.Floating) {
				citem = new ContextMenuItem (Catalog.GetString ("Undock"));
				citem.Clicked += delegate { Status = DockItemStatus.Floating; };
				menu.Add (citem);
			}

			if (menu.Items.Count == 0) {
				return;
			}

			ShowingContextMenu = true;
			menu.Show (parent, evt, () => { ShowingContextMenu = true; });
		}
Пример #46
0
        private void InitctMenu()
        {
            treeviewContextMenu = new ContextMenuStrip();

            ContextMenuItem openMenu = new ContextMenuItem();
            openMenu.Text = Kernel.Instance.GetString("OpenMW");
            openMenu.Shortcut = "Ctrl+O";
            openMenu.Image = global::MetaVideoEditor.Properties.Resources.folder;
            openMenu.Click += new EventHandler(openItem);
            treeviewContextMenu.Items.Add(openMenu);

            ContextMenuItem saveMenu = new ContextMenuItem();
            saveMenu.Text = Kernel.Instance.GetString("SaveMW");
            saveMenu.Name = "saveMenu";
            saveMenu.Shortcut = "Ctrl+S";
            saveMenu.Image = global::MetaVideoEditor.Properties.Resources.save;
            saveMenu.Click += new EventHandler(saveMenu_Click);
            treeviewContextMenu.Items.Add(saveMenu);

            ContextMenuItem deleteMenu = new ContextMenuItem();
            deleteMenu.Text = Kernel.Instance.GetString("DeleteMW");
            deleteMenu.Name = "deleteMenu";
            deleteMenu.ShortcutKeys = (Keys)(Keys.Control | Keys.Delete);
            deleteMenu.Image = global::MetaVideoEditor.Properties.Resources.delete;
            deleteMenu.Click += new EventHandler(deleteItem);
            treeviewContextMenu.Items.Add(deleteMenu);

            itemsView.ContextMenuStrip = treeviewContextMenu;
        }
Пример #47
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="e"></param>
        protected void AddOptions(ContextMenuOpeningEventArgs e)
        {
            // we only show the context menu if every item selected in the tree is valid to be compiled
            var jobs = new List<OrangeJob>();
            var showMenu = e.Items.Count > 0;
            Type itemType = null;

            // determine if we're dealing with folders or files.  If it's mixed, bug out
            foreach (ISiteItem item in e.Items)
            {
                if (itemType == null)
                {
                    itemType = item.GetType();
                }
                else if (itemType != item.GetType())
                {
                    return;
                }
            }

            var menuItem = new ContextMenuItem("OrangeBits Options", null, new DelegateCommand((items) =>
            {
                var selectedItems = items as IEnumerable<ISiteItem>;
                var dialog = new OptionsUI();
                var vm = new OptionViewModel()
                {
                    Paths = selectedItems.Select(x => (x as ISiteFileSystemItem).Path).ToArray()
                };

                prefUtility.LoadOptions(vm);
                dialog.DataContext = vm;
                var result = _host.ShowDialog("OrangeBits Options", dialog);
                if (result.HasValue && result.Value)
                {
                    prefUtility.SaveOptions(vm);
                }

            }), e.Items);
            e.AddMenuItem(menuItem);
        }
Пример #48
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="e"></param>
        protected void AddMultiMenu(ContextMenuOpeningEventArgs e, string[] supportedExtensions, OrangeJob.JobType jobType, string title, string multipleTitle)
        {
            var jobs = new List<OrangeJob>();
            foreach (ISiteItem item in e.Items)
            {
                var fsi = item as ISiteFileSystemItem;
                if (fsi != null)
                {
                    if (fsi is ISiteFolder)
                    {
                        // get all of the pngs under the selected path and add a job
                        var dir = new DirectoryInfo((fsi as ISiteFolder).Path);
                        var files = supportedExtensions.SelectMany(x => dir.GetFiles("*" + x, SearchOption.AllDirectories));

                        foreach (var f in files)
                        {
                            if (jobType != OrangeJob.JobType.Minify || (!f.FullName.EndsWith(".min.js") && !f.FullName.EndsWith(".min.css")))
                            {
                                jobs.Add(new OrangeJob()
                                {
                                    Path = f.FullName,
                                    OutputPath = GetOutputPath(f.FullName),
                                    Type = jobType,
                                    Source = OrangeJob.JobSource.Context
                                });
                            }
                        }
                    }
                    else if (supportedExtensions.Contains((new FileInfo(fsi.Path)).Extension.ToLower()))
                    {
                        if (jobType != OrangeJob.JobType.Minify || (!fsi.Path.EndsWith(".min.js") && !fsi.Path.EndsWith(".min.css")))
                        {
                            jobs.Add(new OrangeJob()
                            {
                                Path = fsi.Path,
                                OutputPath = GetOutputPath(fsi.Path),
                                Type = jobType,
                                Source = OrangeJob.JobSource.Context
                            });
                        }
                    }
                }
            }

            if (jobs.Count > 0)
            {
                var menuTitle = jobs.Count > 1 ? multipleTitle : title;
                var menuItem = new ContextMenuItem(menuTitle, null, new DelegateCommand(new Action<object>(AddJob)), jobs);
                e.AddMenuItem(menuItem);
            }
        }
Пример #49
0
 /// <summary>
 /// If the selected file can be compressed to a data uri, this will place it on the clipboard
 /// </summary>
 /// <param name="e"></param>
 protected void AddCopyDataURIMenu(ContextMenuOpeningEventArgs e)
 {
     if (e.Items.Count == 1)
     {
         var item = e.Items.First();
         if (item is ISiteFile)
         {
             var path = (item as ISiteFile).Path;
             if (OrangeCompiler.CanGetDataURI(path))
             {
                 var menuItem = new ContextMenuItem("Copy Data URI", null, new DelegateCommand((filePath) =>
                 {
                     var scheduler = TaskScheduler.FromCurrentSynchronizationContext();
                     Task.Factory.StartNew(() =>
                     {
                         var data = "data:image/" +
                         Path.GetExtension(filePath as string).Replace(".", "") +
                         ";base64," +
                         Convert.ToBase64String(File.ReadAllBytes(filePath as string));
                         return data;
                     }).ContinueWith((x) =>
                     {
                         Clipboard.SetText(x.Result);
                     }, scheduler);
                 }), path);
                 e.AddMenuItem(menuItem);
             }
         }
     }
 }