Exemplo n.º 1
0
        public virtual void CalcButtons()
        {
            List <ObjectState> buttonStates = new List <ObjectState>();

            if (controlView.CustomFilterPanelButtons.Count == LeftButtons.Count + RightButtons.Count)
            {
                GetButtonStates(buttonStates);
            }
            ClearButtons();
            for (int n = 0; n < controlView.CustomFilterPanelButtons.Count; n++)
            {
                EditorButton currentButton = controlView.CustomFilterPanelButtons[n];
                if (!currentButton.Visible)
                {
                    continue;
                }
                EditorButtonObjectInfoArgs currentButtonInfo = CreateButtonInfo(currentButton, n);
                if (buttonStates.Count != 0)
                {
                    currentButtonInfo.State = buttonStates[n];
                }
                else
                {
                    currentButtonInfo.State = ObjectState.Normal;
                }
                currentButtonInfo.Bounds = GetButtonBounds(currentButton, controlView);
                if (currentButton.IsLeft)
                {
                    LeftButtons.Add(currentButtonInfo);
                }
                else
                {
                    RightButtons.Add(currentButtonInfo);
                }
            }
            int buttonWidth = GetCustomButtonWidth();

            if (buttonWidth > 0)
            {
                сustomButtonsCountToDraw = (FilterPanel.Bounds.Width - GetCurrentActiveFilterButtonsWidth()) / buttonWidth;
            }
            else
            {
                сustomButtonsCountToDraw = 0;
            }
        }
Exemplo n.º 2
0
        public ExceptionDialogViewModel(CoreException exception, IAppService appService)
        {
            CloseCommand   = Make.UICommand.Do(() => Close());
            CopyCommand    = Make.UICommand.Do(() => appService.CopyToClipBoard(Detail));
            RestartCommand = Make.UICommand.Do(() => appService.Restart());
            ExitCommand    = Make.UICommand.Do(() => appService.Exit());
            ReportCommand  = Make.UICommand.Do(() => appService.SendMail(exception.Description, Detail));

            RightButtons.Add(new UICore.Buttons.ButtonViewModel(CloseCommand, "Continue"));
            RightButtons.Add(new UICore.Buttons.ButtonViewModel(RestartCommand, "Restart"));
            RightButtons.Add(new UICore.Buttons.ButtonViewModel(ExitCommand, "Exit"));

            LeftButtons.Add(new UICore.Buttons.ButtonViewModel(CopyCommand, "Copy"));
            LeftButtons.Add(new UICore.Buttons.ButtonViewModel(ReportCommand, "Report"));

            Detail = exception.Exception.Message + "\n" + exception.Exception.GetBaseException().StackTrace;
        }
Exemplo n.º 3
0
        private void UpdateCalculatorEnabled()
        {
            if (_isCalculatorEnabled)
            {
                _calculatorButton = new Button
                {
                    Image   = Properties.Resources.calculator,
                    Visible = Enabled
                };

                _calculatorButton.Click += _calculatorButton_Click;

                LeftButtons.Add(_calculatorButton);
            }
            else
            {
                LeftButtons.Remove(_calculatorButton);

                _calculatorButton.Dispose();
                _calculatorButton = null;
            }
        }
        protected override Rectangle CalcButtons(GraphicsCache cache)
        {
            bool autoFit = Item.TextEditStyle == TextEditStyles.HideTextEditor;
            EditorButtonCollection inpButtons = new EditorButtonCollection();

            if (this.OwnerEdit != null)
            {
                inpButtons = Item.Buttons;
            }
            else
            {
                inpButtons = ButtonsFromEditValue();
                //LeftButtons.Clear();
            }
            for (int n = 0; n < inpButtons.Count; n++)
            {
                EditorButton btn = inpButtons[n];
                if (!btn.Visible)
                {
                    continue;
                }
                EditorButtonObjectInfoArgs info = CreateButtonInfo(btn, n);
                info.FillBackground = FillBackground;
                CalcButtonState(info, n);
                info.Cache = cache;
                LeftButtons.Add(info);
            }
            CustomCalc targs = CreateCustomCalcButtonsRectsArgs(ClientRect);

            targs.UseAutoFit = false;
            targs.ViewInfo   = this;
            targs.Calc();
            RightButtons.SetCache(null);
            LeftButtons.SetCache(null);
            return(targs.ClientRect);
        }