Ejemplo n.º 1
0
        public MenuEntry FindDynamicMenuEntry(DynamicMenu menu)
        {
            foreach (var menuEntry in this.rootMenus)
            {
                if (menuEntry.DataContext is DynamicMenu && menuEntry.DataContext == menu)
                {
                    return(menuEntry);
                }

                foreach (var entry in menuEntry.Children.OfType <MenuEntry>())
                {
                    if (!(entry.DataContext is DynamicMenu dynamic))
                    {
                        continue;
                    }

                    var found = this.FindDynamicMenuEntry(dynamic);
                    if (found != null)
                    {
                        return(found);
                    }
                }
            }

            return(null);
        }
        public string GetHomeScreen()
        {
            string header;
            string delimiter;

            //clear the cached current dynamic menu selection value
            Session[DoubleOptSubscriptionUSSDProcessor.CurrentDynamicMenuKey] = null;

            CommonUtility.ReturnUSSDCampaignText(Session.Campaign.CampaignID, "rootheader", out header, out delimiter);

            MenuItem currentMenu = new MenuItem();
            string   menuData    = Menu.ShowMenu(0, Session.MainMenuId, ref currentMenu);

            CurrentMenu = currentMenu;
            Session.LastMenuAccessed = CurrentMenu;

            var services = new SubscriptionServiceInfo().ReturnDoubleOptSubscriptionServices();

            int           number      = 0;
            StringBuilder menuBuilder = new StringBuilder(string.Concat(Convert.ToString(menuData), Convert.ToString(header)));

            foreach (var serviceInfo in services)
            {
                number++;
                var dynamicMenu = new DynamicMenu()
                {
                    Number = number, Text = (String.IsNullOrEmpty(serviceInfo.DisplayName) ? serviceInfo.Name : serviceInfo.DisplayName), ServiceInfo = serviceInfo
                };

                menuBuilder.Append(string.Format("{0}: {1}\n", number, dynamicMenu.Text));

                dynamicMenuList.Add(dynamicMenu);
            }

            string termsMenuTitle;

            number++;

            CommonUtility.ReturnUSSDCampaignText(Session.Campaign.CampaignID, "termstitle", out termsMenuTitle, out delimiter);
            menuBuilder.Append(string.Format("{0}{1}", number, termsMenuTitle));
            dynamicMenuList.Add(new DynamicMenu()
            {
                Number = number, Text = termsMenuTitle, ServiceInfo = null
            });

            string adminMenuTitle;

            number++;

            CommonUtility.ReturnUSSDCampaignText(Session.Campaign.CampaignID, "admintitle", out adminMenuTitle, out delimiter);
            menuBuilder.Append(string.Format("{0}{1}", number, adminMenuTitle));
            dynamicMenuList.Add(new DynamicMenu()
            {
                Number = number, Text = termsMenuTitle, ServiceInfo = null
            });

            Session[DoubleOptSubscriptionUSSDProcessor.DynamicMenuKey] = dynamicMenuList;

            return(menuBuilder.ToString());
        }
Ejemplo n.º 3
0
        public override bool Initialize(IPluginHost host)
        {
            Debug.Assert(host != null);
            if (host == null)
            {
                return(false);
            }
            m_host = host;
            global_window_manager_window_added_handler = new EventHandler <GwmWindowEventArgs>(GlobalWindowManager_WindowAdded);
            GlobalWindowManager.WindowAdded           += global_window_manager_window_added_handler;
            ToolStripItemCollection tsMenu = m_host.MainWindow.EntryContextMenu.Items;

            m_tsmi_set_template_parent        = new ToolStripMenuItem();
            m_tsmi_set_template_parent.Text   = "Set Template Parent";
            m_tsmi_set_template_parent.Click += m_tsmi_set_template_parent_Click;
            m_tsmi_set_template_parent.Image  = Resources.Resources.B16x16_KOrganizer;
            tsMenu.Add(m_tsmi_set_template_parent);
            m_tsmi_copy_template_string       = new ToolStripMenuItem();
            m_tsmi_copy_template_string.Text  = "Copy Template String";
            m_tsmi_copy_template_string.Image = Resources.Resources.B16x16_KOrganizer;
            m_dynCustomStrings            = new DynamicMenu(m_tsmi_copy_template_string);
            m_dynCustomStrings.MenuClick += m_dynCustomStrings_MenuClick;
            tsMenu.Add(m_tsmi_copy_template_string);

            entry_context_menu_opening_handler          = new System.ComponentModel.CancelEventHandler(EntryContextMenu_Opening);
            m_host.MainWindow.EntryContextMenu.Opening += entry_context_menu_opening_handler;
            entry_templates_entry_creating_handler      = new EventHandler <TemplateEntryEventArgs>(EntryTemplates_EntryCreating);
            EntryTemplates.EntryCreating += entry_templates_entry_creating_handler;

            return(true);
        }
Ejemplo n.º 4
0
        public override bool Initialize(IPluginHost host)
        {
            Contract.Requires(host != null);

            this.host = host;

            ctxEntryShowQRCode = new ToolStripMenuItem
            {
                Image = Properties.Resources.icon,
                Text  = CONTEXT_MENU_ITEM_LABEL
            };
            dynQRCodes            = new DynamicMenu(ctxEntryShowQRCode.DropDownItems);
            dynQRCodes.MenuClick += OnShowQRCode;

            var insertAfterIndex = host.MainWindow.EntryContextMenu.Items.IndexOfKey(INSERT_AFTER_ENTRY_KEY);

            if (insertAfterIndex != -1)
            {
                //insert after "Save Attachements"
                host.MainWindow.EntryContextMenu.Items.Insert(insertAfterIndex + 1, ctxEntryShowQRCode);
            }
            else
            {
                //add at the end
                host.MainWindow.EntryContextMenu.Items.Add(ctxEntryShowQRCode);
            }
            host.MainWindow.EntryContextMenu.Opening += OnEntryContextMenuOpening;

            return(true);
        }
Ejemplo n.º 5
0
        private async void ChooseSourceBranch(object sender, EventArgs e)
        {
            await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync();

            if (!(await _package.GetServiceAsync(typeof(DTE)) is DTE dte))
            {
                return;
            }
            if (string.IsNullOrEmpty(dte.Solution.FullName))
            {
                return;
            }
            var solutionDir = Path.GetDirectoryName(dte.Solution.FullName);
            var menu        = new DynamicMenu();

            menu.Items.AddRange(GenerateMenuItems(solutionDir));
            menu.ItemClick += (o, s) =>
            {
                var config = new Config {
                    TargetBranch = (string)o.Tag
                };
                config.Save(solutionDir);
            };
            menu.Show();
        }
Ejemplo n.º 6
0
 private void buildNode(IList <DynamicMenu> menus, SiteMapNodeHelper parent)
 {
     if (parent == null)
     {
         return;
     }
     if (menus == null)
     {
         return;
     }
     for (int i = 0; i < menus.Count; i++)
     {
         DynamicMenu menu = menus[i];
         if (menu.Show && menu.SeqNo >= 0)
         {
             SiteMapNodeHelper child = new SiteMapNodeHelper(this, menu.Id, menu.Code, menu.PageCode, menu.LinkURL, null);
             AddNode(child, parent);
             if (menu.Children.Count > 0)
             {
                 //child.Url = "";
                 buildNode(menu.Children, child);
             }
         }
     }
 }
Ejemplo n.º 7
0
        /// <summary>
        ///     Setups the Multi-KnockUp Menu
        /// </summary>
        private void SetupMultiKnockupMenu()
        {
            var selecter =
                new MenuItem("Mode", "Mode").SetValue(new StringList(new[] { "Custom", "Disabled" }, 0));

            var custom = new List <MenuItem>()
            {
                new MenuItem("BuffState", "Only if: ").SetValue(
                    new StringList(new[] { "Q3 (Stacked)", "Not Stacked", "Always" })),
                new MenuItem("MinHitAOECustom", "Min HitCount for AOE").SetValue(new Slider(2, 1, 5)),
            };

            var pathBased = new List <MenuItem>()
            {
                new MenuItem(
                    "DisclaimerPathBased",
                    "[Experimental] Assembly will try to decide based on pathing"),
                new MenuItem("BuffStatePathBased", "Only if: ").SetValue(
                    new StringList(new[] { "Q3 (Stacked)", "Not Stacked", "Always" })),
                new MenuItem("MinHitAOEPathBased", "Min HitCount for AOE").SetValue(
                    new Slider(2, 1, 5)),
                new MenuItem("SegmentAmount", "Amount of calculations: ").SetValue(
                    new Slider(50, 1, 500)),
                new MenuItem("PriorityMode", "Priority/Decisison MOde: ").SetValue(
                    new StringList(new[] { "ChampionYasuo Priority (TargetSelector)", "TODO: Killable" })),
            };

            var dynamicMenu = new DynamicMenu(this.Menu, "Multi-Knockup Settings", selecter, new[] { custom });

            dynamicMenu.Initialize();
        }
Ejemplo n.º 8
0
        private void UpdateDynamicMenus()
        {
            DynamicMenu newMenu = null;

            if (docManager.HasDocument)
            {
                newMenu = docManager.ActiveDocument.GetDynamicMenu();
            }

            if (newMenu != dynamicMenu)
            {
                if (dynamicMenu != null)
                {
                    foreach (ToolStripMenuItem menuItem in dynamicMenu)
                    {
                        MainMenuStrip.Items.Remove(menuItem);
                    }
                    ToolStrip toolStrip = dynamicMenu.GetToolStrip();
                    if (toolStrip != null)
                    {
                        toolStripContainer.TopToolStripPanel.Controls.Remove(toolStrip);
                    }
                    dynamicMenu.SetReference(null);
                    if (dynamicMenu is DiagramDynamicMenu)
                    {
                        (dynamicMenu as DiagramDynamicMenu).CodeGeneratorUIHandler = this;
                    }
                }
                if (newMenu != null)
                {
                    int preferredIndex = newMenu.PreferredIndex;
                    if (preferredIndex < 0)
                    {
                        preferredIndex = 3;
                    }
                    foreach (ToolStripMenuItem menuItem in newMenu)
                    {
                        MainMenuStrip.Items.Insert(preferredIndex++, menuItem);
                    }
                    ToolStrip toolStrip = newMenu.GetToolStrip();
                    if (toolStrip != null)
                    {
                        toolStrip.Top  = standardToolStrip.Top;
                        toolStrip.Left = standardToolStrip.Right;
                        toolStripContainer.TopToolStripPanel.Controls.Add(toolStrip);
                    }
                    if (newMenu is DiagramDynamicMenu)
                    {
                        (newMenu as DiagramDynamicMenu).CodeGeneratorUIHandler = this;
                    }
                }
                dynamicMenu = newMenu;
            }
        }
Ejemplo n.º 9
0
        internal static void BuildOpenWithMenu(DynamicMenu dm, string strItem,
                                               ProtectedBinary pb, bool bReadOnly)
        {
            if (dm == null)
            {
                Debug.Assert(false); return;
            }
            dm.Clear();

            if (string.IsNullOrEmpty(strItem))
            {
                Debug.Assert(false); return;
            }
            if (pb == null)
            {
                Debug.Assert(false); return;
            }

            byte[] pbData = pb.ReadData();
            if (pbData == null)
            {
                Debug.Assert(false); return;
            }

            BinaryDataClass bdc = BinaryDataClassifier.Classify(strItem, pbData);

            BinaryDataOpenOptions oo = new BinaryDataOpenOptions();

            oo.Handler = BinaryDataHandler.InternalViewer;
            dm.AddItem(KPRes.InternalViewer, Properties.Resources.B16x16_View_Detailed, oo);

            oo         = new BinaryDataOpenOptions();
            oo.Handler = BinaryDataHandler.InternalEditor;
            ToolStripMenuItem tsmiIntEditor = dm.AddItem(KPRes.InternalEditor,
                                                         Properties.Resources.B16x16_View_Detailed, oo);

            oo         = new BinaryDataOpenOptions();
            oo.Handler = BinaryDataHandler.ExternalApp;
            ToolStripMenuItem tsmiExt = dm.AddItem(KPRes.ExternalApp,
                                                   Properties.Resources.B16x16_Make_KDevelop, oo);

            if (!DataEditorForm.SupportsDataType(bdc) || bReadOnly)
            {
                tsmiIntEditor.Enabled = false;
            }
            if (bReadOnly)
            {
                tsmiExt.Enabled = false;
            }
        }
Ejemplo n.º 10
0
        private void init_pwgen_button()
        {
            m_ctxPwGenOpen          = new ToolStripMenuItem();
            m_ctxPwGenSep0          = new ToolStripSeparator();
            m_ctxPwGenProfiles      = new ToolStripMenuItem();
            m_ctxPwGenProfiles.Name = "m_ctxPwGenProfiles";
            m_ctxPwGenProfiles.Size = new Size(208, 22);
            m_ctxPwGenProfiles.Text = "Generate Using Profile";
            m_btnGenPw          = new Button();
            m_btnGenPw.Image    = DpiUtil.ScaleImage(Resources.Resources.B15x13_KGPG_Gen, false);
            m_btnGenPw.Location = new Point(423, 90);

            m_btnGenPw.Size = new Size(DpiUtil.ScaleIntX(32), DpiUtil.ScaleIntY(23));
            m_btnGenPw.UseVisualStyleBackColor = true;
            m_btnGenPw.Click           += OnPwGenClick;
            m_ctxPwGen                  = new ContextMenuStrip();
            m_dynGenProfiles            = new DynamicMenu(m_ctxPwGenProfiles);
            m_dynGenProfiles.MenuClick += OnProfilesDynamicMenuClick;

            m_ctxPwGen.Items.AddRange(new ToolStripItem[] {
                m_ctxPwGenOpen,
                m_ctxPwGenSep0,
                m_ctxPwGenProfiles
            });
            m_ctxPwGen.Name = "m_ctxPwGen";
            m_ctxPwGen.Size = new Size(209, 54);
            //
            // m_ctxPwGenOpen
            //
            m_ctxPwGenOpen.Image  = Resources.Resources.B16x16_KGPG_Gen;
            m_ctxPwGenOpen.Name   = "m_ctxPwGenOpen";
            m_ctxPwGenOpen.Size   = new Size(208, 22);
            m_ctxPwGenOpen.Text   = "&Open Password Generator...";
            m_ctxPwGenOpen.Click += OnPwGenOpen;
            //
            // m_ctxPwGenSep0
            //
            m_ctxPwGenSep0.Name = "m_ctxPwGenSep0";
            m_ctxPwGenSep0.Size = new Size(205, 6);
            //
            // m_ctxPwGenProfiles
            //
            m_ctxPwGenProfiles.Name = "m_ctxPwGenProfiles";
            m_ctxPwGenProfiles.Size = new Size(208, 22);
            m_ctxPwGenProfiles.Text = "Generate Using Profile";
        }
Ejemplo n.º 11
0
        /// <summary>
        ///     Setups the Stack Menu.
        /// </summary>
        private void SetupStackingMenu()
        {
            var selecter =
                new MenuItem("Mode", "Mode").SetValue(
                    new StringList(new[] { "Custom", "PathBase Based", "Disabled" }));

            var custom = new List <MenuItem>()
            {
                new MenuItem("MinDistance", "Don't Stack if Distance to enemy <= ").SetValue(
                    new Slider(900, 0, 4000)),
                new MenuItem("MaxDistance", "Don't Stack if Distance to enemy >= ").SetValue(
                    new Slider(1500, 0, 4000)),
                new MenuItem("MaxCooldownQ", "Don't Stack if Q Cooldown is >= (milliseconds)").SetValue
                    (new Slider(1700, 1333, 5000)),
                new MenuItem("CarePath", "Don't kill units in SweepingBlade PathBase").SetValue(true),
            };

            var dynamicMenu = new DynamicMenu(this.Menu, "Stack-Settings", selecter, new[] { custom });

            dynamicMenu.Initialize();
        }
Ejemplo n.º 12
0
        public override ToolStripMenuItem GetMenuItem(PluginMenuType t)
        {
            if (t == PluginMenuType.Entry)
            {
                var item = new ToolStripMenuItem
                {
                    Image = Properties.Resources.icon,
                    Text  = CONTEXT_MENU_ITEM_LABEL
                };
                item.DropDownOpening += OnDropDownOpening;
                item.DropDownItems.Add("dummy");                 // Subitems get filled in OnDropDownOpening. The dummy item is necessary to show the "there is more" arrow.

                var dynamicMenu = new DynamicMenu(item.DropDownItems);
                dynamicMenu.MenuClick += OnShowQRCode;

                item.Tag = dynamicMenu;

                return(item);
            }

            return(null);
        }
Ejemplo n.º 13
0
		private void UpdateDynamicMenus()
		{
			DynamicMenu newMenu = null;

			if (docManager.HasDocument)
				newMenu = docManager.ActiveDocument.GetDynamicMenu();

			if (newMenu != dynamicMenu)
			{
				if (dynamicMenu != null)
				{
					foreach (ToolStripMenuItem menuItem in dynamicMenu)
					{
						MainMenuStrip.Items.Remove(menuItem);
					}
					ToolStrip toolStrip = dynamicMenu.GetToolStrip();
					if (toolStrip != null)
						toolStripContainer.TopToolStripPanel.Controls.Remove(toolStrip);
					dynamicMenu.SetReference(null);
				}
				if (newMenu != null)
				{
					int preferredIndex = newMenu.PreferredIndex;
					if (preferredIndex < 0)
						preferredIndex = 3;
					foreach (ToolStripMenuItem menuItem in newMenu)
					{
						MainMenuStrip.Items.Insert(preferredIndex++, menuItem);
					}
					ToolStrip toolStrip = newMenu.GetToolStrip();
					if (toolStrip != null)
					{
						toolStrip.Top = standardToolStrip.Top;
						toolStrip.Left = standardToolStrip.Right;
						toolStripContainer.TopToolStripPanel.Controls.Add(toolStrip);
					}
				}
				dynamicMenu = newMenu;
			}
		}
Ejemplo n.º 14
0
 public ActionResult GetTfatMenuJSON(string mProjectCode)
 {
     return(Json(DynamicMenu.XGetMenu(mProjectCode), JsonRequestBehavior.AllowGet));
 }
Ejemplo n.º 15
0
        /// <summary>
        ///     Adds all menu items.
        /// </summary>
        public void Generate()
        {
            var selecter = new MenuItem("Mode", "Dash to: ").SetValue(new StringList(new[] { "Mouse", "Enemy" }));

            var mouse = new List <MenuItem>()
            {
            };

            var enemy = new List <MenuItem>()
            {
                new MenuItem("Prediction", "Use Prediction").SetValue(true)
                .SetTooltip("The assembly will try to E to the enemy predicted position."),
                new MenuItem("PredictionEnhanced", "Prediction -> Two PathBase System").SetValue(true)
                .SetTooltip("The assembly will try to E to the enemy predicted position."),
                new MenuItem("MinCursorDistance", "Min Cursor Distance to target").SetValue(
                    new Slider(600, 50, 2000)),
            };

            this.dynamicMenu = new DynamicMenu(this.Menu, this.DisplayName, selecter, new[] { mouse, enemy });

            this.dynamicMenu.Initialize();

            var both = new List <MenuItem>()
            {
                new MenuItem("DontDashUnderTurret", "Don't dash under turret").SetValue(true),
                new MenuItem("AutoWalkToDash", "[Experimental] Auto-Walk to dash").SetValue(true)
                .SetTooltip(
                    "If this is enabled the assembly will auto-walk behind a unit to dash over it."),
                new MenuItem("AutoDashing", "[Experimental] Auto-Dash dashable PathBase (Dashing-PathBase)")
                .SetValue(true)
                .SetTooltip(
                    "If this is enabled the assembly will automatic pathfind and walk to the end of the PathBase. This is a basic feature of pathfinding."),
                new MenuItem("AutoWalking", "[Experimental] Auto-Walk non-dashable PathBase (Walking-PathBase)")
                .SetValue(false)
                .SetTooltip(
                    "If this is enabled the assembly will automatic pathfind and walk to the end of the PathBase. If you like to have maximum control or your champion disable this."),
                new MenuItem("PathAroundSkillShots", "[Experimental] Try to PathBase around Skillshots")
                .SetValue(true)
                .SetTooltip(
                    "if this is enabled, the assembly will PathBase around a skillshot if a PathBase is given."),
                new MenuItem("Enabled", "Enabled").SetValue(true),
            };

            this.blacklistMenu = new BlacklistMenu(this.dynamicMenu.AttachedMenu, "Blacklist");

            foreach (var item in both)
            {
                item.Name = this.dynamicMenu.AttachedMenu.Name + item.Name;

                this.dynamicMenu.AttachedMenu.AddItem(item);
            }

            foreach (var item in this.dynamicMenu.AttachedMenu.Items)
            {
                if (item.Name == "Mode")
                {
                    var stringarray = item.GetValue <StringList>().SList;

                    var id = 0;

                    for (var i = 0; i < stringarray.Count(); i++)
                    {
                        if (stringarray[i] == "Enemy")
                        {
                            id = i + 1;
                        }
                    }

                    foreach (var item2 in this.blacklistMenu.AttachedMenu.Items)
                    {
                        item2.SetTag(id);
                    }

                    break;
                }
            }

            this.Settings          = this.dynamicMenu.AttachedMenu;
            this.Blacklist         = this.blacklistMenu.AttachedMenu;
            this.BlacklistedHeroes = this.blacklistMenu.BlacklistedHeroes;
        }