Exemple #1
0
        public override void Initialize()
        {
            var viewMenuItem     = Shell.MainMenu.First(mi => mi.Name == "View");
            var graphicsMenuItem = new MenuItem("Graphics");

            viewMenuItem.Children.Add(graphicsMenuItem);
            viewMenuItem.Children.Add(new MenuItemSeparator());

            graphicsMenuItem.Add(new MenuItem("Graphics Event List", OpenTool <GraphicsEventListViewModel>));
            graphicsMenuItem.Add(new MenuItem("Graphics Pixel History", OpenTool <GraphicsPixelHistoryViewModel>));
            graphicsMenuItem.Add(new MenuItem("Graphics Pipeline Stages", OpenTool <GraphicsPipelineStagesViewModel>));
            graphicsMenuItem.Add(new MenuItem("Graphics Object Table", OpenTool <GraphicsObjectTableViewModel>));
        }
Exemple #2
0
        void Tableview_ButtonReleaseEvent(object o, ButtonReleaseEventArgs args)
        {
            if (args.Event.Button == 3 && ViewModel.PopupActions.Any())
            {
                var  selected  = GetSelectedItems();
                Menu popupMenu = new Menu();
                foreach (var popupAction in ViewModel.PopupActions)
                {
                    var item = new MenuItem(popupAction.Title);
                    item.Sensitive  = popupAction.GetSensitivity(selected);
                    item.Visible    = popupAction.GetVisibility(selected);
                    item.Activated += (sender, e) => { popupAction.ExecuteAction(selected); };
                    if (popupAction.ChildActions.Any())
                    {
                        foreach (var childAction in popupAction.ChildActions)
                        {
                            item.Add(CreatePopupMenuItem(childAction));
                        }
                    }
                    popupMenu.Add(item);
                }

                if (popupMenu.Children.Length == 0)
                {
                    return;
                }

                popupMenu.Show();
                popupMenu.Popup();
            }
        }
Exemple #3
0
        void SetupMenu()
        {
            m = new Menu();
            for (int i = 0; i < stateToSymbol.Length; i++)
            {
                MenuItem mi  = new MenuItem();
                Label    lbl = new Label();
                lbl.Markup = "<b>" + stateToSymbol[i] + "</b> " +
                             stateToDesc[i];
                lbl.Xalign = 0;
                mi.Add(lbl);
                mi.Name              = i.ToString();
                mi.ButtonPressEvent += delegate(object o, ButtonPressEventArgs a) {
                    if (a.Event.Button != 1 || a.Event.Type != EventType.ButtonPress)
                    {
                        return;
                    }
                    int j = int.Parse((o as Widget).Name);
                    rd.JudgeState = (RoundDebater.JudgeStateType)j;
                    UpdateGui();
                    if (Changed != null)
                    {
                        Changed(this, EventArgs.Empty);
                    }
                };
                m.Add(mi);
            }

            m.ShowAll();
            m.AttachToWidget(this, null);
        }
Exemple #4
0
        private MenuItem CreateMenuItemWidget(IJournalAction action)
        {
            MenuItem menuItem = new MenuItem(action.Title);

            menuItem.Activated += (sender, e) => {
                action.ExecuteAction(GetSelectedItems());
            };

            actionsSensitivity.Add(() => {
                menuItem.Sensitive = action.GetSensitivity(GetSelectedItems());
            });

            actionsVisibility.Add(() => {
                menuItem.Visible = action.GetVisibility(GetSelectedItems());
            });

            if (action.ChildActions.Any())
            {
                foreach (var childAction in action.ChildActions)
                {
                    menuItem.Add(CreateMenuItemWidget(childAction));
                }
            }

            return(menuItem);
        }
Exemple #5
0
        private void ReadMenuItemChoice(XElement e)
        {
            if (MenuItem == null)
            {
                MenuItem = new List <Dictionary <string, int?> >();
            }

            var menusetattr = e.Attribute("set");

            if (menusetattr != null)
            {
                menuset = menusetattr.Value.ToInt();
            }

            while (MenuItem.Count - 1 < menuset)
            {
                MenuItem.Add(new Dictionary <string, int?>());
            }

            var aname  = e.Attribute("name");
            var number = e.Attribute("number");

            if (aname != null && number != null)
            {
                MenuItem[menuset].Add(aname.Value, number.Value.ToInt());
            }
        }
Exemple #6
0
        static void Main(string[] args)
        {
            menu = new Menu()
            {
                new MenuItem("Colors")
                {
                    new MenuItem("Red", () => DrawLine(ConsoleColor.Red)),
                    new MenuItem("Green", () => DrawLine(ConsoleColor.Green)),
                    new MenuItem("Blue", () => DrawLine(ConsoleColor.Blue))
                },
                new MenuItem("Sounds")
                {
                    new MenuItem("Low", () => Beep(1000)),
                    new MenuItem("Medium", () => Beep(2000)),
                    new MenuItem("Hight", () => Beep(4000))
                },
                new MenuItem("Random number", PrintRandomNumber),
            };
            menu.Add(new MenuItem("Exit", () => menu.Hide()));

            menu["Colors"].Add(new MenuItem("Yellow", () => DrawLine(ConsoleColor.Yellow)));
            menu[1].Add(new MenuItem("Insane", () => Beep(15000)));

            var selfReferenceItem = new MenuItem("Abyss");

            selfReferenceItem.Add(selfReferenceItem);
            menu.Insert(3, selfReferenceItem);

            menu.ShowNavigationBar  = true;
            menu.CyclicScrolling    = true;
            menu.HorizontalAligment = MenuHorizontalAligment.Center;
            menu.Show();
            Console.ReadKey(true);
        }
Exemple #7
0
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            gui.Initialize();
            _textBox          = new TextBox(this, gui);
            _label            = new Label(this, gui);
            _textBox.X        = 0;
            _textBox.Y        = this.Window.ClientBounds.Height - _textBox.Height;
            _textBox.KeyDown += new KeyDownHandler(_textBox_KeyDown);


            _messageBox = new MessageBox(this, gui, "Congratulation! Your rubik's cube is solved.", "RubiksCube", MessageBoxButtons.OK, MessageBoxType.Info);
            this.gui.Add(_textBox);
            this.gui.Add(_label);

            this.menuBar = new MenuBar(this, gui);
            MenuItem fileMenu = new MenuItem(this, gui);

            fileMenu.Text           = "File";
            this.startMenuItem      = new MenuItem(this, gui);
            this.startMenuItem.Text = "Start Game";
            fileMenu.Add(this.startMenuItem);

            this.solvedMenuItem      = new MenuItem(this, gui);
            this.solvedMenuItem.Text = "Show Solved";
            fileMenu.Add(this.solvedMenuItem);

            this.exitMenuItem      = new MenuItem(this, gui);
            this.exitMenuItem.Text = "Exit";
            fileMenu.Add(this.exitMenuItem);

            menuBar.Add(fileMenu);
            this.gui.Add(menuBar);

            _label.Y    = menuBar.Height;
            _label.X    = 0;
            _label.Text = string.Empty;

            startMenuItem.Click  += new ClickHandler(startMenuItem_Click);
            exitMenuItem.Click   += new ClickHandler(exitMenuItem_Click);
            solvedMenuItem.Click += new ClickHandler(solvedMenuItem_Click);

            _input = new Input();


            ResetCamera();
            base.Initialize();
        }
Exemple #8
0
        public decimal TotalOther()
        {
            decimal amt = 0;

            if (Parent.SupportMissionTrip)
            {
                amt += MissionTripSupportGoer ?? 0;
                amt += MissionTripSupportGeneral ?? 0;
            }
            else
            {
                foreach (var ask in setting.AskItems)
                {
                    switch (ask.Type)
                    {
                    case "AskMenu":
                        while (MenuItem.Count - 1 < ask.UniqueId)
                        {
                            MenuItem.Add(new Dictionary <string, int?>());
                        }
                        amt += ((AskMenu)ask).MenuItemsChosen(MenuItem[ask.UniqueId]).Sum(m => m.number * m.amt);
                        break;

                    case "AskDropdown":
                        var cc = ((AskDropdown)ask).SmallGroupChoice(option);
                        if (cc != null)
                        {
                            amt += cc.Fee ?? 0;
                        }
                        break;

                    case "AskCheckboxes":
                        if (((AskCheckboxes)ask).list.Any(vv => vv.Fee > 0))
                        {
                            amt += ((AskCheckboxes)ask).CheckboxItemsChosen(Checkbox).Sum(c => c.Fee ?? 0);
                        }
                        break;
                    }
                }
                if (org.LastDayBeforeExtra.HasValue && setting.ExtraFee.HasValue)
                {
                    if (Util.Now > org.LastDayBeforeExtra.Value.AddHours(24))
                    {
                        amt += setting.ExtraFee.Value;
                    }
                }
                if (FundItem.Count > 0)
                {
                    amt += FundItemsChosen().Sum(f => f.Amt);
                }
                var askSize = setting.AskItems.FirstOrDefault(aa => aa is AskSize) as AskSize;
                if (askSize != null && shirtsize != "lastyear" && askSize.Fee.HasValue)
                {
                    amt += askSize.Fee.Value;
                }
            }
            return(amt);
        }
Exemple #9
0
        MenuItem NoLabelsMenuItem()
        {
            var item = new MenuItem();

            item.Add(new Label {
                Text = "No Groups"
            });
            item.Sensitive = false;
            return(item);
        }
Exemple #10
0
        private MenuItem CreateBackOfficeMenu()
        {
            var mnu = new MenuItem();

            mnu.Header = "Back Office Maintenance";
            mnu.AddLauncher(VM.CollectorsCmd);
            mnu.Add("Deprecated (do NOT use)");
            mnu.AddLauncher(VM.LeasesCmd);
            return(mnu);
        }
Exemple #11
0
    public MenuItem Add(string path, Action action, bool enabled = true)
    {
        MenuItem ret = MenuItem.Add(Items, path, action);

        if (ret == null)
        {
            return(null);
        }
        ret.Enabled = enabled;
        return(ret);
    }
Exemple #12
0
        /// <summary>
        /// GtkImageMenuItem has been deprecated since GTK+ 3.10. If you want to
        /// display an icon in a menu item, you should use GtkMenuItem and pack a GtkBox
        /// with a GtkImage and a GtkLabel instead.
        /// </summary>
        /// <param name="text">Text to be displayed on the menu item.</param>
        /// <param name="image">Image to be displayed on the menu item.</param>
        public static MenuItem CreateImageMenuItem(string text, Image image)
        {
            HBox     container = new HBox();
            Label    label     = new Label(text);
            MenuItem imageItem = new MenuItem();

            container.PackStart(image, false, false, 0);
            container.PackStart(label, false, false, 0);
            imageItem.Add(container);

            return(imageItem);
        }
        public IList <IMenuItem> GetMainMenu()
        {
            var menu = new List <IMenuItem>(5);

            //HOME
            var home  = new MenuItem("1", "Home", null, null);
            var home1 = new MenuItem("1.1", "Search", new Uri("/Silverblade5;component/Assets/Images/Menu/Find_16x16.png", UriKind.RelativeOrAbsolute), new Uri("/Home/SearchView", UriKind.Relative));
            var home2 = new MenuItem("1.2", "Tasks", new Uri("/Silverblade5;component/Assets/Images/Menu/mail-icon.png", UriKind.Relative), new Uri("Views/Clients/Portfolios.xaml", UriKind.Relative));
            var home3 = new MenuItem("1.3", "Maintenance", new Uri("/Silverblade5;component/Assets/Images/Menu/logo.png", UriKind.Relative), new Uri("Views/Clients/Assets.xaml", UriKind.Relative));

            home.Add(home1, home2, home3);

            //CLIENTS
            var clients  = new MenuItem("1", "Clients", null, null);
            var clients1 = new MenuItem("1.1", "Details", new Uri("/Silverblade5;component/Assets/Images/Menu/client-icon.png", UriKind.Relative), new Uri("/Clients/DetailsView", UriKind.Relative));
            var clients2 = new MenuItem("1.2", "Portfolios", new Uri("/Silverblade5;component/Assets/Images/Menu/report2-icon.png", UriKind.Relative), new Uri("Views/Clients/Portfolios.xaml", UriKind.Relative));
            var clients3 = new MenuItem("1.3", "Assets", new Uri("/Silverblade5;component/Assets/Images/Menu/coins-icon.png", UriKind.Relative), new Uri("Views/Clients/Assets.xaml", UriKind.Relative));

            clients.Add(clients1, clients2, clients3);


            //REPORTS
            var reports  = new MenuItem("2", "Reports", null, null);
            var reports1 = new MenuItem("2.1", "View", new Uri("/Silverblade5;component/Assets/Images/Menu/chart-icon.png", UriKind.Relative), new Uri("Views/Reports/Details.xaml", UriKind.Relative));
            var reports2 = new MenuItem("2.2", "Export", new Uri("/Silverblade5;component/Assets/Images/Menu/export-icon.png", UriKind.Relative), new Uri("Views/Reports/Portfolios.xaml", UriKind.Relative));
            var reports3 = new MenuItem("2.3", "Analyse", new Uri("/Silverblade5;component/Assets/Images/Menu/calculator-icon.png", UriKind.Relative), new Uri("Views/Reports/Assets.xaml", UriKind.Relative));

            reports.Add(reports1, reports2, reports3);

            //REALTIME
            var realtime  = new MenuItem("3", "Real Time", null, null);
            var realtime1 = new MenuItem("3.1", "Sockets", new Uri("/Silverblade5;component/Assets/Images/Menu/socket-icon.png", UriKind.Relative), new Uri("Views/Realtime/Details.xaml", UriKind.Relative));
            var realtime2 = new MenuItem("3.2", "Cloud", new Uri("/Silverblade5;component/Assets/Images/Menu/world-icon.png", UriKind.Relative), new Uri("Views/Realtime/Portfolios.xaml", UriKind.Relative));
            var realtime3 = new MenuItem("3.3", "Integration", new Uri("/Silverblade5;component/Assets/Images/Menu/transaction-icon.png", UriKind.Relative), new Uri("Views/Realtime/Assets.xaml", UriKind.Relative));

            realtime.Add(realtime1, realtime2, realtime3);

            //PLUGINS
            var plugins  = new MenuItem("4", "Plugins", null, null);
            var plugins1 = new MenuItem("4.1", "DOS", new Uri("/Silverblade5;component/Assets/Images/Menu/dos-icon.png", UriKind.Relative), new Uri("Views/Plugins/Details.xaml", UriKind.Relative));
            var plugins2 = new MenuItem("4.2", ".NET", new Uri("/Silverblade5;component/Assets/Images/Menu/dotnet-icon.png", UriKind.Relative), new Uri("Views/Plugins/Portfolios.xaml", UriKind.Relative));
            var plugins3 = new MenuItem("4.3", "Cloud", new Uri("/Silverblade5;component/Assets/Images/Menu/report1-icon.png", UriKind.Relative), new Uri("Views/Plugins/Assets.xaml", UriKind.Relative));

            plugins.Add(plugins1, plugins2, plugins3);

            menu.AddRange(new List <IMenuItem>(5)
            {
                home, clients, reports, realtime, plugins
            });

            return(menu);
        }
Exemple #14
0
        private MenuItem CreatePopupMenuItem(IJournalAction journalAction)
        {
            MenuItem menuItem = new MenuItem(journalAction.Title);

            menuItem.Activated += (sender, e) => { journalAction.ExecuteAction(GetSelectedItems()); };
            menuItem.Sensitive  = journalAction.GetSensitivity(GetSelectedItems());
            menuItem.Visible    = journalAction.GetVisibility(GetSelectedItems());
            foreach (var childAction in journalAction.ChildActions)
            {
                menuItem.Add(CreatePopupMenuItem(childAction));
            }
            return(menuItem);
        }
Exemple #15
0
        static void Main(string[] args)
        {
            var userMenu = new MenuItem("User Admin");

            userMenu.Add("Create User");
            userMenu.Add("Edit User");

            var productMenu = new MenuItem("Product Admin");

            productMenu.Add("All Products");
            productMenu.AddTo("All Products", "My Products");
            productMenu.Add("Create Product");

            var orderMenu = new MenuItem("Order Admin");

            orderMenu.Add("Order Reports");
            orderMenu.Add("Create Order");
            orderMenu.AddTo("Order Reports", "Audit Reports");
            orderMenu.AddTo("Audit Reports", "Updated Orders");
            orderMenu.AddTo("Audit Reports", "Created Orders");

            var reportsMenu = new MenuItem("Reports");

            reportsMenu.Add("Win Tech Reports");
            reportsMenu.Add("Microsoft Report");

            var mainMenu = new MenuItem();

            mainMenu.Add("Administration");
            mainMenu.AddTo("Administration", userMenu);
            mainMenu.AddTo("Administration", productMenu);
            mainMenu.AddTo("Administration", orderMenu);
            mainMenu.Add(reportsMenu);

            Console.WriteLine(mainMenu.Generate(Environment.NewLine));
        }
Exemple #16
0
 public void AddMenu(MenuItem menu)
 {
     menu.Add(
         Menu(() => LabelOnOff(AutoDecend, "Auto Descend:", "ENABLED", "OFF"))
         .Enter(() => AutoDecend = !AutoDecend),
         Menu("Cargo management").Add(
             Menu(() => LabelOnOff(Enabled, "StoneEject module:", "ENABLED", "OFF"))
             .Enter(() => Enabled = !Enabled),
             Menu(() => LabelOnOff(EjectorsEnabled, "Ejectors:", "ENABLED", "OFF"))
             .Enter(() => EjectorsEnabled = !EjectorsEnabled),
             Menu(() => $"Transfer volume: {MaxTransferVol}")
             .Left(() => MaxTransferVol  -= 100)
             .Right(() => MaxTransferVol += 100)
             .Back(() => MaxTransferVol   = 1000)
             )
         );
 }
        public static MenuItem CreateImageMenuItem(string text, Image image)
        {
#if NETFRAMEWORK
            ImageMenuItem imageItem = new ImageMenuItem(text);
            imageItem.Image = image;
#else
            // GtkImageMenuItem has been deprecated since GTK+ 3.10. If you want to
            // display an icon in a menu item, you should use GtkMenuItem and pack a GtkBox
            // with a GtkImage and a GtkLabel instead.
            HBox     container = new HBox();
            Label    label     = new Label(text);
            MenuItem imageItem = new MenuItem();

            container.PackStart(image, false, false, 0);
            container.PackStart(label, false, false, 0);
            imageItem.Add(container);
#endif
            return(imageItem);
        }
Exemple #18
0
        public override void Initialize()
        {
            Shell.Title = "Meshellator Viewer";

            Scene torusScene  = MeshellatorLoader.CreateFromTorus(10, 1, 20);
            Scene teapotScene = MeshellatorLoader.CreateFromTeapot(15, 20);

            teapotScene.Materials[0].DiffuseColor = ColorsRgbF.Green;
            Scene planeScene = MeshellatorLoader.CreateFromPlane(40, 40);

            planeScene.Materials[0].DiffuseColor = ColorsRgbF.Gray;

            torusScene.Meshes.Add(teapotScene.Meshes[0]);
            torusScene.Meshes.Add(planeScene.Meshes[0]);

            Shell.OpenDocument(new ModelEditorViewModel(new SceneViewModel(torusScene), "[New Shape]"));

            var fileMenuItem = Shell.MainMenu.First(mi => mi.Name == "File");

            fileMenuItem.Children.Insert(0, new MenuItem("New Sphere", NewSphere));
            fileMenuItem.Children.Insert(1, new MenuItem("New Teapot", NewTeapot));
            fileMenuItem.Children.Insert(2, new MenuItemSeparator());

            var rendererMenu = new MenuItem("Renderer");

            Shell.MainMenu.Add(rendererMenu);
            rendererMenu.Add(
                new CheckableMenuItem("Wireframe", ToggleFillModeWireframe),
                MenuItemBase.Separator,
                new CheckableMenuItem("Show Normals", ToggleNormals, ChangeRenderStateCanExecute),
                new CheckableMenuItem("Show Shadows", ToggleShadows, ChangeRenderStateCanExecute)
            {
                IsChecked = true
            },
                MenuItemBase.Separator,
                new CheckableMenuItem("Anti-Aliasing", ToggleAntiAliasing, ChangeRenderStateCanExecute)
            {
                IsChecked = true
            },
                new CheckableMenuItem("No Specular", ToggleSpecular, ChangeRenderStateCanExecute));
        }
Exemple #19
0
 /// <summary>
 /// Add Separator
 /// </summary>
 /// <param name="parentMenuItem"></param>
 /// <param name="itemId"></param>
 /// <returns></returns>
 public static MenuItem AddSeparator(this MenuItem parentMenuItem, string itemId)
 {
     return(parentMenuItem.Add("", itemId, -1, BoMenuType.mt_SEPERATOR));
 }
Exemple #20
0
 /// <summary>
 /// Add Menu Item (Fluid API Style)
 /// </summary>
 /// <param name="parentMenuItem"></param>
 /// <param name="title"></param>
 /// <param name="itemId"></param>
 /// <param name="position"></param>
 public static MenuItem AddItem(this MenuItem parentMenuItem, string title, string itemId, int position = -1)
 {
     return(parentMenuItem.Add(title, itemId, position, BoMenuType.mt_STRING));
 }
Exemple #21
0
 /// <summary>
 /// Add Folder (Fluid API Style)
 /// </summary>
 /// <param name="parentMenuItem"></param>
 /// <param name="title"></param>
 /// <param name="itemId"></param>
 /// <param name="position"></param>
 /// <returns></returns>
 public static MenuItem AddFolder(this MenuItem parentMenuItem, string title, string itemId, int position = -1)
 {
     return(parentMenuItem.Add(title, itemId, position, BoMenuType.mt_POPUP));
 }
        public override void Handle()
        {
            foreach (ShipyardItem item in ProcessShipyardDetection.ShipyardsList)
            {
                if (item.Menu != null)
                {
                    if (item.Menu.Panel.Closed)
                    {
                        item.Menu = null;
                    }
                }

                if (item.Menu != null)
                {
                    Utilities.Invoke(() => item.Menu.UpdateLCD());
                }
                else
                {
                    if (_updateCount < 5)
                    {
                        _updateCount++;
                        return;
                    }
                    _updateCount = 0;

                    var yardGrid = (IMyCubeGrid)item.YardEntity;

                    var blocks = new List <IMySlimBlock>();
                    yardGrid.GetBlocks(blocks);
                    bool superFound = false;

                    foreach (IMySlimBlock slimBlock in blocks)
                    {
                        var panel = slimBlock.FatBlock as IMyTextPanel;

                        if (panel == null)
                        {
                            continue;
                        }

                        if (!panel.CustomName.ToLower().Contains("shipyard"))
                        {
                            continue;
                        }

                        var bound = new BoundingSphereD(panel.GetPosition(), 5);
                        List <IMySlimBlock> nearblocks = yardGrid.GetBlocksInsideSphere(ref bound);
                        bool found = false;

                        foreach (IMySlimBlock block in nearblocks)
                        {
                            var buttons = block.FatBlock as IMyButtonPanel;

                            if (buttons == null)
                            {
                                continue;
                            }

                            superFound = true;
                            found      = true;
                            Logging.Instance.WriteDebug("Found LCD pair for grid: " + item.EntityId);
                            Utilities.Invoke(() =>
                            {
                                long id       = item.EntityId;
                                item.Menu     = new LCDMenu();
                                panel.Enabled = true;
                                //panel.RequestEnable(false);
                                //panel.RequestEnable(true);
                                item.Menu.BindButtonPanel(buttons);
                                item.Menu.BindLCD(panel);
                                var mainMenu       = new MenuItem("", "", null, MenuDel(id));
                                var statusMenu     = new MenuItem("", "", null, StatusDel(id));
                                var scanMenu       = new MenuItem("", "Get details for: \r\n");
                                var grindStatsMenu = new MenuItem("SCANNING...", "", null, GrindStatsDel(id));
                                var weldStatsMenu  = new MenuItem("SCANNING...", "", null, WeldStatsDel(id));
                                var returnMenu     = new MenuItem("Return", "", ScanDel(item.Menu, mainMenu, 0));
                                mainMenu.root      = item.Menu;
                                mainMenu.Add(new MenuItem("Grind", "", GrindDel(item.Menu, statusMenu)));
                                mainMenu.Add(new MenuItem("Weld", "", WeldDel(item.Menu, statusMenu)));
                                mainMenu.Add(new MenuItem("Scan", "", ScanDel(item.Menu, scanMenu)));
                                statusMenu.root = item.Menu;
                                statusMenu.Add(new MenuItem("Stop", "", StopDel(item.Menu, mainMenu)));
                                scanMenu.Add(new MenuItem("Grind", "", ScanDel(item.Menu, grindStatsMenu, ShipyardType.Scanning)));
                                scanMenu.Add(new MenuItem("Weld", "", ScanDel(item.Menu, weldStatsMenu, ShipyardType.Scanning)));
                                grindStatsMenu.Add(returnMenu);
                                weldStatsMenu.Add(returnMenu);
                                item.Menu.Root = mainMenu;
                                item.Menu.SetCurrentItem(mainMenu);
                                item.Menu.UpdateLCD();
                                Communication.SendNewYard(item);
                            });

                            break;
                        }

                        if (found)
                        {
                            break;
                        }
                    }
                    Logging.Instance.WriteDebug($"SuperFind {item.EntityId}: {superFound}");
                }
            }
        }
 public MenuConfiguration()
 {
     _menu.Add("Application", "Application", "#/application/:applicationId/");
     _menu.Add("Incident", "Incident", "#/application/:applicationId/incident/:incidentId/");
     _menu.Add("System", "System", "#/system");
 }
Exemple #24
0
 public MenuView()
 {
     _menu.Add(new LevelMenuItem("Easy"));
     _menu.Add(new LevelMenuItem("Medium"));
     _menu.Add(new LevelMenuItem("Hard"));
 }
Exemple #25
0
            public void AddMenu(MenuManager menuMgr)
            {
                var tls        = Menu("Tools");
                var foundTools = false;

                foreach (var tool in new[] { GR, WL, OD, DR })
                {
                    if (HasTool(tool))
                    {
                        foundTools = true;
                        tls.Add(
                            Menu(() => GetText(tool))
                            .Collect(this)
                            .Enter("toggle" + tool, () => ToolToggle(tool))
                            .Back(() => ToolEnable(tool, false))
                            .Left(() => ToolDistance(tool, -1))
                            .Right(() => ToolDistance(tool, 1))
                            );
                    }
                }

                if (HasTool(DR))
                {
                    Action <int> yawRotate = (dir) => {
                        ActionOnBlocksOfType <IMyGyro>(Pgm, Me, g => {
                            if (NameContains(g, DR))
                            {
                                var yawRpm = g.Yaw;
                                if (0 == dir)
                                {
                                    if (g.Enabled)
                                    {
                                        g.Enabled = false;
                                    }
                                    else
                                    {
                                        yawRpm    = -yawRpm;
                                        g.Enabled = true;
                                    }
                                }
                                else
                                {
                                    yawRpm    = Math.Sign(dir) * Math.Abs(yawRpm);
                                    g.Enabled = true;
                                }
                                g.Yaw = yawRpm;
                            }
                        });
                    };

                    tls.Add(
                        Menu("Yaw rotation  left< toggle >right")
                        .Enter("toggleYaw", () => yawRotate(0))
                        .Left(() => yawRotate(-1))
                        .Right(() => yawRotate(1))
                        );

                    Pgm.cargoMgr?.AddMenu(tls);
                }

                if (HasSensors())
                {
                    foundTools = true;

                    const int e = 11, d = 16, f = 10;
                    int[]     pad = { 0,
                                      e + 2, e + 1, e + 3, e + 2, e + 2, e + 0,     0, 0, 0, 0,
                                      d + 0, d + 0, d + 2, d + 1, d + 2, d + 1, d + 0, 0, 0, 0,
                                      f + 1, f + 1, f + 2, f + 0, };

                    int      i    = 0;
                    MenuItem bbox = Menu("Extend/Boundaries");
                    foreach (var txt in Pgm.DIRECTIONS)
                    {
                        int j = ++i;
                        bbox.Add(
                            Menu(() => SensorText(txt, j, pad[j]))
                            .Left(() => SensorProp(j, -1))
                            .Right(() => SensorProp(j, 1))
                            .Back(() => SensorProp(j, 0))
                            );
                    }

                    i = 10;
                    MenuItem typs = Menu("Object detection");
                    foreach (var txt in new[] { "Large ships", "Small ships", "Stations", "Subgrids", "Players", "Asteroids", "Floating obj." })
                    {
                        int j = ++i;
                        typs.Add(
                            Menu(() => SensorText(txt, j, pad[j]))
                            .Enter(() => SensorProp(j, 0))
                            );
                    }

                    i = 20;
                    MenuItem fctn = Menu("Faction recognition");
                    foreach (var txt in new[] { "Owner", "Friendly", "Neutral", "Enemy" })
                    {
                        int j = ++i;
                        fctn.Add(
                            Menu(() => SensorText(txt, j, pad[j]))
                            .Enter(() => SensorProp(j, 0))
                            );
                    }

                    tls.Add(
                        Menu("Sensors").Add(
                            Menu(() => SensorText("Selected", 0, 0))
                            .Left(() => SensorProp(0, -1))
                            .Right(() => SensorProp(0, 1))
                            .Enter(() => ToggleSensor()),
                            bbox,
                            typs,
                            fctn
                            )
                        );
                }

                if (0 < GetBlocksOfType(Pgm, LG, Me).Count)
                {
                    foundTools = true;
                    Action <int> lgMode = (wanted) => {
                        var lst = GetBlocksOfType(Pgm, LG, Me);
                        if (-1 == wanted)
                        {
                            int[] cnts = { 0, 0, 0 };
                            foreach (var b in lst)
                            {
                                cnts[(int)(b as IMyLandingGear).LockMode]++;
                            }
                            wanted = 0 < cnts[1] ? 2 : 0;                             // `ReadyToLock` takes priority over `Unlocked`.
                        }
                        foreach (var b in lst)
                        {
                            var l = b as IMyLandingGear;
                            switch ((int)l.LockMode)
                            {
                            // BUG: Why is `LandingGearMode` not whitelisted?
                            case 0: break;

                            case 1: if (2 == wanted)
                                {
                                    l.Lock();
                                }
                                break;

                            case 2: if (0 == wanted)
                                {
                                    l.Unlock();
                                }
                                break;
                            }
                        }
                    };
                    tls.Add(
                        Menu(() => GetText(LG, 2))
                        .Collect(this)
                        .Enter("toggle" + LG, () => lgMode(-1))
                        .Left(() => lgMode(2))
                        .Right(() => lgMode(0))
                        );
                }

                if (HasProjectors())
                {
                    foundTools = true;
                    MenuItem tp = Menu("Projectors").Add(
                        Menu(() => ProjectorText("Selected", 0))
                        .Left(() => ProjectorProp(0, -1))
                        .Right(() => ProjectorProp(0, 1))
                        .Enter(() => ToggleProjector())
                        );

                    int i = 0;
                    foreach (var txt in new[] { "Offset X", "Offset Y", "Offset Z", "Rotate X", "Rotate Y", "Rotate Z" })
                    {
                        int j = ++i;
                        tp.Add(
                            Menu(() => ProjectorText(txt, j))
                            .Left(() => ProjectorProp(j, -1))
                            .Right(() => ProjectorProp(j, 1))
                            .Back(() => ProjectorProp(j, 0))
                            );
                    }

                    tls.Add(tp);
                }

                if (HasGravityGenerators())
                {
                    foundTools = true;
                    MenuItem tp = Menu("Gravity generators").Add(
                        Menu(() => GravityGeneratorText("Selected", 0))
                        .Left(() => GravityGeneratorProp(0, -1))
                        .Right(() => GravityGeneratorProp(0, 1))
                        .Enter(() => ToggleGravityGen())
                        );

                    int i = 0;
                    foreach (var txt in new[] { "Width", "Height", "Depth", "Strength" })
                    {
                        int j = ++i;
                        tp.Add(
                            Menu(() => GravityGeneratorText(txt, j))
                            .Left(() => GravityGeneratorProp(j, -1))
                            .Right(() => GravityGeneratorProp(j, 1))
                            .Back(() => GravityGeneratorProp(j, 0))
                            );
                    }

                    tls.Add(tp);
                }

                if (foundTools)
                {
                    menuMgr.Add(tls);
                }
            }
Exemple #26
0
        public static void Load()
        {
            if (Player.Instance.ChampionName != "Teemo")
            {
                return;
            }

            Language_Set();

            Chat.Print("<font color = '#ebfd00'>Welcome to </font><font color = '#ffffff'>[ Nebula ] " + Player.Instance.ChampionName +
                       "</font><font color = '#ebfd00'>. Addon is ready.</font>");
            Chat.Print("<font color = '#ebfd00'>Use Stealth Passive.</font>");

            Menu = MainMenu.AddMenu("[ Nebula ] Teemo", "By.Natrium");
            Menu.AddLabel(Res_Language.GetString("Main_Text_0"));
            Menu.AddLabel(Res_Language.GetString("Main_Text_1"));
            Menu.AddLabel(Res_Language.GetString("Main_Text_2"));
            Menu.AddSeparator();
            Menu.AddLabel(Res_Language.GetString("Main_Language_Exp"));
            Menu.Add("Language.Select", new ComboBox(Res_Language.GetString("Main_Language_Select"), 0, "English", "Korean"));

            MenuCombo = Menu.AddSubMenu("- Combo", "Sub0");
            MenuCombo.AddLabel(Res_Language.GetString("Attack_Range_Exp"));
            MenuCombo.Add("Combo.Ignite", new CheckBox(Res_Language.GetString("Combo_Ignite")));
            MenuCombo.AddSeparator();
            MenuCombo.Add("Combo.Q.Use", new CheckBox(Res_Language.GetString("Combo_Q_Text")));
            MenuCombo.Add("Combo.Q.Mana", new Slider(Res_Language.GetString("Combo_Q_Mana"), 25, 0, 100));
            MenuCombo.AddSeparator();
            MenuCombo.Add("Combo.W.Use", new CheckBox(Res_Language.GetString("Combo_W_Text")));
            MenuCombo.Add("Combo.W.Range", new Slider(Res_Language.GetString("Combo_W_Range"), 500, 0, 800));
            MenuCombo.Add("Combo.W.Mana", new Slider(Res_Language.GetString("Combo_W_Mana"), 25, 0, 100));
            MenuCombo.AddSeparator();
            MenuCombo.Add("Combo.R.Use", new CheckBox(Res_Language.GetString("Combo_R_Text")));
            MenuCombo.Add("Combo.R.Count", new Slider(Res_Language.GetString("Combo_R_Count"), 1, 1, 3));

            MenuHarass = Menu.AddSubMenu("- Harass", "Sub1");
            MenuHarass.AddLabel(Res_Language.GetString("Attack_Range_Exp"));
            MenuHarass.Add("Harass.Q.Use", new CheckBox(Res_Language.GetString("Harass_Q_Text")));
            MenuHarass.Add("Harass.Q.Mana", new Slider(Res_Language.GetString("Harass_Q_Mana"), 65, 0, 100));
            MenuHarass.AddSeparator();
            MenuHarass.Add("Harass.W.Use", new CheckBox(Res_Language.GetString("Harass_W_Text")));
            MenuHarass.Add("Harass.W.Range", new Slider(Res_Language.GetString("Harass_W_Range"), 450, 0, 800));
            MenuHarass.Add("Harass.W.Mana", new Slider(Res_Language.GetString("Harass_W_Mana"), 70, 0, 100));
            MenuHarass.AddSeparator();
            MenuHarass.Add("Harass.R.Use", new CheckBox(Res_Language.GetString("Harass_R_Text")));
            MenuHarass.Add("Harass.R.Count", new Slider(Res_Language.GetString("Harass_R_Count"), 2, 2, 3));
            MenuHarass.Add("Harass.R.Mana", new Slider(Res_Language.GetString("Harass_R_Mana"), 45, 0, 100));

            MenuFlee = Menu.AddSubMenu("- Flee", "Sub3");
            MenuFlee.Add("Flee.Q.Use", new CheckBox(Res_Language.GetString("Flee_Q_Text")));
            MenuFlee.Add("Flee.Q.Range", new Slider(Res_Language.GetString("Flee_Q_Range"), 450, 0, 680));
            MenuFlee.Add("Flee.W.Use", new CheckBox(Res_Language.GetString("Flee_W_Text")));
            MenuFlee.Add("Flee.R.Use", new CheckBox(Res_Language.GetString("Flee_R_Text")));

            MenuLane = Menu.AddSubMenu("- Lane", "Sub4");
            MenuLane.Add("Lane.Minions.Big", new CheckBox(Res_Language.GetString("Lane_Q_Big")));
            MenuLane.AddSeparator();
            MenuLane.Add("Lane.R.Use", new CheckBox(Res_Language.GetString("Lane_R_Text")));
            MenuLane.Add("Lane.R.PCount", new Slider(Res_Language.GetString("Lane_R_PoisonCount"), 3, 1, 5));
            MenuLane.Add("Lane.R.RCount", new Slider(Res_Language.GetString("Lane_R_Count"), 2, 2, 3));
            MenuLane.Add("Lane.R.Mana", new Slider(Res_Language.GetString("Lane_R_Mana"), 80, 0, 100));

            MenuJungle = Menu.AddSubMenu("- Jungle", "Sub5");
            MenuJungle.Add("Jungle.Q.Use", new CheckBox(Res_Language.GetString("Jungle_Q_Text")));
            MenuJungle.Add("Jungle.Q.Mana", new Slider(Res_Language.GetString("Jungle_Q_Mana"), 30, 0, 100));
            MenuJungle.AddSeparator();
            MenuJungle.Add("Jungle.R.Use", new CheckBox(Res_Language.GetString("Jungle_R_Text"), false));
            MenuJungle.Add("Jungle.R.Count", new Slider(Res_Language.GetString("Jungle_R_Count"), 2, 2, 3));
            MenuJungle.Add("Jungle.R.Mana", new Slider(Res_Language.GetString("Jungle_R_Mana"), 50, 0, 100));

            MenuItem = Menu.AddSubMenu("- Item", "Sub6");
            MenuItem.AddLabel(Res_Language.GetString("Item_Exp_0"));
            MenuItem.AddLabel(Res_Language.GetString("Item_Item_Text"));
            MenuItem.Add("Item.BK.Hp", new Slider(Res_Language.GetString("Item_A_BK_Hp"), 95, 0, 100));
            MenuItem.AddSeparator(10);
            MenuItem.Add("QSS", new CheckBox(Res_Language.GetString("Item_D_QSS")));
            MenuItem.Add("Scimitar", new CheckBox(Res_Language.GetString("Item_D_Scimitar")));
            MenuItem.Add("CastDelay", new Slider(Res_Language.GetString("Item_CastDelay"), 350, 0, 1200));
            MenuItem.AddSeparator(10);
            MenuItem.AddLabel(Res_Language.GetString("Item_Debuff_Text"));
            MenuItem.Add("Blind", new CheckBox(Res_Language.GetString("Item_Buff_Blind")));
            MenuItem.Add("Charm", new CheckBox(Res_Language.GetString("Item_Buff_Charm")));
            MenuItem.Add("Fear", new CheckBox(Res_Language.GetString("Item_Buff_Fear")));
            MenuItem.Add("Ploymorph", new CheckBox(Res_Language.GetString("Item_Buff_Ploymorph")));
            MenuItem.Add("Poisons", new CheckBox(Res_Language.GetString("Item_Buff_Poisons")));
            MenuItem.Add("Silence", new CheckBox(Res_Language.GetString("Item_Buff_Silence")));
            MenuItem.Add("Slow", new CheckBox(Res_Language.GetString("Item_Buff_Slow")));
            MenuItem.Add("Stun", new CheckBox(Res_Language.GetString("Item_Buff_Stun")));
            MenuItem.Add("Supression", new CheckBox(Res_Language.GetString("Item_Buff_Supression")));
            MenuItem.Add("Taunt", new CheckBox(Res_Language.GetString("Item_Buff_Taunt")));
            MenuItem.Add("Snare", new CheckBox(Res_Language.GetString("Item_Buff_Snare")));
            MenuItem.AddSeparator(10);
            MenuItem.AddLabel(Res_Language.GetString("Item_D_Zhonyas_Text") + " " + Res_Language.GetString("Item_Exp_1"));
            MenuItem.Add("Item.Zy", new CheckBox(Res_Language.GetString("Item_D_Zhonyas_Text")));
            MenuItem.AddLabel(Res_Language.GetString("Item_D_Zhonyas_t1"));
            MenuItem.Add("Item.Zy.BHp", new Slider(Res_Language.GetString("Item_D_Zhonyas_BHp"), 35, 0, 100));
            MenuItem.Add("Item.Zy.BDmg", new Slider(Res_Language.GetString("Item_D_Zhonyas_BDmg"), 50, 0, 100));
            MenuItem.AddSeparator(10);
            MenuItem.AddLabel(Res_Language.GetString("Item_D_Zhonyas_t2"));
            MenuItem.Add("Item.Zy.SHp", new Slider(Res_Language.GetString("Item_D_Zhonyas_SHp"), 35, 0, 100));
            MenuItem.Add("Item.Zy.SDmg", new Slider(Res_Language.GetString("Item_D_Zhonyas_SDmg"), 50, 0, 100));

            MenuItem.AddSeparator(10);
            MenuItem.AddLabel(Res_Language.GetString("Item_D_Zhonyas_R"));
            foreach (var enemyR in EntityManager.Heroes.Enemies)
            {
                MenuItem.Add("R." + enemyR.ChampionName.ToLower(), new CheckBox(enemyR.ChampionName + " [ R ]"));
            }

            MenuMisc = Menu.AddSubMenu("- Misc", "SubMenu7");
            MenuMisc.AddLabel(Res_Language.GetString("Misc_JungleSteal"));
            MenuMisc.Add("Steal.J.0", new CheckBox(Res_Language.GetString("Misc_JungleSteal")));
            MenuMisc.AddSeparator();
            MenuMisc.AddLabel(Res_Language.GetString("Misc_KillSteal"));
            MenuMisc.Add("Steal.K.0", new CheckBox(Res_Language.GetString("Misc_KillSteal")));
            MenuMisc.AddSeparator();
            MenuMisc.AddLabel(Res_Language.GetString("Misc_AutoR_Text"));
            MenuMisc.Add("Auto.R", new CheckBox(Res_Language.GetString("Misc_AutoR")));
            MenuMisc.AddLabel(Res_Language.GetString("Misc_AutoR_Exp"));

            MenuDraw = Menu.AddSubMenu("- Draw", "SubMenu8");
            MenuDraw.Add("Draw.Q.Range", new CheckBox(Res_Language.GetString("Draw_Q")));
            MenuDraw.Add("Draw.Q.Big", new CheckBox(Res_Language.GetString("Draw_LaneQ")));
            MenuDraw.Add("Draw.R.Range", new CheckBox(Res_Language.GetString("Draw_R")));
            MenuDraw.Add("Draw.ComboCal", new CheckBox(Res_Language.GetString("Draw_DmgPer")));
            MenuDraw.AddLabel(Res_Language.GetString("Draw_DmgPer_Text"));
            MenuDraw.AddSeparator(20);

            MenuDraw.Add("Draw.Virtual", new CheckBox(Res_Language.GetString("Draw_Virtual"), false));
            MenuDraw.Add("Virtual.Range1", new Slider(Res_Language.GetString("Draw_Virtual_Min"), 250, 0, 900));
            MenuDraw.Add("Virtual.Range2", new Slider(Res_Language.GetString("Draw_Virtual_Max"), 900, 0, 900));
            MenuDraw.AddSeparator(20);

            MenuDraw.AddLabel(Res_Language.GetString("Draw_Enemy"));
            foreach (var enemyR in EntityManager.Heroes.Enemies)
            {
                MenuDraw.AddLabel(enemyR.ChampionName);
                MenuDraw.Add("Draw." + enemyR.ChampionName.ToLower() + ".Q", new CheckBox("[ Q ] - " + enemyR.Spellbook.GetSpell(SpellSlot.Q).Name, false));
                MenuDraw.Add("Draw." + enemyR.ChampionName.ToLower() + ".W", new CheckBox("[ W ] - " + enemyR.Spellbook.GetSpell(SpellSlot.W).Name, false));
                MenuDraw.Add("Draw." + enemyR.ChampionName.ToLower() + ".E", new CheckBox("[ E ] - " + enemyR.Spellbook.GetSpell(SpellSlot.E).Name, false));
                MenuDraw.Add("Draw." + enemyR.ChampionName.ToLower() + ".R", new CheckBox("[ R ] - " + enemyR.Spellbook.GetSpell(SpellSlot.R).Name, false));
                MenuDraw.AddSeparator(15);
            }

            CheckVersion.CheckUpdate();

            Menu["Language.Select"].Cast <ComboBox>().OnValueChange += (sender, vargs) =>
            {
                var index = vargs.NewValue;
                File.WriteAllText(Language_Path, Language_List[index], Encoding.Default);
            };

            Orbwalker.OnPostAttack         += OnAfterAttack;
            Game.OnUpdate                  += Mode_Item.UltBuffUpdate;
            Obj_AI_Base.OnProcessSpellCast += Mode_Item.OnProcessSpellCast;
            Obj_AI_Base.OnBasicAttack      += Mode_Item.OnBasicAttack;
            Game.OnUpdate                  += Game_OnUpdate;
            Game.OnTick    += Game_OnTick;
            Drawing.OnDraw += Gama_OnDraw;
        }
Exemple #27
0
        void ContextMenu_Opening(object sender, CancelEventArgs e)
        {
            lock (mp.MediaTracks)
            {
                MenuItem trackMenuItem = FindMenuItem("Track");

                if (trackMenuItem != null)
                {
                    trackMenuItem.DropDownItems.Clear();

                    MediaTrack[] audTracks = mp.MediaTracks.Where(track => track.Type == "a").ToArray();
                    MediaTrack[] subTracks = mp.MediaTracks.Where(track => track.Type == "s").ToArray();
                    MediaTrack[] vidTracks = mp.MediaTracks.Where(track => track.Type == "v").ToArray();
                    MediaTrack[] ediTracks = mp.MediaTracks.Where(track => track.Type == "e").ToArray();

                    foreach (MediaTrack track in vidTracks)
                    {
                        MenuItem mi = new MenuItem(track.Text);
                        mi.Action  = () => mp.commandv("set", "vid", track.ID.ToString());
                        mi.Checked = mp.Vid == track.ID.ToString();
                        trackMenuItem.DropDownItems.Add(mi);
                    }

                    if (vidTracks.Length > 0)
                    {
                        trackMenuItem.DropDownItems.Add(new ToolStripSeparator());
                    }

                    foreach (MediaTrack track in audTracks)
                    {
                        MenuItem mi = new MenuItem(track.Text);
                        mi.Action  = () => mp.commandv("set", "aid", track.ID.ToString());
                        mi.Checked = mp.Aid == track.ID.ToString();
                        trackMenuItem.DropDownItems.Add(mi);
                    }

                    if (subTracks.Length > 0)
                    {
                        trackMenuItem.DropDownItems.Add(new ToolStripSeparator());
                    }

                    foreach (MediaTrack track in subTracks)
                    {
                        MenuItem mi = new MenuItem(track.Text);
                        mi.Action  = () => mp.commandv("set", "sid", track.ID.ToString());
                        mi.Checked = mp.Sid == track.ID.ToString();
                        trackMenuItem.DropDownItems.Add(mi);
                    }

                    if (subTracks.Length > 0)
                    {
                        MenuItem mi = new MenuItem("S: No subtitles");
                        mi.Action  = () => mp.commandv("set", "sid", "no");
                        mi.Checked = mp.Sid == "no";
                        trackMenuItem.DropDownItems.Add(mi);
                    }

                    if (ediTracks.Length > 0)
                    {
                        trackMenuItem.DropDownItems.Add(new ToolStripSeparator());
                    }

                    foreach (MediaTrack track in ediTracks)
                    {
                        MenuItem mi = new MenuItem(track.Text);
                        mi.Action  = () => mp.commandv("set", "edition", track.ID.ToString());
                        mi.Checked = mp.Edition == track.ID;
                        trackMenuItem.DropDownItems.Add(mi);
                    }
                }
            }

            lock (mp.Chapters)
            {
                MenuItem chaptersMenuItem = FindMenuItem("Chapters");

                if (chaptersMenuItem != null)
                {
                    chaptersMenuItem.DropDownItems.Clear();

                    foreach (var i in mp.Chapters)
                    {
                        MenuItem mi = new MenuItem(i.Key);
                        mi.ShortcutKeyDisplayString = TimeSpan.FromSeconds(i.Value).ToString().Substring(0, 8) + "     ";
                        mi.Action = () => mp.commandv("seek", i.Value.ToString(CultureInfo.InvariantCulture), "absolute");
                        chaptersMenuItem.DropDownItems.Add(mi);
                    }
                }
            }

            MenuItem recent = FindMenuItem("Recent");

            if (recent != null)
            {
                recent.DropDownItems.Clear();
                foreach (string path in RecentFiles)
                {
                    MenuItem.Add(recent.DropDownItems, path, () => mp.Load(new[] { path }, true, Control.ModifierKeys.HasFlag(Keys.Control)));
                }
                recent.DropDownItems.Add(new ToolStripSeparator());
                MenuItem mi = new MenuItem("Clear List");
                mi.Action = () => RecentFiles.Clear();
                recent.DropDownItems.Add(mi);
            }
        }
Exemple #28
0
        public void SetRoomConflict(RoomConflict rc)
        {
            if (rc == null || rc.IsEmpty)
            {
                HideAll();
                NoShowAll = true;
                return;
            }

            HBox hbox = new HBox();

            hbox.Spacing = 1;
            m            = new Menu();

            // this round/room
            foreach (RoomConflict.Type t in rc.Partners1.Keys)
            {
                if (rc.Partners1[t].Count == 0)
                {
                    continue;
                }
                int iconIndex = settings.conflictIcons[(int)t];
                if (iconIndex >= 0)
                {
                    hbox.Add(new Gtk.Image(MiscHelpers.LoadIcon(settings.possibleIcons[iconIndex])));
                }
                MenuItem miType = new MenuItem(t.ToString());
                miType.Submenu = new Menu();
                foreach (RoundDebater d in rc.Partners1[t])
                {
                    (miType.Submenu as Menu).Add(new MenuItem(RoundDebaterToString(d)));
                }
                m.Add(miType);
            }

            // other Rounds...
            MenuItem miOther = new MenuItem();
            Label    lbl     = new Label();

            lbl.Markup = "<i>Other</i>";
            lbl.Xalign = 0;
            miOther.Add(lbl);
            Menu mOther = new Menu();

            miOther.Submenu = mOther;
            int validOthers = 0;

            // in other Conflicts, it should be okay to iterate using Tournament.I.Rounds
            foreach (RoundData rd in Tournament.I.Rounds)
            {
                RoomConflict.Complex cmplx;
                if (rc.Partners2.TryGetValue(rd.RoundName, out cmplx))
                {
                    Dictionary <string, List <RoundDebater> > store = cmplx.Store;
                    List <string> keys = new List <string>(store.Keys);
                    // sorting is a bit nasty, so that "Room 2" is before "Room 11"
                    // this is also inefficient, but performance doesn't matter here
                    keys.Sort(delegate(string x, string y) {
                        // try to extract numbers from string
                        List <string> num_x = new List <string>(Regex.Split(x, @"\D+"));
                        List <string> num_y = new List <string>(Regex.Split(y, @"\D+"));

                        num_x.RemoveAll(item => string.IsNullOrEmpty(item.Trim()));
                        num_y.RemoveAll(item => string.IsNullOrEmpty(item.Trim()));
                        if (num_x.Count != 1 || num_y.Count != 1)
                        {
                            return(x.CompareTo(y));
                        }
                        return(int.Parse(num_x[0]).CompareTo(int.Parse(num_y[0])));
                    });
                    foreach (string room in keys)
                    {
                        MenuItem miRound = new MenuItem(rd.RoundName + ", " + room);
                        miRound.Submenu = new Menu();
                        foreach (RoundDebater d in store[room])
                        {
                            (miRound.Submenu as Menu).Add(new MenuItem(RoundDebaterToString(d)));
                        }
                        mOther.Add(miRound);
                        validOthers++;
                    }
                }
            }

            if (validOthers > 0)
            {
                int numEnums  = Enum.GetNames(typeof(RoomConflict.Type)).Length;
                int iconIndex = settings.conflictIcons[numEnums];
                if (iconIndex >= 0)
                {
                    hbox.Add(new Gtk.Image(MiscHelpers.LoadIcon(settings.possibleIcons[iconIndex])));
                }
                m.Add(miOther);
            }

            m.ShowAll();
            m.AttachToWidget(this, null);

            // always show a (not attracting) icon...even if all are disabled..
            if (hbox.Children.Length == 0)
            {
                // only loadable over pixbuf
                Pixbuf dummy = MiscHelpers.LoadIcon("weather-clear-night");
                //Stetic.IconLoader.LoadIcon(this,"stock_weather-night-clear",IconSize.Menu);
                hbox.Add(new Gtk.Image(dummy));
            }
            if (Children.Length > 0)
            {
                Remove(Child);
            }
            Add(hbox);
            NoShowAll = false;
            ShowAll();
        }
Exemple #29
0
        void ContextMenu_Opening(object sender, CancelEventArgs e)
        {
            lock (core.MediaTracks)
            {
                MenuItem trackMenuItem = FindMenuItem("Track");

                if (trackMenuItem != null)
                {
                    trackMenuItem.DropDownItems.Clear();

                    MediaTrack[] audTracks = core.MediaTracks.Where(track => track.Type == "a").ToArray();
                    MediaTrack[] subTracks = core.MediaTracks.Where(track => track.Type == "s").ToArray();
                    MediaTrack[] vidTracks = core.MediaTracks.Where(track => track.Type == "v").ToArray();
                    MediaTrack[] ediTracks = core.MediaTracks.Where(track => track.Type == "e").ToArray();

                    foreach (MediaTrack track in vidTracks)
                    {
                        MenuItem mi = new MenuItem(track.Text);
                        mi.Action  = () => core.commandv("set", "vid", track.ID.ToString());
                        mi.Checked = core.Vid == track.ID.ToString();
                        trackMenuItem.DropDownItems.Add(mi);
                    }

                    if (vidTracks.Length > 0)
                    {
                        trackMenuItem.DropDownItems.Add(new ToolStripSeparator());
                    }

                    foreach (MediaTrack track in audTracks)
                    {
                        MenuItem mi = new MenuItem(track.Text);
                        mi.Action  = () => core.commandv("set", "aid", track.ID.ToString());
                        mi.Checked = core.Aid == track.ID.ToString();
                        trackMenuItem.DropDownItems.Add(mi);
                    }

                    if (subTracks.Length > 0)
                    {
                        trackMenuItem.DropDownItems.Add(new ToolStripSeparator());
                    }

                    foreach (MediaTrack track in subTracks)
                    {
                        MenuItem mi = new MenuItem(track.Text);
                        mi.Action  = () => core.commandv("set", "sid", track.ID.ToString());
                        mi.Checked = core.Sid == track.ID.ToString();
                        trackMenuItem.DropDownItems.Add(mi);
                    }

                    if (subTracks.Length > 0)
                    {
                        MenuItem mi = new MenuItem("S: No subtitles");
                        mi.Action  = () => core.commandv("set", "sid", "no");
                        mi.Checked = core.Sid == "no";
                        trackMenuItem.DropDownItems.Add(mi);
                    }

                    if (ediTracks.Length > 0)
                    {
                        trackMenuItem.DropDownItems.Add(new ToolStripSeparator());
                    }

                    foreach (MediaTrack track in ediTracks)
                    {
                        MenuItem mi = new MenuItem(track.Text);
                        mi.Action  = () => core.commandv("set", "edition", track.ID.ToString());
                        mi.Checked = core.Edition == track.ID;
                        trackMenuItem.DropDownItems.Add(mi);
                    }
                }
            }

            lock (core.Chapters)
            {
                MenuItem chaptersMenuItem = FindMenuItem("Chapters");

                if (chaptersMenuItem != null)
                {
                    chaptersMenuItem.DropDownItems.Clear();

                    foreach (var pair in core.Chapters)
                    {
                        MenuItem mi = new MenuItem(pair.Key);
                        mi.ShortcutKeyDisplayString = TimeSpan.FromSeconds(pair.Value).ToString().Substring(0, 8) + "     ";
                        mi.Action = () => core.commandv("seek", pair.Value.ToString(CultureInfo.InvariantCulture), "absolute");
                        chaptersMenuItem.DropDownItems.Add(mi);
                    }
                }
            }

            MenuItem recent = FindMenuItem("Recent");

            if (recent != null)
            {
                recent.DropDownItems.Clear();

                foreach (string path in RecentFiles)
                {
                    MenuItem.Add(recent.DropDownItems, path, () => core.LoadFiles(new[] { path }, true, Control.ModifierKeys.HasFlag(Keys.Control)));
                }

                recent.DropDownItems.Add(new ToolStripSeparator());
                MenuItem mi = new MenuItem("Clear List");
                mi.Action = () => RecentFiles.Clear();
                recent.DropDownItems.Add(mi);
            }

            MenuItem titles = FindMenuItem("Titles");

            if (titles != null)
            {
                titles.DropDownItems.Clear();

                lock (core.BluRayTitles)
                {
                    List <(int Index, TimeSpan Len)> items = new List <(int Index, TimeSpan Len)>();

                    for (int i = 0; i < core.BluRayTitles.Count; i++)
                    {
                        items.Add((i, core.BluRayTitles[i]));
                    }

                    var titleItems = items.OrderByDescending(item => item.Len)
                                     .Take(20).OrderBy(item => item.Index);

                    foreach (var item in titleItems)
                    {
                        if (item.Len != TimeSpan.Zero)
                        {
                            MenuItem.Add(titles.DropDownItems, $"{item.Len} ({item.Index})",
                                         () => core.SetBluRayTitle(item.Index));
                        }
                    }
                }
            }
        }
            public void AddMenu(MenuManager menuMgr)
            {
                if (1 > GetThrustBlocks(ThrustFlags.All, Pgm, Me).Count)
                {
                    return;                     // No thrusters found
                }
                const int p = 16;               // padding
                MenuItem  tt;

                menuMgr.Add(
                    tt = Menu("Engine/Thrust settings").Add(
                        Menu(() => GetText(1, "All Thrusters", p))
                        .Collect(this)
                        .Enter("toggleEngines", () => tsToggle(ThrustFlags.All))
                        .Left(() => tsEnable(ThrustFlags.All, true))
                        .Right(() => tsEnable(ThrustFlags.All, false)),
                        Menu("Engine types").Add(
                            Menu(() => GetText(1, "Atmospheric", p + 0))
                            .Collect(this)
                            .Enter("toggleAtmos", () => tsToggle(ThrustFlags.Atmospheric))
                            .Left(() => tsEnable(ThrustFlags.Atmospheric, true))
                            .Right(() => tsEnable(ThrustFlags.Atmospheric, false)),
                            Menu(() => GetText(1, "Ion", p + 8))
                            .Collect(this)
                            .Enter("toggleIon", () => tsToggle(ThrustFlags.Ion))
                            .Left(() => tsEnable(ThrustFlags.Ion, true))
                            .Right(() => tsEnable(ThrustFlags.Ion, false)),
                            Menu(() => GetText(1, "Hydrogen", p + 2))
                            .Collect(this)
                            .Enter("toggleHydro", () => tsToggle(ThrustFlags.Hydrogen))
                            .Left(() => tsEnable(ThrustFlags.Hydrogen, true))
                            .Right(() => tsEnable(ThrustFlags.Hydrogen, false))
                            )
                        )
                    );

                if (null == Pgm.GetShipController())
                {
                    menuMgr.WarningText += "\n ShipController missing. Some features unavailable!";
                }
                else
                {
                    MenuItem md  = Menu("Directions");
                    MenuItem mo  = Menu("Override thrust");
                    int[]    pad = new[] { p + 2, p + 1, p + 3, p + 1, p + 2, p + 0 };

                    int i = 0;
                    foreach (string txt in Pgm.DIRECTIONS)
                    {
                        ThrustFlags tf = (ThrustFlags)(1 << i);
                        int         j  = i++;
                        md.Add(
                            Menu(() => GetText(1, txt, pad[j]))
                            .Collect(this)
                            .Enter("toggle" + txt, () => tsToggle(tf))
                            .Left(() => tsEnable(tf, true))
                            .Right(() => tsEnable(tf, false))
                            );
                        mo.Add(
                            Menu(() => GetText(2, txt, pad[j]))
                            .Collect(this)
                            .Enter("thrust" + txt, () => tsPower(tf, 100f))
                            .Left(() => tsPower(tf, -1))
                            .Right(() => tsPower(tf, 1))
                            .Back(() => tsPower(tf, 0))
                            );
                    }

                    tt.Add(md, mo);
                }
            }