Exemplo n.º 1
0
 public ContextMenu(ContextMenuType type, RdlActor actor)
 {
     this.Loaded += new RoutedEventHandler(ContextMenu_Loaded);
     InitializeComponent();
     this.Type  = type;
     this.Actor = actor;
 }
        public static void DrawContextMenu(Func <GenericMenu> menuFunction, ContextMenuType context)
        {
            Texture texture = null;

            switch (context)
            {
            case ContextMenuType.Add:
                texture = StratusGUIStyles.addIcon;
                break;

            case ContextMenuType.Validation:
                texture = StratusGUIStyles.validateIcon;
                break;

            case ContextMenuType.Options:
                texture = StratusGUIStyles.optionsIcon;
                break;
            }

            if (GUILayout.Button(texture, StratusGUIStyles.editorStyles.button, StratusGUIStyles.smallLayout))
            {
                GenericMenu menu = menuFunction();
                menu.ShowAsContext();
            }
        }
Exemplo n.º 3
0
        static public ContextMenuKey CreateEmptyMenuKey(ContextMenuType type)
        {
            RegistryKey parent = Registry.ClassesRoot;

            switch (type)
            {
            case ContextMenuType.DesktopBackground: parent = parent.OpenSubKey("DesktopBackground"); break;

            case ContextMenuType.FolderBackground: parent = parent.OpenSubKey("Folder"); break;

            case ContextMenuType.Directory: parent = parent.OpenSubKey("Directory"); break;

            case ContextMenuType.File: parent = parent.OpenSubKey("*"); break;

            default:
                throw new Exception("Данный тип контекстного меню не поддерживается.");
            }

            if (parent == null)
            {
                throw new Exception("Неверно указаный суб ключ.");
            }

            parent = parent.OpenSubKey("shell", true);
            string      name = GetUniqueName(parent, "Новое_меню");
            RegistryKey RKey = parent.CreateSubKey(name);

            RKey.SetValue("MUIVerb", (object)name);
            RKey.SetValue("SubCommands", (object)"");

            RKey.CreateSubKey("shell");

            return(new ContextMenuKey(RKey));
        }
Exemplo n.º 4
0
        static public ObservableCollection <ContextMenuKey> GetKeys(ContextMenuType type)
        {
            RegistryKey container = Registry.ClassesRoot;

            switch (type)
            {
            case ContextMenuType.DesktopBackground: container = container.OpenSubKey("DesktopBackground"); break;

            case ContextMenuType.FolderBackground: container = container.OpenSubKey("Folder"); break;

            case ContextMenuType.Directory: container = container.OpenSubKey("Directory"); break;

            case ContextMenuType.File: container = container.OpenSubKey("*"); break;

            default:
                throw new Exception("Данный тип контекстного меню не поддерживается.");
            }

            if (container == null)
            {
                throw new Exception("Неверно указаный суб ключ.");
            }



            ObservableCollection <ContextMenuKey> keys = new ObservableCollection <ContextMenuKey>();

            string[] subKeys = container.GetSubKeyNames();

            foreach (string str in subKeys)
            {
                if (str == "shell" || str == "Shell")
                {
                    foreach (ContextMenuKey key in ReadContainer(container.OpenSubKey("shell")))
                    {
                        keys.Add(key);
                    }
                }
                else if (str == "shellex")
                {
                    foreach (ContextMenuKey key in ReadContainer(container.OpenSubKey("shellex").OpenSubKey("ContextMenuHandlers")))
                    {
                        keys.Add(key);
                    }
                }
                else
                {
                    Console.ForegroundColor = ConsoleColor.Red;
                    Console.WriteLine("Неизвестный ключ: " + str);
                    Console.ResetColor();

                    //throw new Exception("Неизвестный ключ.");
                }
            }



            return(keys);
        }
Exemplo n.º 5
0
 /// <summary>
 /// Initializes a new instance of <see cref="Syncfusion.UI.Xaml.Grid.GridContextMenuEventArgs"/> class.
 /// </summary>
 /// <param name="_contextMenu">
 /// Contains the context menu for the SfDataGrid.
 /// </param>
 /// <param name="_contextMenuInfo">
 /// Contains the information about the content menu. 
 /// </param>
 /// <param name="_rowColumnIndex">
 /// The corresponding rowcolumnindex where the shortcut menu is opened.
 /// </param>
 /// <param name="_contextMenuType">
 /// The corresponding type of the context menu.
 /// </param>
 /// <param name="originalSource">
 /// The source of the event.
 /// </param>
 public GridContextMenuEventArgs(ContextMenu _contextMenu, object _contextMenuInfo, RowColumnIndex _rowColumnIndex, ContextMenuType _contextMenuType, object originalSource = null)
     : base(originalSource)
 {
     ContextMenu = _contextMenu;
     ContextMenuInfo = _contextMenuInfo;
     RowColumnIndex = _rowColumnIndex;
     ContextMenuType = _contextMenuType;
 }
Exemplo n.º 6
0
 public ViewModel(ContextMenuType type)
 {
     if (type == ContextMenuType.None)
     {
         throw new Exception("input: ContextMenuType.none");
     }
     model           = new ContextMenu.NewMenuItemDIR.Model();
     ContextMenuKeys = model.GetTemplateKeys(type);
 }
Exemplo n.º 7
0
        public static void Delete(Rect position, string title, string thingToDeleteName, string typeName, Action onDeleted)
        {
            _onDeleted         = onDeleted;
            _thingToDeleteName = thingToDeleteName;
            _typeNameToDelete  = typeName;
            _type = ContextMenuType.Delete;

            Init(position, title);
        }
Exemplo n.º 8
0
        public static void ShowCreateGroup(Rect position, string title, Action <string> onGroupCreated)
        {
            _title = title;

            _onGroupCreated = onGroupCreated;
            _type           = ContextMenuType.CreateGroup;

            Init(position, title);
        }
Exemplo n.º 9
0
        public static void ShowCreateTalk(Rect position, string title, List <string> groups, Action <string, string> onTalkCreated)
        {
            _title = title;

            _onTalkCreated = onTalkCreated;
            _type          = ContextMenuType.CreateTalk;
            _subGroups     = groups.ToArray();

            Init(position, title);
        }
Exemplo n.º 10
0
        public void CallBack(ContextMenuType type, string name, string rootMapJson, string mapJson, string nodeJson)
        {
            switch (type)
            {
            case ContextMenuType.Author:
                RelatedContentPanelUtil.Instance.InvokeAuthorContextMenuCallback(name, rootMapJson, mapJson, nodeJson);
                break;

            case ContextMenuType.Viewer:
                RelatedContentPanelUtil.Instance.InvokeReaderContextMenuCallback(name, rootMapJson, mapJson, nodeJson);
                break;
            }
        }
 public void CallBack(ContextMenuType type, string name, string rootMapJson, string mapJson, string nodeJson)
 {
     switch (type)
     {
          case ContextMenuType.Author:
             RelatedContentPanelUtil.Instance.InvokeAuthorContextMenuCallback(name, rootMapJson, mapJson, nodeJson);
             break;
         case ContextMenuType.Viewer:
             RelatedContentPanelUtil.Instance.InvokeReaderContextMenuCallback(name, rootMapJson, mapJson, nodeJson);
             break;
     }
     
 }
Exemplo n.º 12
0
        public ObservableCollection <ContextMenuKey> Read_RegistryDirectory(ContextMenuType type, bool SHIFT)
        {
            if (type == ContextMenuType.None)
            {
                return(null);
            }
            else
            {
                ObservableCollection <ContextMenuKey> returnCollection = new ObservableCollection <ContextMenuKey>();
                RegistryKey RKCMT = Registry.ClassesRoot; //Registry Key Context Menu Type

                switch (type)
                {
                case ContextMenuType.DesktopBackground:     RKCMT = RKCMT.OpenSubKey("DesktopBackground");

                    //рабочий стол тоже является папкой и по этому часть ключей данной директории хранится в разделе 'Directory'
                    foreach (ContextMenuKey key in this.Read_RegistryDirectory(ContextMenuType.Directory, SHIFT))
                    {
                        key.Disabled = true;     //запрет на изменение ключей
                        returnCollection.Add(key);
                    }

                    break;

                case ContextMenuType.FolderBackground:      RKCMT = RKCMT.OpenSubKey("Folder"); break;

                case ContextMenuType.Directory:             RKCMT = RKCMT.OpenSubKey("Directory"); break;

                case ContextMenuType.File:                  RKCMT = RKCMT.OpenSubKey("*"); break;
                }

                RKCMT = RKCMT.OpenSubKey("Shell");
                foreach (string strkey in RKCMT.GetSubKeyNames())
                {
                    RegistryKey key_registry = RKCMT.OpenSubKey(strkey);
                    returnCollection.Add(new ContextMenuKey(key_registry));
                }

                if (SHIFT == false)
                {
                    return(this.RemoveExtendedKeys(returnCollection));
                }
                else
                {
                    return(returnCollection);
                }
            }
        }
Exemplo n.º 13
0
        public ObservableCollection <ContextMenuKey> GetTemplateKeys(ContextMenuType type)
        {
            switch (type)
            {
            case ContextMenuType.DesktopBackground:     return(GetTemplateKeys_DesktopBackground());

            case ContextMenuType.FolderBackground:      return(GetTemplateKeys_FolderBackground());

            case ContextMenuType.Directory:             return(GetTemplateKeys_Directory());

            case ContextMenuType.File:                  return(GetTemplateKeys_File());

            case ContextMenuType.None:                  return(null);
            }
            return(null); //Мини костыль. Ошибка: Не все ветви кода возвращают значение!
        }
Exemplo n.º 14
0
                public void AddContext(IContextMenuParams parameters)
                {
                    ContextMenuType flags = parameters.TypeFlags;

                    if (flags.HasFlag(ContextMenuType.Media) && parameters.HasImageContents)
                    {
                        types   |= ContextType.Image;
                        types   &= ~ContextType.Video;
                        mediaUrl = parameters.SourceUrl;
                    }

                    if (flags.HasFlag(ContextMenuType.Link))
                    {
                        types        |= ContextType.Link;
                        linkUrl       = parameters.LinkUrl;
                        unsafeLinkUrl = parameters.UnfilteredLinkUrl;
                    }
                }
Exemplo n.º 15
0
        public TreeNode addTCPSlaveNode(string text, object leafObject, ContextMenuType type, TreeNode node = null)
        {
            TreeNode retVal;

            if (node == null)
            {
                retVal     = navTreeView.Nodes.Add(text);
                retVal.Tag = leafObject;
            }
            else
            {
                retVal     = node.Nodes.Add(text);
                retVal.Tag = leafObject;
            }

            //add Context Menu
            switch (type)
            {
            case ContextMenuType.master:

                break;

            case ContextMenuType.slave:
                retVal.ContextMenuStrip = slaveContextMenuStrip;
                break;

            case ContextMenuType.slaveRoot:
                retVal.ContextMenuStrip = slaveRootContextMenuStrip;
                break;

            case ContextMenuType.masterRoot:
                break;
            }



            return(retVal);
        }
        public static void DrawContextMenu(GenericMenu menu, ContextMenuType style)
        {
            Texture texture = null;

            switch (style)
            {
            case ContextMenuType.Add:
                texture = StratusGUIStyles.addIcon;
                break;

            case ContextMenuType.Validation:
                texture = StratusGUIStyles.validateIcon;
                break;

            case ContextMenuType.Options:
                texture = StratusGUIStyles.optionsIcon;
                break;
            }
            if (GUILayout.Button(texture, StratusGUIStyles.smallLayout))
            {
                menu.ShowAsContext();
            }
        }
Exemplo n.º 17
0
 public ShowContextMenuEventArgs(Point location, ContextMenuType type)
 {
     this.Location = location;
     this.MenuType = type;
 }
Exemplo n.º 18
0
        //double timeToLive,
        public async static void Show(
            string message,
            string title,
            ContextMenuType type,
            double width  = 400,
            double height = 180,
            GeneralSystemWideMessage msgToPassAlong = null
            )
        {
            if (ContextMenuService._rootControl != null)
            {
                DispatchedHandler invokedHandler = new DispatchedHandler(() =>
                {
                    if (ContextMenuService._rootControl == null)
                    {
                        return;
                    }


                    //modal adorner
                    Rectangle rectModalAdorner           = new Rectangle();
                    rectModalAdorner.Fill                = new SolidColorBrush(Colors.Black);
                    rectModalAdorner.Opacity             = 0.4;
                    rectModalAdorner.HorizontalAlignment = HorizontalAlignment.Stretch;
                    rectModalAdorner.VerticalAlignment   = VerticalAlignment.Stretch;
                    rectModalAdorner.SetValue(Canvas.ZIndexProperty, -2);
                    ContextMenuService._rootControl.Children.Add(rectModalAdorner);


                    //message background
                    Rectangle rectBackground           = new Rectangle();
                    rectBackground.HorizontalAlignment = HorizontalAlignment.Stretch;
                    rectBackground.VerticalAlignment   = VerticalAlignment.Center;
                    rectBackground.Height = height + 80;
                    rectBackground.SetValue(Canvas.ZIndexProperty, -1);
                    rectBackground.SetBinding(Rectangle.FillProperty, new Windows.UI.Xaml.Data.Binding()
                    {
                        Path = new PropertyPath("UI.Theme.AccentBackground1")
                    });
                    ContextMenuService._rootControl.Children.Add(rectBackground);

                    ContextMenuService._rootControl.Visibility = Visibility.Visible;

                    //message
                    ContextMenuView view = new ContextMenuView(
                        message,
                        "",
                        msgToPassAlong: msgToPassAlong
                        );

                    view.Width  = width;
                    view.Height = height;
                    view.Margin = new Thickness(3);
                    view.HorizontalAlignment = HorizontalAlignment.Center;
                    view.VerticalAlignment   = VerticalAlignment.Center;

                    if (type == ContextMenuType.PhotoDetailFlickrUserPicture)
                    {
                        //view.LoadMainContent(new PhotoDetailFlickrUserPictureContextMenu());
                    }
                    else if (type == ContextMenuType.PhotoDetailFlickrCommentUserPicture)
                    {
                        //view.LoadMainContent(new PhotoDetailFlickrCommentUserPictureContextMenu() { MessageToPassAlong = msgToPassAlong });
                    }
                    else if (type == ContextMenuType.TreePublicFlickrUser)
                    {
                        //view.LoadMainContent(new PublicFlickrUserPictureContextMenu() { MessageToPassAlong = msgToPassAlong });
                    }
                    else if (type == ContextMenuType.SectionHeaderFlickrUser)
                    {
                        //view.LoadMainContent(new SectionHeaderPictureContextMenu() { MessageToPassAlong = msgToPassAlong });
                    }

                    view.Show();
                    ContextMenuService._rootControl.Children.Add(view);
                });

                await ContextMenuService._rootControl.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, invokedHandler);
            }
        }
Exemplo n.º 19
0
 public ContextMenuKey CreateMenuKey(ContextMenuType type)
 {
     return(ContextMenuKey.CreateEmptyMenuKey(type));
 }
Exemplo n.º 20
0
 /// <summary>
 /// Deserializes workflow markup into an ContextMenuType object
 /// </summary>
 /// <param name="xml">string workflow markup to deserialize</param>
 /// <param name="obj">Output ContextMenuType object</param>
 /// <param name="exception">output Exception value if deserialize failed</param>
 /// <returns>true if this XmlSerializer can deserialize the object; otherwise, false</returns>
 public static bool Deserialize(string xml, out ContextMenuType obj, out System.Exception exception) {
     exception = null;
     obj = default(ContextMenuType);
     try {
         obj = Deserialize(xml);
         return true;
     }
     catch (System.Exception ex) {
         exception = ex;
         return false;
     }
 }
 public ShowContextMenuEventArgs(Point location, ContextMenuType type)
 {
     this.Location = location;
     this.MenuType = type;
 }
Exemplo n.º 22
0
 public static bool Deserialize(string xml, out ContextMenuType obj) {
     System.Exception exception = null;
     return Deserialize(xml, out obj, out exception);
 }
Exemplo n.º 23
0
 /// <summary>
 /// Deserializes xml markup from file into an ContextMenuType object
 /// </summary>
 /// <param name="fileName">string xml file to load and deserialize</param>
 /// <param name="obj">Output ContextMenuType object</param>
 /// <param name="exception">output Exception value if deserialize failed</param>
 /// <returns>true if this XmlSerializer can deserialize the object; otherwise, false</returns>
 public static bool LoadFromFile(string fileName, out ContextMenuType obj, out System.Exception exception) {
     exception = null;
     obj = default(ContextMenuType);
     try {
         obj = LoadFromFile(fileName);
         return true;
     }
     catch (System.Exception ex) {
         exception = ex;
         return false;
     }
 }
Exemplo n.º 24
0
 public static bool LoadFromFile(string fileName, out ContextMenuType obj) {
     System.Exception exception = null;
     return LoadFromFile(fileName, out obj, out exception);
 }
Exemplo n.º 25
0
 public NewMenuItem(ContextMenuType type)
 {
     InitializeComponent();
     this.DataContext = new NewMenuItemDIR.ViewModel(type);
 }
Exemplo n.º 26
0
 public ContextMenuDisplayingEventArgs(DockWindow window, List <RadMenuItemBase> items, Point displayPos)
     : this(items, displayPos)
 {
     this.window   = window;
     this.menuType = ContextMenuType.DockWindow;
 }
Exemplo n.º 27
0
 public ContextMenuDisplayingEventArgs(DocumentTabStrip strip, List <RadMenuItemBase> items, Point displayPos)
     : this(items, displayPos)
 {
     this.documentStrip = strip;
     this.menuType      = ContextMenuType.ActiveWindowList;
 }
Exemplo n.º 28
0
        private string AddMenuAction(ContextMenuType menuType)
        {
            switch (menuType)
            {
                case ContextMenuType.Export:
                    return string.Format("href=\"#\" onclick=\"{0};return false;\"",
                                         Page.ClientScript.GetPostBackEventReference(this, "ExcelExportClick"));
                case ContextMenuType.About:
                return string.Format(
                        "class=\"wgaboutiframe\" title=\"About WebGrid\" href=\"http://webgrid.com/aboutwebgrid.htm\"");
                  
                case ContextMenuType.Help:
                    return string.Format(
                        "class=\"wghelpiframe\" title=\"WebGrid Help\" href=\"?showhelp=true&amp;gridid={0}\"",ID);
                case ContextMenuType.Print:
                    return string.Format(
                        "href=\"#\" onclick=\"javascript:$('#wgContent_{0}').jqprint();return false;\"", ID);

                case ContextMenuType.CollapsedGrid:

                    string collapsedGridScript = EnableCallBack
                                                     ? Asynchronous.GetCallbackEventReference(this, "CollapseGridClick",
                                                                                              false,
                                                                                              string.Empty,
                                                                                              string.Empty)
                                                     : Page.ClientScript.GetPostBackEventReference(this,
                                                                                                   "CollapseGridClick");
                    return string.Format("href=\"#\" onclick=\"{0};return false;\"", collapsedGridScript);
                case ContextMenuType.Refresh:
                    string refreshScript = EnableCallBack
                                               ? Asynchronous.GetCallbackEventReference(this, "refresh", false,
                                                                                        string.Empty,
                                                                                        string.Empty)
                                               : Page.ClientScript.GetPostBackEventReference(this, "refresh");
                    return string.Format("href=\"#\" onclick=\"{0};return false;\"", refreshScript);
                case ContextMenuType.ActiveSlaveGrid:
                    if (ActiveMenuSlaveGrid == null)
                        return "N/A";
                    string activeSlaveGridScript = EnableCallBack
                                               ? Asynchronous.GetCallbackEventReference(this, "SlaveGridClick!"+ActiveMenuSlaveGrid.ID, false,
                                                                                        string.Empty,
                                                                                        string.Empty)
                                               : Page.ClientScript.GetPostBackEventReference(this, "SlaveGridClick!" + ActiveMenuSlaveGrid.ID);
                    return string.Format("href=\"#\" onclick=\"{0};return false;\"", activeSlaveGridScript);
               }
            return null;
        }