Exemplo n.º 1
0
 public ChangeFont(RadioCommand mainRadio, CharacterHandler handler, BitFont font)
 {
     this.Controller = mainRadio;
     this.Handler    = handler;
     this.Font       = font;
     ID       = string.Format("{0}{1}", ActionID, font.ID);
     MenuText = font.Name;             //string.Format ("{0} {1}x{2}", font.Name, font.Width, font.Height);
     //Text = string.Format ("CP {0} {1}x{2}", font.Encoding.CodePage, font.Width, font.Height);
     //Name = "Change Font";
     if (Handler != null)
     {
         if (Handler.Client != null)
         {
             this.Enabled = Handler.Client.CurrentUser.Level >= this.Level;
             this.Checked = font.Equals(Handler.CurrentPage.Font);
         }
         else if (Handler.ClientDelegate.EditMode)
         {
             this.Checked = font.Equals(Handler.CurrentPage.Font);
         }
         else
         {
             this.Checked = font.Equals(Info.SelectedFont);
         }
     }
 }
Exemplo n.º 2
0
        public void AddCommand(RadioCommand com)
        {
            imageSettings.Visible = true;

            Commands.Add(com);
            _contextMenu.Items.Add(com);
        }
Exemplo n.º 3
0
 public RadioReaction(XElement x) : base()
 {
     _cmd = (RadioCommand)Enum.Parse(typeof(RadioCommand), x.Attribute("cmd").Value);
     if (x.Attribute("param1") != null)
     {
         _fileName = x.Attribute("param1").Value;
     }
 }
Exemplo n.º 4
0
        public void Run()
        {
            var check    = new RadioCommand();
            var selected = check.Run(imageSize + 3, "test checkbx", new List <string> {
                "Моя лента", "Теги"
            });

            Console.ForegroundColor = defaultColor;
        }
Exemplo n.º 5
0
 public BaudRateMap(BaudRateMapCollection coll, string desc, long baud)
 {
     Command = new RadioCommand {
         ID = "baud" + baud, MenuText = desc, Tag = this
     };
     if (coll.Count > 0)
     {
         Command.Controller = coll[0].Command;
     }
     Command.Executed += coll.ActionChecked;
     Baud              = baud;
 }
Exemplo n.º 6
0
        public static void Main(string[] args)
        {
            Console.Clear();
            var cli = new InstaCli();

            cli.Run();

            var check    = new RadioCommand();
            var selected = check.Run(imageSize + 3, "test checkbx", new List <string> {
                "first option", "sdasd", "asdasd"
            });

            Console.ForegroundColor = defaultColor;
            Console.WriteLine($"you select - {selected}");
            Console.ReadKey();
        }
Exemplo n.º 7
0
        public PropertyGridControl()
        {
            InitializeComponent();

            _cmdSortAbc                 = new RadioCommand();
            _cmdSortAbc.MenuText        = "Sort Alphabetically";
            _cmdSortAbc.CheckedChanged += CmdSort_CheckedChanged;
            AddCommand(_cmdSortAbc);

            _cmdSortGroup                 = new RadioCommand();
            _cmdSortGroup.Controller      = _cmdSortAbc;
            _cmdSortGroup.MenuText        = "Sort by Category";
            _cmdSortGroup.CheckedChanged += CmdSort_CheckedChanged;
            AddCommand(_cmdSortGroup);

            _objects = new List <object>();
        }
Exemplo n.º 8
0
        public void GenerateCommands(GenerateCommandArgs args)
        {
            Viewer.GenerateCommands(args);

            var smView = args.Menu.Items.GetSubmenu("&View");

            smView.Items.Add(new Actions.Autoscroll(this), 500);

            var smZoom = smView.Items.GetSubmenu("&Zoom", 500);

            smZoom.Items.Add(actionZoomFitWidth  = new Actions.FitWidth(this), 500);
            smZoom.Items.Add(actionZoomFitHeight = new Actions.FitHeight(this), 500);
            smZoom.Items.Add(actionAllowGrow     = new Actions.AllowGrow(this), 500);

            smZoom.Items.AddSeparator(500);


            RadioCommand controller = null;

            zoomLevels.Clear();
            foreach (float zoomLevel in ZOOM_LEVELS)
            {
                var raction = new RadioCommand {
                    Controller = controller, ID = "zoom" + zoomLevel, MenuText = string.Format("{0}%", zoomLevel * 100)
                };
                raction.Executed += (sender, e) =>
                {
                    var action = sender as RadioCommand;
                    ZoomInfo.Zoom = (float)action.Tag;
                    UpdateSizes();
                };
                if (controller == null)
                {
                    controller = raction;
                }
                raction.Tag = zoomLevel;
                smZoom.Items.Add(raction);
                zoomLevels.Add(zoomLevel, raction);
            }
            UpdateUI();
        }
Exemplo n.º 9
0
        public MainForm()
        {
            ClientSize = new Size(1024, 768);
            Maximize();

            Title = "OpenSAGE Data Viewer";

            Icon = Icon.FromResource("OpenSage.DataViewer.Resources.AppIcon.ico");

            var quitCommand = new Command((sender, e) => Application.Instance.Quit())
            {
                MenuText = "Quit",
                Shortcut = Application.Instance.CommonModifier | Keys.Q
            };

            _installationsMenuItem = new ButtonMenuItem {
                Text = "&Installation"
            };
            RadioCommand firstInstallationCommand = null;

            var installations = InstallationUtility.FindInstallations();

            foreach (var installation in installations)
            {
                var installationCommand = new RadioCommand((sender, e) => ChangeInstallation(installation))
                {
                    MenuText = installation.Game.DisplayName.Replace("&", "&&")
                };

                if (firstInstallationCommand == null)
                {
                    firstInstallationCommand = installationCommand;
                }
                else
                {
                    installationCommand.Controller = firstInstallationCommand;
                }

                _installationsMenuItem.Items.Add(installationCommand);
            }

            Menu = new MenuBar
            {
                Items =
                {
                    _installationsMenuItem,
                },
                QuitItem = quitCommand
            };

            _installationImageView        = new ImageView();
            _installationImageView.Width  = 250;
            _installationImageView.Height = 187;

            var contentView = new ContentView(() => _installation, () => _fileSystem);

            var filesList = new FilesList(this)
            {
                Width = 250
            };

            filesList.SelectedFileChanged += (sender, e) =>
            {
                contentView.SetContent(e.Entry);
            };

            var sidebar = new TableLayout(
                _installationImageView,
                filesList);

            Content = new Splitter
            {
                Panel1 = sidebar,
                Panel2 = contentView
            };
        }
Exemplo n.º 10
0
        void CreateMenuToolBar()
        {
            var about = new Commands.About();
            var quit  = new Commands.Quit();

            if (Platform.Supports <MenuBar>())
            {
                var saveSettingsItem = new CheckMenuItem {
                    Text = "Save Selected Section"
                };
                saveSettingsItem.Bind(c => c.Checked, TestApplication.Settings, s => s.SaveInitialSection);

                var fileCommand = new Command {
                    MenuText = "File Command", Shortcut = Application.Instance.CommonModifier | Keys.F
                };
                fileCommand.Executed += (sender, e) => Log.Write(sender, "Executed");
                var editCommand = new Command {
                    MenuText = "Edit Command", Shortcut = Keys.Shift | Keys.E
                };
                editCommand.Executed += (sender, e) => Log.Write(sender, "Executed");
                var viewCommand = new Command {
                    MenuText = "View Command", Shortcut = Keys.Control | Keys.Shift | Keys.V
                };
                viewCommand.Executed += (sender, e) => Log.Write(sender, "Executed");
                var windowCommand = new Command {
                    MenuText = "Window Command"
                };
                windowCommand.Executed += (sender, e) => Log.Write(sender, "Executed");

                var crashCommand = new Command {
                    MenuText = "Test Exception"
                };
                crashCommand.Executed += (sender, e) =>
                {
                    throw new InvalidOperationException("This is the exception message");
                };

                var subMenu = new SubMenuItem {
                    Text = "Sub Menu"
                };
                subMenu.Items.Add(new ButtonMenuItem {
                    Text = "Item 1"
                });
                subMenu.Items.Add(new ButtonMenuItem {
                    Text = "Item 2"
                });
                subMenu.Items.Add(new ButtonMenuItem {
                    Text = "Item 3"
                });

                var file = new SubMenuItem {
                    Text = "&File", Items = { saveSettingsItem, fileCommand, crashCommand }
                };
                var edit = new SubMenuItem {
                    Text = "&Edit", Items = { editCommand, subMenu }
                };
                var view = new SubMenuItem {
                    Text = "&View", Items = { viewCommand }
                };
                var window = new SubMenuItem {
                    Text = "&Window", Order = 1000, Items = { windowCommand }
                };

                if (Platform.Supports <CheckMenuItem>())
                {
                    edit.Items.AddSeparator();

                    var checkMenuItem1 = new CheckMenuItem {
                        Text = "Check Menu Item", Shortcut = Keys.Shift | Keys.K
                    };
                    checkMenuItem1.Click          += (sender, e) => Log.Write(sender, "Click, {0}, Checked: {1}", checkMenuItem1.Text, checkMenuItem1.Checked);
                    checkMenuItem1.CheckedChanged += (sender, e) => Log.Write(sender, "CheckedChanged, {0}: {1}", checkMenuItem1.Text, checkMenuItem1.Checked);
                    edit.Items.Add(checkMenuItem1);

                    var checkMenuItem2 = new CheckMenuItem {
                        Text = "Initially Checked Menu Item", Checked = true
                    };
                    checkMenuItem2.Click          += (sender, e) => Log.Write(sender, "Click, {0}, Checked: {1}", checkMenuItem2.Text, checkMenuItem2.Checked);
                    checkMenuItem2.CheckedChanged += (sender, e) => Log.Write(sender, "CheckedChanged, {0}: {1}", checkMenuItem2.Text, checkMenuItem2.Checked);
                    edit.Items.Add(checkMenuItem2);

                    var checkMenuItem3 = new CheckCommand {
                        MenuText = "Check Command", Shortcut = Keys.Shift | Keys.K
                    };
                    checkMenuItem3.Executed       += (sender, e) => Log.Write(sender, "Executed, {0}, Checked: {1}", checkMenuItem3.MenuText, checkMenuItem3.Checked);
                    checkMenuItem3.CheckedChanged += (sender, e) => Log.Write(sender, "CheckedChanged, {0}: {1}", checkMenuItem3.MenuText, checkMenuItem3.Checked);
                    edit.Items.Add(checkMenuItem3);

                    checkMenuItem1.Click += (sender, e) => checkMenuItem3.Checked = !checkMenuItem3.Checked;
                }

                if (Platform.Supports <RadioMenuItem>())
                {
                    edit.Items.AddSeparator();

                    RadioMenuItem controller = null;
                    for (int i = 0; i < 5; i++)
                    {
                        var radio = new RadioMenuItem(controller)
                        {
                            Text = "Radio Menu Item " + (i + 1)
                        };
                        if (controller == null)
                        {
                            radio.Checked = true;                             // check the first item initially
                            controller    = radio;
                        }
                        radio.Click          += (sender, e) => Log.Write(radio, "Click, {0}, Checked: {1}", radio.Text, radio.Checked);
                        radio.CheckedChanged += (sender, e) => Log.Write(radio, "CheckedChanged, {0}: {1}", radio.Text, radio.Checked);
                        edit.Items.Add(radio);
                    }

                    edit.Items.AddSeparator();

                    RadioCommand commandController = null;
                    for (int i = 0; i < 2; i++)
                    {
                        var radio = new RadioCommand {
                            MenuText = "Radio Command " + (i + 1), Controller = commandController
                        };
                        if (commandController == null)
                        {
                            radio.Checked     = true;                         // check the first item initially
                            commandController = radio;
                        }
                        radio.Executed       += (sender, e) => Log.Write(radio, "Executed, {0}, Checked: {1}", radio.MenuText, radio.Checked);
                        radio.CheckedChanged += (sender, e) => Log.Write(radio, "CheckedChanged, {0}: {1}", radio.MenuText, radio.Checked);
                        edit.Items.Add(radio);
                    }
                }

                edit.Items.AddSeparator();
                var hiddenItem = new ButtonMenuItem {
                    Text = "This button should not be visible!", Visible = false
                };
                var toggleHiddenItem = new ButtonMenuItem {
                    Text = "Toggle Hidden Item"
                };
                toggleHiddenItem.Click += (sender, e) => hiddenItem.Visible = !hiddenItem.Visible;
                edit.Items.Add(hiddenItem);
                edit.Items.Add(toggleHiddenItem);


                Menu = new MenuBar
                {
                    Items =
                    {
                        // custom top-level menu items
                        file, edit, view, window
                    },
                    ApplicationItems =
                    {
                        // custom menu items for the application menu (Application on OS X, File on others)
                        new Command        {
                            MenuText = "Application command"
                        },
                        new ButtonMenuItem {
                            Text = "Application menu item"
                        }
                    },
                    HelpItems =
                    {
                        new Command {
                            MenuText = "Help Command"
                        }
                    },
                    QuitItem  = quit,
                    AboutItem = about
                };
            }

            if (Platform.Supports <ToolBar>())
            {
                // create and set the toolbar
                ToolBar = new ToolBar();

                ToolBar.Items.Add(about);
                if (Platform.Supports <CheckToolItem>())
                {
                    ToolBar.Items.Add(new SeparatorToolItem {
                        Type = SeparatorToolItemType.Divider
                    });
                    ToolBar.Items.Add(LogEvents(new CheckToolItem {
                        Text = "Check", Image = TestIcons.TestImage
                    }));
                }
                ToolBar.Items.Add(new SeparatorToolItem {
                    Type = SeparatorToolItemType.Space
                });
                ButtonToolItem clickButton = LogEvents(new ButtonToolItem {
                    Text = "Click Me", Image = TestIcons.Logo
                });
                ToolBar.Items.Add(clickButton);
                if (Platform.Supports <RadioToolItem>())
                {
                    ToolBar.Items.Add(new SeparatorToolItem {
                        Type = SeparatorToolItemType.FlexibleSpace
                    });
                    ToolBar.Items.Add(LogEvents(new RadioToolItem {
                        Text = "Radio1", Image = TestIcons.Logo, Checked = true
                    }));
                    ToolBar.Items.Add(LogEvents(new RadioToolItem {
                        Text = "Radio2", Image = TestIcons.TestImage
                    }));
                    ToolBar.Items.Add(LogEvents(new RadioToolItem {
                        Text = "Radio3 (Disabled)", Image = TestIcons.TestImage, Enabled = false
                    }));
                }

                // add an invisible button and separator and allow them to be toggled.
                var invisibleButton = LogEvents(new ButtonToolItem {
                    Text = "Invisible", Visible = false
                });
                var sep = new SeparatorToolItem {
                    Type = SeparatorToolItemType.Divider, Visible = false
                };
                ToolBar.Items.Add(sep);
                ToolBar.Items.Add(invisibleButton);
                clickButton.Click += (sender, e) =>
                {
                    invisibleButton.Visible = !invisibleButton.Visible;
                    sep.Visible             = invisibleButton.Visible;
                };
            }
        }
Exemplo n.º 11
0
        public unsafe void SendToEachLink(RadioCommand command)
        {
            var func = (delegate * unmanaged[Thiscall] < ref RadioClass, RadioCommand, void >) this.GetVirtualFunctionPointer(160);

            func(ref this, command);
        }
Exemplo n.º 12
0
        public unsafe RadioCommand SendCommandWithData(RadioCommand command, ref Pointer <AbstractClass> pInOut, Pointer <TechnoClass> pRecipient)
        {
            var func = (delegate * unmanaged[Thiscall] < ref RadioClass, RadioCommand, IntPtr, IntPtr, RadioCommand >) this.GetVirtualFunctionPointer(159);

            return(func(ref this, command, pInOut.GetThisPointer(), pRecipient));
        }
Exemplo n.º 13
0
        public unsafe RadioCommand SendCommand(RadioCommand command, Pointer <TechnoClass> pRecipient)
        {
            var func = (delegate * unmanaged[Thiscall] < ref RadioClass, RadioCommand, IntPtr, RadioCommand >) this.GetVirtualFunctionPointer(158);

            return(func(ref this, command, pRecipient));
        }
Exemplo n.º 14
0
        public unsafe RadioCommand SendToFirstLink(RadioCommand command)
        {
            var func = (delegate * unmanaged[Thiscall] < ref RadioClass, RadioCommand, RadioCommand >) this.GetVirtualFunctionPointer(157);

            return(func(ref this, command));
        }