Exemple #1
0
            private void CommandButton_Click(object sender, EventArgs e)
            {
                CommandButton commandButton = (CommandButton)sender;

                this.dialogResult = (TaskButton)commandButton.Tag;
                Close();
            }
 public static void DrawCommandButton(Rect rect, CommandButton commandButton)
 {
     if (GUI.Button(rect, commandButton.GetText()))
     {
         commandButton.OnHumanPlayerClick();
     }
 }
Exemple #3
0
        public RadialButton(Game game, GameObject owner, CommandButton commandButton, bool isHeroButton = false)
        {
            _game             = game;
            _owner            = owner;
            CommandButton     = commandButton;
            _objectDefinition = commandButton.Object?.Value ?? null;

            IsRecruitHeroButton = isHeroButton;

            _background = commandButton.ButtonImage.Value;
            _border     = _game.GetMappedImage("RadialBorder");
            _hover      = _game.GetMappedImage("RadialOver");
            _down       = _game.GetMappedImage("RadialPush");

            _width = _border.Coords.Width;

            _fontColor = new ColorRgbaF(0, 0, 0, 1); // _game.AssetStore.InGameUI.Current.DrawableCaptionColor.ToColorRgbaF(); -> this is white -> conflicts with the progress clock
            _fontSize  = _game.AssetStore.InGameUI.Current.DrawableCaptionPointSize;
            var fontWeight = _game.AssetStore.InGameUI.Current.DrawableCaptionBold ? FontWeight.Bold : FontWeight.Normal;

            _font = _game.ContentManager.FontManager.GetOrCreateFont(_game.AssetStore.InGameUI.Current.DrawableCaptionFont, _fontSize, fontWeight);

            _alphaMask = MappedImageUtility.CreateTexture(_game.GraphicsLoadContext, _game.GetMappedImage("RadialClockOverlay1"));

            //_scheme = game.AssetStore.ControlBarSchemes.FindBySide(game.Scene3D.LocalPlayer.Side);
        }
        public void Map_CommandButton_To_ConnectorParameters()
        {
            CommandButton button = new CommandButton
            {
                Id                = 1,
                ShortString       = "EDT",
                LongString        = "Edit",
                ButtonIcon        = "fa-step-forward",
                Cancel            = false,
                ClassString       = "btn-secondary",
                GridCommandButton = true,
                GridId            = 1
            };

            ConnectorParameters parameters = mapper.Map <ConnectorParameters>(button);
            CommandButtonData   data       = (CommandButtonData)parameters.ConnectorData;

            Assert.Equal(1, parameters.Id);
            Assert.Equal("EDT", parameters.ShortString);
            Assert.Equal("Edit", parameters.LongString);
            Assert.Equal("fa-step-forward", data.ButtonIcon);
            Assert.False(data.Cancel);
            Assert.Equal("btn-secondary", data.ClassString);
            Assert.True(data.GridCommandButton);
            Assert.Equal(1, data.GridId);
        }
        public void Map_ConnectorParameters_To_CommandButton()
        {
            ConnectorParameters parameters = new ConnectorParameters
            {
                Id            = 1,
                ShortString   = "EDT",
                LongString    = "Edit",
                ConnectorData = new CommandButtonData
                {
                    ButtonIcon        = "fa-step-forward",
                    Cancel            = false,
                    ClassString       = "btn-secondary",
                    GridCommandButton = true,
                    GridId            = 1
                }
            };

            CommandButton button = mapper.Map <CommandButton>(parameters);

            Assert.Equal(1, button.Id);
            Assert.Equal("EDT", button.ShortString);
            Assert.Equal("Edit", button.LongString);
            Assert.Equal("fa-step-forward", button.ButtonIcon);
            Assert.False(button.Cancel);
            Assert.Equal("btn-secondary", button.ClassString);
            Assert.True(button.GridCommandButton);
            Assert.Equal(1, button.GridId);
        }
        void OnButtonClick(object s, EventArgs e)
        {
            CommandButton b = (s as CommandButton);

            if (b.Text == Resources.RequestMaintainance)
            {
                Maintainance maintainance = new Maintainance();
                maintainance.Show(this);
            }
            else if (b.Text == Resources.RequestStudentCard)
            {
                StudentCard studentCard = new StudentCard();
                studentCard.Show(this);
            }
            else if (b.Text == Resources.RequestATMCard)
            {
                ATMCard card = new ATMCard();
                card.Show();
            }
            else if (b.Text == Resources.RequestCarLicense)
            {
                CarBadge car = new CarBadge();
                car.Show();
            }
            else
            {
                Close();
            }
        }
Exemple #7
0
        protected void CheckAuthorization(Control ctrl)
        {
            CommandButton item = (CommandButton)ctrl;

            if (SecurityManager.IsAuditor())
            {
                item.Enabled = false;
            }

            //else if (SecurityManager.IsAOperator())
            //{
            //    /// operator (add, edit, print)
            //    if (item.CommandType == CommandButton.enCommandType.Save || item.CommandType == CommandButton.enCommandType.Add || item.CommandType == CommandButton.enCommandType.Edit || item.CommandType == CommandButton.enCommandType.Print)
            //        item.Enabled = true;
            //    else
            //        item.Enabled = false;
            //}
            //else if (SecurityManager.IsAdministrator())
            //{
            //    if (item.CommandType == CommandButton.enCommandType.Add)
            //        item.Enabled = false;
            //    else
            //        item.Enabled = true;
            //}
            //else if (SecurityManager.IsManager())
            //{
            //    item.Enabled = true;
            //}

            if (item.CommandType == CommandButton.enCommandType.SearchL || item.CommandType == CommandButton.enCommandType.SearchS || item.CommandType == CommandButton.enCommandType.Close || item.CommandType == CommandButton.enCommandType.No || item.CommandType == CommandButton.enCommandType.Yes)
            {
                item.Enabled = true;
            }
        }
    public void SetCommandButton(CommandButton buttonToSet)
    {
        int buttonIndex = (int)buttonToSet.gridButton;

        commandButtons[buttonIndex]      = buttonToSet;
        commandButtonActive[buttonIndex] = true;
    }
Exemple #9
0
        private void BaseForm_Load(object sender, EventArgs e)
        {
            foreach (Control obj in this.Controls)
            {
                if (obj is CommandButton)
                {
                    CommandButton cmd = (CommandButton)obj;
                    switch (cmd.CommandType)
                    {
                    case CommandButton.enCommandType.Add:
                        cmdAdd = cmd;
                        break;

                    case CommandButton.enCommandType.Edit:
                        cmdEdit = cmd;
                        break;

                    case CommandButton.enCommandType.Delete:
                        cmdDelete = cmd;
                        break;

                    case CommandButton.enCommandType.Save:
                        cmdSave = cmd;
                        break;

                    case CommandButton.enCommandType.Print:
                        cmdPrint = cmd;
                        break;
                    }

                    CheckAuthorization(obj);
                }
            }
        }
Exemple #10
0
        private async void CommandButton_Clicked(object sender, EventArgs e)
        {
            CommandButton button     = sender as CommandButton;
            CommandDef    commandDef = (sender as CommandButton)?.CommandDef;

            if (commandDef == null)
            {
                return;
            }

            if (commandDef.UserInput)
            {
                string result = await DisplayPromptAsync(commandDef.PromptTitle, commandDef.PromptMessage);

                if (!string.IsNullOrEmpty(result))
                {
                    string cmd = string.Format(commandDef.CommandFormat, result);
                    DisplayCommandResponse(_piSystemClient?.Post(cmd));
                }
            }
            else
            {
                if (commandDef.UserConfirm)
                {
                    bool answer = await DisplayAlert(commandDef.Name, "Do you really want to send the command?", "Yes", "Cancel");

                    if (!answer)
                    {
                        return;
                    }
                }
                DisplayCommandResponse(_piSystemClient?.Post(commandDef.Command));
            }
        }
Exemple #11
0
        /// <summary>
        /// A Action delegate which is restore button image as default
        /// and execute button's Command with CommandParameter. </summary>
        private void ExecuteTapCommand()
        {
            CommandButton BtnCommand = Element as CommandButton;

            BtnCommand?.Command?.Execute(BtnCommand.CommandParameter);
            KeyUp();
        }
Exemple #12
0
        public void LoadButtons(string screen, PlanClickCallback callback)
        {
            Controls.Clear();

            buttons      = DB.Execute.ReadPlanButtons(screen);
            setFlowBreak = buttons.Count < 6;
            if (setFlowBreak)
            {
                int x = (Screen.PrimaryScreen.Bounds.Width - CommandButton.DefaultWidth) / 2;
                Padding = new Padding(x, 250, 0, 0);
            }
            else
            {
                Padding = new Padding(50, 150, 50, 0);
            }
            foreach (var button in buttons)
            {
                string        text    = Tools.ReadPlanResource(button.Key);
                CommandButton command = new CommandButton(text)
                {
                    Tag = button.Value
                };
                command.MouseUp += OnCommandClick;
                Controls.Add(command);
            }

            if (PlanClick == null)
            {
                PlanClick += callback;
            }
        }
Exemple #13
0
 public void Update()
 {
     if (_commandsButton && _commandsButton.GetComponent<RectTransform>().anchoredPosition.y >= _maxCommandY)
     {
         _commandsButton.Kill();
         _commandsButton = null;
     }
 }
Exemple #14
0
 public void ResetSelection(CommandButton button)
 {
     if (selectedButton != null)
     {
         selectedButton.ClearSelection();
     }
     selectedButton = button;
 }
Exemple #15
0
            private void InitCommandButtons()
            {
                SuspendLayout();

                if (this.commandButtons != null)
                {
                    foreach (CommandButton commandButton in this.commandButtons)
                    {
                        Controls.Remove(commandButton);
                        commandButton.Tag    = null;
                        commandButton.Click -= CommandButton_Click;
                        commandButton.Dispose();
                    }

                    this.commandButtons = null;
                }

                this.commandButtons = new CommandButton[this.taskButtons.Length];

                IButtonControl newAcceptButton = null;
                IButtonControl newCancelButton = null;

                for (int i = 0; i < this.commandButtons.Length; ++i)
                {
                    TaskButton    taskButton    = this.taskButtons[i];
                    CommandButton commandButton = new CommandButton();

                    commandButton.ActionText      = taskButton.ActionText;
                    commandButton.ActionImage     = taskButton.Image;
                    commandButton.AutoSize        = true;
                    commandButton.ExplanationText = taskButton.ExplanationText;
                    commandButton.Tag             = taskButton;
                    commandButton.Click          += CommandButton_Click;

                    this.commandButtons[i] = commandButton;
                    Controls.Add(commandButton);

                    if (this.acceptTaskButton == taskButton)
                    {
                        newAcceptButton = commandButton;
                    }

                    if (this.cancelTaskButton == taskButton)
                    {
                        newCancelButton = commandButton;
                    }
                }

                AcceptButton = newAcceptButton;
                CancelButton = newCancelButton;

                if (newAcceptButton != null && newAcceptButton is Control)
                {
                    ((Control)newAcceptButton).Select();
                }

                ResumeLayout();
            }
Exemple #16
0
        private void SetButton(CommandButton button, int index)
        {
            switch (button)
            {
            case CommandButton.Add:
                commandBarStripElementMain.Items.Insert(index, cmdBtnAdd);
                break;

            case CommandButton.Cancel:
                commandBarStripElementMain.Items.Insert(index, cmdBtnCancel);
                break;

            case CommandButton.Close:
                commandBarStripElementMain.Items.Insert(index, cmdBtnClose);
                break;

            case CommandButton.Submit:
                commandBarStripElementMain.Items.Insert(index, cmdBtnSubmit);
                break;

            case CommandButton.Delete:
                commandBarStripElementMain.Items.Insert(index, cmdBtnDelete);
                break;

            case CommandButton.Edit:
                commandBarStripElementMain.Items.Insert(index, cmdBtnEdit);
                break;

            case CommandButton.Export:
                commandBarStripElementMain.Items.Insert(index, cmdBtnExport);
                break;

            case CommandButton.Help:
                commandBarStripElementMain.Items.Insert(index, cmdBtnHelp);
                break;

            case CommandButton.Import:
                commandBarStripElementMain.Items.Insert(index, cmdBtnImport);
                break;

            case CommandButton.Print:
                commandBarStripElementMain.Items.Insert(index, cmdBtnPrint);
                break;

            case CommandButton.Query:
                commandBarStripElementMain.Items.Insert(index, cmdBtnQuery);
                break;

            case CommandButton.RefreshData:
                commandBarStripElementMain.Items.Insert(index, cmdBtnRefresh);
                break;

            case CommandButton.Save:
                commandBarStripElementMain.Items.Insert(index, cmdBtnSave);
                break;
            }
        }
    public void ResetSelection(CommandButton button)
    {
        if(selectedButton != null)
        {
            selectedButton .ClearSelection();
        }

        selectedButton = button;
    }
    void ChangeGridButton(CommandButton button)
    {
        int buttonIndex = (int)button.gridButton;

        commandButtons[buttonIndex].interactable = true;
        commandButtons[buttonIndex].GetComponent <Image>().sprite        = button.icon;
        commandButtons[buttonIndex].GetComponentInChildren <Text>().text = button.invokeKey.ToUpper();
        commandController.SetCommandButton(button);
    }
Exemple #19
0
    public void Start()
    {
        _spawnPosition = transform.GetChild(0).position;
        var newInstance = (GameObject) Instantiate(CommandPrefabs[0], _spawnPosition, Quaternion.identity);
        newInstance.transform.SetParent(transform);
        _commandsButton = newInstance.GetComponent<CommandButton>();

        var rect = GetComponent<RectTransform>().rect;
        _maxCommandY = rect.height * DeadZoneRatio + rect.yMin;
    }
    public bool InvokeCommandButton(int buttonIndex) // UI Button or Key pressed
    {
        CommandButton button = commandButtons[buttonIndex];

        if (button != null)
        {
            return(button.commandActionResponse.DoCommandAction(this, button.commandActionResponse.key));;
        }
        return(false);
    }
    IEnumerator CreateUnits()
    {
        while (true)
        {
            List <Transform>     receivers = new List <Transform>();
            List <CommandButton> buttons   = new List <CommandButton>();
            int receiverCount = 0;

            //поиск кнопок определенного типа в объектах игрока
            foreach (Transform obj in _player.ObjectList)
            {
                ObjectInfo objInfo = obj.GetComponent <ObjectInfo>();
                if (objInfo != null)
                {
                    List <Type> buttonTypeList = CommandButtonTypeGetter.GetCommandButtonTypes(objInfo.CommandButtonInfoArray);

                    if (buttonTypeList.Count == 0)
                    {
                        continue;
                    }

                    bool hasButtons = false;
                    foreach (Type buttonType in buttonTypeList)
                    {
                        CommandButton cb = FindButtonOfType(_player.AvailableCommandButtons, buttonType, typeof(CreateSkeleton_Button));
                        if (cb != null)
                        {
                            buttons.Add(cb);
                            hasButtons = true;
                            break; //Для упрощения, пока-что берется только первая кнопка
                        }
                    }

                    //если у объекта есть нужная кнопка, то добавляем его в список получателей команды
                    if (hasButtons)
                    {
                        receivers.Add(obj);
                        receiverCount++;
                        if (receiverCount == MaxCreatedUnitsPerCreatingInterval)
                        {
                            break;
                        }
                    }
                }
            }

            //выполнение действия для каждой кнопки в списке
            foreach (CommandButton cb in buttons)
            {
                cb.OnCompPlayerClick(receivers);
            }

            yield return(new WaitForSeconds(UnitsCreatingInterval));
        }
    }
Exemple #22
0
        public static void SetCommandButton(Button buttonControl, CommandButton commandButton, GeneralsControlBar controlBar)
        {
            buttonControl.BackgroundImage = buttonControl.Window.ImageLoader.CreateFromMappedImageReference(commandButton.ButtonImage);

            buttonControl.DisabledBackgroundImage = buttonControl.BackgroundImage?.WithGrayscale(true);

            buttonControl.BorderColor = GetBorderColor(commandButton.ButtonBorderType, controlBar.Scheme).ToColorRgbaF();
            buttonControl.BorderWidth = 1;

            buttonControl.HoverOverlayImage  = controlBar.CommandButtonHover;
            buttonControl.PushedOverlayImage = controlBar.CommandButtonPush;

            var objectDefinition = commandButton.Object?.Value;

            buttonControl.SystemCallback = (control, message, context) =>
            {
                Logger.Debug($"Button callback: {control.Name}, {commandButton.Command}");
                Logger.Debug($"Relevant object: {objectDefinition?.Name}");

                CommandButtonCallback.HandleCommand(context.Game, commandButton, objectDefinition, false);
            };

            buttonControl.InputCallback = (control, message, context) =>
            {
                //TODO: fix the commandbutton description
                var windowManager = buttonControl.Window.Game.Scene2D.WndWindowManager;
                if (message.MessageType == WndWindowMessageType.MouseEnter)
                {
                    var name        = commandButton.TextLabel.Translate();
                    var description = commandButton.DescriptLabel.Translate();
                    var cost        = "";

                    // TODO: set the string correctly
                    switch (commandButton.Command)
                    {
                    case CommandType.DozerConstruct:
                    case CommandType.UnitBuild:
                        cost = commandButton.Object.Value.BuildCost.ToString();
                        break;

                    case CommandType.PurchaseScience:
                        cost        = commandButton.Science[0].Value.SciencePurchasePointCost.ToString();
                        description = commandButton.Science[0].Value.Description.Translate();
                        break;
                    }
                    controlBar.ShowDescription(name, cost, description);
                }
                else if (message.MessageType == WndWindowMessageType.MouseExit)
                {
                    controlBar.HideDescription();
                }

                control.DefaultInput(control, message, context);
            };
        }
Exemple #23
0
 public CommandElement(CommandDirection direction, CommandButton button, Int32?triggertime, Boolean helddown, Boolean nothingelse)
 {
     Direction        = direction;
     Buttons          = button;
     TriggerOnRelease = triggertime;
     HeldDown         = helddown;
     NothingElse      = nothingelse;
     Hash             = Direction.GetHashCode() ^ Buttons.GetHashCode() ^ TriggerOnRelease.GetValueOrDefault(0).GetHashCode() ^ HeldDown.GetHashCode() ^ NothingElse.GetHashCode();
     MatchHash1       = BuildHash1();
     MatchHash2       = BuildHash2();
 }
Exemple #24
0
        /// <summary>
        /// Execute LongTap command
        /// But the command will not executed if the Line gesture is executed.
        /// </summary>
        private void ExecuteLongTapCommand()
        {
            if (isCanceled)
            {
                return;
            }

            CommandButton BtnCommand = Element as CommandButton;

            BtnCommand?.LongTabCommand?.Execute(BtnCommand.CommandParameter);
        }
Exemple #25
0
        public DebugController(S8CommandParser parser, string title)
        {
            int y = 0;

            this.Title = title;

            var stepButton = new Button("Step", true)
            {
                X      = 0,
                Y      = y++,
                Width  = Dim.Fill(),
                Height = Dim.Fill()
            };

            //stepButton.ColorScheme =  Colors.TopLevel; ;

            var runButton = new Button("RUN", true)
            {
                X      = 0,
                Y      = y++,
                Width  = Dim.Fill(),
                Height = Dim.Fill()
            };

            var resetButton = new Button("RESET", true)
            {
                X      = 0,
                Y      = y++,
                Width  = Dim.Fill(),
                Height = Dim.Fill()
            };


            this.Add(stepButton);
            this.Add(runButton);
            this.Add(resetButton);

            stepButton.Clicked += delegate()
            {
                CommandButton?.Invoke("STEP");
            };

            runButton.Clicked += delegate()
            {
                CommandButton?.Invoke("RUN!");
            };


            resetButton.Clicked += delegate()
            {
                CommandButton?.Invoke("RESET");
            };
        }
Exemple #26
0
        /// <summary>
        /// Register touch event callback for the Tap, the Long Tap and the Line behaviour. </summary>
        /// <remarks>
        /// When the button is touched, This class should change the image for each touch down/up situation.
        /// Even a button touching  starts at the Tap touch down, but touch up will be happen in several situations such as the Tap, the Long Tap, the Line.
        /// </remarks>
        /// <param name="args"> A Image element changed event's argument </param>
        protected override void OnElementChanged(ElementChangedEventArgs <Xamarin.Forms.Image> args)
        {
            base.OnElementChanged(args);

            if (Control == null ||
                Element == null)
            {
                return;
            }

            if (GestureRecognizer == null)
            {
                GestureRecognizer = new ElmSharp.GestureLayer(Control);
                GestureRecognizer.Attach(Control);
                GestureRecognizer.LongTapTimeout = 0.001;
            }

            if (args.NewElement == null)
            {
                GestureRecognizer.SetTapCallback(ElmSharp.GestureLayer.GestureType.Tap, ElmSharp.GestureLayer.GestureState.Start, null);
                GestureRecognizer.SetTapCallback(ElmSharp.GestureLayer.GestureType.Tap, ElmSharp.GestureLayer.GestureState.End, null);
                GestureRecognizer.SetTapCallback(ElmSharp.GestureLayer.GestureType.LongTap, ElmSharp.GestureLayer.GestureState.End, null);
                GestureRecognizer.SetLineCallback(ElmSharp.GestureLayer.GestureState.End, null);
                return;
            }

            Image         imageControl = Control as Image;
            CommandButton BtnElement   = Element as CommandButton;

            if (BtnElement == null)
            {
                return;
            }

            imageControl.Color = RegularColor;

            GestureRecognizer.SetTapCallback(ElmSharp.GestureLayer.GestureType.Tap, ElmSharp.GestureLayer.GestureState.Start, x =>
            {
                KeyDown();
            });
            GestureRecognizer.SetTapCallback(ElmSharp.GestureLayer.GestureType.Tap, ElmSharp.GestureLayer.GestureState.End, x =>
            {
                KeyUp();
            });
            GestureRecognizer.SetTapCallback(ElmSharp.GestureLayer.GestureType.LongTap, ElmSharp.GestureLayer.GestureState.End, x =>
            {
                KeyUp();
            });
            GestureRecognizer.SetLineCallback(GestureLayer.GestureState.End, x =>
            {
                KeyUp();
            });
        }
Exemple #27
0
 public (int, float) GetCountAndProgress(CommandButton button)
 {
     //check upgrades here first (object upgrades e.g. upgrade barracks to level 2 have object AND upgrade)
     if (button.Upgrade != null && button.Upgrade.Value != null)
     {
         return(GetCountAndProgress(button.Upgrade.Value));
     }
     if (button.Object != null && button.Object.Value != null)
     {
         return(GetCountAndProgress(button.Object.Value));
     }
     return(0, 0.0f);
 }
Exemple #28
0
        /// <summary>
        /// 往幻灯片中添加按钮
        /// </summary>
        /// <param name="slide"></param>
        /// <param name="left"></param>
        /// <param name="top"></param>
        /// <param name="width"></param>
        /// <param name="height"></param>
        private void AddSubmitOleForm(Slide slide, Single left, Single top, Single width, Single height, string buttonName, string shapeName)
        {
            var oleControl = slide.Shapes.AddOLEObject(left, top, width, height, "Forms.CommandButton.1", "",
                                                       MsoTriState.msoFalse, "", 0, "", MsoTriState.msoFalse).Name = shapeName;

            OLEFormat     oleF   = slide.Shapes[shapeName].OLEFormat;
            CommandButton button = (CommandButton)oleF.Object;

            button.BackColor = 92 + 173 * 256 + 255 * 256 * 256;
            button.ForeColor = 255 + 255 * 256 + 255 * 256 * 256;

            button.Caption  = buttonName;
            button.FontBold = true;
        }
    CommandButton CreateButton()
    {
        GameObject go = new GameObject("CommandButton");

        go.AddComponent <SpriteRenderer>();
        go.AddComponent <BoxCollider2D>();

        go.transform.parent = transform;

        CommandButton button = go.AddComponent <CommandButton>();

        button.Init(this);
        return(button);
    }
Exemple #30
0
    void Start()
    {
        m_cinderella    = FindObjectOfType <CinderellaController>();
        m_commandButton = FindObjectOfType <CommandButton>();
        m_Lifecounter   = GameObject.Find("LifeCounter");

        lifeCounter = m_Lifecounter.GetComponent <LifeCounter>();

        if (FadeManager.Instance != null)
        {
            FadeManager.Instance.FadeIn();
        }
        SoundManager.Instance.StopBGM();
        Invoke(((System.Action)LatePlayBGM).Method.Name, 1.0f);
    }
        public void Build(GameController controller, RectTransform holder)
        {
            buttons = new List <GameObject>();

            buttons.Add((GameObject)Resources.Load("GreenButton"));
            buttons.Add((GameObject)Resources.Load("RedButton"));

            foreach (Vector3 position in positions)
            {
                CommandButton button = GameObject.Instantiate(GetNextObject()).GetComponent <CommandButton>();
                button.transform.parent        = holder;
                button.transform.localPosition = position;
                button.Setup(controller);
                index++;
            }
        }
Exemple #32
0
 public void SelectButton(CommandButton button)
 {
     if (selectedButton != null)
     {
         selectedButton.ClearSelection();
     }
     selectedButton = button;
     if (selectedButton != null)
     {
         MessagingManager.Instance.BroadcastInventoryEvent(selectedButton.Item);
     }
     else
     {
         MessagingManager.Instance.BroadcastInventoryEvent(null);
     }
 }
Exemple #33
0
        public ViewPlan(string pdf)
        {
            web = new WebBrowser {
                Dock = DockStyle.Fill,
            };
            web.Navigate(pdf + "#toolbar=0&navpanes=1&scrollbar=1");

            button = new CommandButton(Resources.Close)
            {
                Location = new Point(5, 1),
                TabStop  = false,
            };
            prev = new CommandButton(">")
            {
                Location = new Point((Screen.PrimaryScreen.Bounds.Width - CommandButton.DefaultWidth - 5), 1),
                TabStop  = false,
            };
            next = new CommandButton("<")
            {
                Location = new Point((Screen.PrimaryScreen.Bounds.Width - CommandButton.DefaultWidth - 5) - prev.Width, 1),
                TabStop  = false,
            };

            button.Click += (s, e) => { this.Close(); };
            prev.Click   += (s, e) => {
                web.Focus();
                Application.DoEvents();
                SendKeys.Send("{PGUP}");
            };
            next.Click += (s, e) => {
                web.Focus();
                Application.DoEvents();
                SendKeys.Send("{PGDN}");
            };

            panel = new Panel {
                Dock   = DockStyle.Bottom,
                Height = CommandButton.DefaultHeight + 2,
            };
            panel.Controls.Add(button);
            panel.Controls.Add(prev);
            panel.Controls.Add(next);

            this.Controls.Add(panel);
            //this.Controls.Add(pic);
            this.Controls.Add(web);
        }
    public void Selectbutton(CommandButton button)
    {
        if(selectedButton != null)
        {
            selectedButton.ClearSelection();
        }

        selectedButton = button;

        if(selectedButton != null)
        {
            MessagingManager.Instance.BroadcastInventoryEvent(selectedButton.Item);
        }else
        {
            MessagingManager.Instance.BroadcastInventoryEvent(null);
        }
    }
Exemple #35
0
        internal void ResetButtons(CommandButton[] buttons)
        {
            RemoveCommandButtons();
            for (var i = 0; i < buttons.Length; i++)
            {
                SetButton(buttons[i], i);
            }

            ResetButtonStatus();
        }
Exemple #36
0
 private void SetButton(CommandButton button, int index)
 {
     switch (button)
     {
         case CommandButton.Add:
             commandBarStripElementMain.Items.Insert(index, cmdBtnAdd);
             break;
         case CommandButton.Cancel:
             commandBarStripElementMain.Items.Insert(index, cmdBtnCancel);
             break;
         case CommandButton.Close:
             commandBarStripElementMain.Items.Insert(index, cmdBtnClose);
             break;
         case CommandButton.Submit:
             commandBarStripElementMain.Items.Insert(index, cmdBtnSubmit);
             break;
         case CommandButton.Delete:
             commandBarStripElementMain.Items.Insert(index, cmdBtnDelete);
             break;
         case CommandButton.Edit:
             commandBarStripElementMain.Items.Insert(index, cmdBtnEdit);
             break;
         case CommandButton.Export:
             commandBarStripElementMain.Items.Insert(index, cmdBtnExport);
             break;
         case CommandButton.Help:
             commandBarStripElementMain.Items.Insert(index, cmdBtnHelp);
             break;
         case CommandButton.Import:
             commandBarStripElementMain.Items.Insert(index, cmdBtnImport);
             break;
         case CommandButton.Print:
             commandBarStripElementMain.Items.Insert(index, cmdBtnPrint);
             break;
         case CommandButton.Query:
             commandBarStripElementMain.Items.Insert(index, cmdBtnQuery);
             break;
         case CommandButton.RefreshData:
             commandBarStripElementMain.Items.Insert(index, cmdBtnRefresh);
             break;
         case CommandButton.Save:
             commandBarStripElementMain.Items.Insert(index, cmdBtnSave);
             break;
     }
 }