Exemplo n.º 1
0
 public MessageBox(Graphics.TexturedQuad buttonFace, TextRenderer.IFormattedText[] buttonTexts)
 {
     m_commonButtons = new CommonButtons(buttonFace, buttonTexts);
     m_commonButtons.Dispatcher = this;
     m_commonButtons.ButtonClicked += btn =>
     {
         if (ButtonClicked != null)
         {
             ButtonClicked(btn);
         }
     };
     m_renderableProxy = new RenderableProxy(this);
 }
Exemplo n.º 2
0
        public NumberSelector(TextRenderer.IFormattedText[] digits, TextRenderer.IFormattedText[] signs, Graphics.TexturedQuad upButtonFace, Graphics.TexturedQuad downButtonFace,
            Graphics.TexturedQuad okCancelButtonFace, TextRenderer.IFormattedText[] okCancelTexts)
        {
            if (digits == null)
            {
                throw new ArgumentNullException("digits");
            }
            else if (digits.Length != 10 || digits.Contains(null))
            {
                throw new ArgumentException("Digits array is not provided appropriately.");
            }
            else if (signs == null)
            {
                throw new ArgumentNullException("signs");
            }
            else if (signs.Length != 2 || signs.Contains(null))
            {
                throw new ArgumentException("Signs array is not provided appropriately.");
            }
            else if (upButtonFace == null)
            {
                throw new ArgumentNullException("upButtonFace");
            }
            else if (downButtonFace == null)
            {
                throw new ArgumentNullException("downButtonFace");
            }
            else if (okCancelTexts == null)
            {
                throw new ArgumentNullException("okCancelTexts");
            }
            else if (okCancelTexts.Length != NumButtons || okCancelTexts.Contains(null))
            {
                throw new ArgumentException("OkCancelTexts array is not provided appropriately.");
            }

            m_digits = digits;
            m_signs = signs;
            m_upButtonFace = upButtonFace;
            m_downButtonFace = downButtonFace;

            var buttonTexts = new TextRenderer.IFormattedText[CommonButtons.NumButtons];
            buttonTexts[CommonButtons.ButtonOK] = okCancelTexts[ButtonOK];
            buttonTexts[CommonButtons.ButtonCancel] = okCancelTexts[ButtonCancel];
            m_commonButtons = new CommonButtons(okCancelButtonFace, buttonTexts);
            m_commonButtons.Dispatcher = this;
            m_commonButtons.ButtonClicked += btn =>
            {
                if (ButtonClicked != null)
                {
                    ButtonClicked(btn, CurrentValue);
                }
            };
            m_renderableProxy = new RenderableProxy(this);

            SetRange(0, 1);
        }