示例#1
0
        public override void UpdateSkin(SkinBase skin)
        {
            var interactivityTarget = InteractivityTarget;

            UpdateSkin(Extension.GetSettersInternal(interactivityTarget, false), skin);
            UpdateSkin(Extension.GetTriggersInternal(interactivityTarget, false), skin);
        }
示例#2
0
        protected virtual void LayoutVertical(SkinBase skin)
        {
            int w = Width;
            int h = Height;

            if (m_Panel[0] != null)
            {
                Margin m = m_Panel[0].Margin;
                if (m_Scale[0])
                {
                    m_Panel[0].SetBounds(m.Left, m.Top, w - m.Left - m.Right, (h * 0.5f) - m.Top - m.Bottom);
                }
                else
                {
                    m_Panel[0].Position(Pos.Center, 0, (int)(h * -0.25f));
                }
            }

            if (m_Panel[1] != null)
            {
                Margin m = m_Panel[1].Margin;
                if (m_Scale[1])
                {
                    m_Panel[1].SetBounds(m.Left, m.Top + (h * 0.5f), w - m.Left - m.Right, (h * 0.5f) - m.Top - m.Bottom);
                }
                else
                {
                    m_Panel[1].Position(Pos.Center, 0, (int)(h * 0.25f));
                }
            }
        }
示例#3
0
 /// <summary>
 /// Renders the control using specified skin.
 /// </summary>
 /// <param name="skin">Skin to use.</param>
 protected override void Render(SkinBase skin)
 {
     if (ShouldDrawBackground)
     {
         skin.DrawTreeControl(this);
     }
 }
示例#4
0
 /// <summary>
 /// Function invoked after layout.
 /// </summary>
 /// <param name="skin">Skin to use.</param>
 protected override void PostLayout(SkinBase skin)
 {
     if (SizeToChildren(false, true))
     {
         InvalidateParent();
     }
 }
    protected void ButtonSave_Click(object sender, EventArgs e)
    {
        if (!Page.IsValid)
        {
            return;
        }

        int      selectedAddressId = int.Parse(BillingAddresses.SelectedValue);
        SkinBase page = HttpContext.Current.Handler as SkinBase;

        AspDotNetStorefrontCore.Customer adnsfCustomer = AspDotNetStorefrontCore.Customer.Current;

        string errorMessage, errorCode;

        this.PaymentProfileId = ProcessTools.SaveProfileAndPaymentProfile(adnsfCustomer.CustomerID, adnsfCustomer.EMail, AspDotNetStorefrontCore.AppLogic.AppConfig("StoreName"), this.PaymentProfileId, selectedAddressId, TextCreditCard.Text, TextCardSecurity.Text, ExpirationMonth.SelectedValue, ExpirationYear.SelectedValue, out errorMessage, out errorCode);

        if (PaymentProfileId <= 0)
        {
            ShowError(String.Format("{0} {1}", AspDotNetStorefrontCore.AppLogic.GetString("AspDotNetStorefrontGateways.AuthorizeNet.Cim.ErrorMessage", adnsfCustomer.SkinID, adnsfCustomer.LocaleSetting), errorMessage));
            return;
        }

        if (CBMakePrimaryCard.Checked)
        {
            AspDotNetStorefrontCore.Address adnsfAddress = new AspDotNetStorefrontCore.Address();
            adnsfAddress.LoadFromDB(selectedAddressId);
            adnsfAddress.MakeCustomersPrimaryAddress(AspDotNetStorefrontCore.AddressTypes.Billing);
            DataUtility.SetPrimaryPaymentProfile(adnsfCustomer.CustomerID, this.PaymentProfileId);
        }

        BindPage(this.PaymentProfileId);

        FireCardEditComplete();
    }
示例#6
0
        /// <summary>
        /// Renders the currently visible tooltip.
        /// </summary>
        /// <param name="skin"></param>
        public static void RenderToolTip(SkinBase skin)
        {
            if (null == g_ToolTip)
            {
                return;
            }

            RendererBase render = skin.Renderer;

            Point     oldRenderOffset = render.RenderOffset;
            Point     mousePos        = Input.InputHandler.MousePosition;
            Rectangle bounds          = g_ToolTip.ToolTip.Bounds;

            Rectangle offset = Util.FloatRect(mousePos.X - bounds.Width * 0.5f, mousePos.Y - bounds.Height - 10,
                                              bounds.Width, bounds.Height);

            offset = Util.ClampRectToRect(offset, g_ToolTip.GetCanvas().Bounds);

            //Calculate offset on screen bounds
            render.AddRenderOffset(offset);
            render.EndClip();

            skin.DrawToolTip(g_ToolTip.ToolTip);
            g_ToolTip.ToolTip.DoRender(skin);

            render.RenderOffset = oldRenderOffset;
        }
示例#7
0
        /// <summary>
        /// Lays out the control's interior according to alignment, padding, dock etc.
        /// </summary>
        /// <param name="skin">Skin to use.</param>
        protected override void Layout(SkinBase skin)
        {
            base.Layout(skin);

            m_ScrollButton[0].Height = Width;
            m_ScrollButton[0].Dock   = Pos.Top;

            m_ScrollButton[1].Height = Width;
            m_ScrollButton[1].Dock   = Pos.Bottom;

            m_Bar.Width   = ButtonSize;
            m_Bar.Padding = new Padding(0, ButtonSize, 0, ButtonSize);

            float barHeight = 0.0f;

            if (m_ContentSize > 0.0f)
            {
                barHeight = (m_ViewableContentSize / m_ContentSize) * (Height - (ButtonSize * 2));
            }

            if (barHeight < ButtonSize * 0.5f)
            {
                barHeight = (int)(ButtonSize * 0.5f);
            }

            m_Bar.Height   = (int)(barHeight);
            m_Bar.IsHidden = Height - (ButtonSize * 2) <= barHeight;

            //Based on our last scroll amount, produce a position for the bar
            if (!m_Bar.IsHeld)
            {
                SetScrollAmount(ScrollAmount, true);
            }
        }
示例#8
0
        /// <summary>
        /// Renders the control using specified skin.
        /// </summary>
        /// <param name="skin">Skin to use.</param>
        protected override void Render(SkinBase skin)
        {
            base.Render(skin);

            if (ShouldDrawBackground)
            {
                skin.DrawTextBox(this);
            }

            if (!HasFocus)
            {
                return;
            }

            // Draw selection.. if selected..
            if (m_CursorPos != m_CursorEnd)
            {
                skin.Renderer.DrawColor = Color.FromArgb(200, 50, 170, 255);
                skin.Renderer.DrawFilledRect(m_SelectionBounds);
            }

            // Draw caret
            float time = Platform.Neutral.GetTimeInSeconds() - m_LastInputTime;

            if ((time % 1.0f) <= 0.5f)
            {
                skin.Renderer.DrawColor = Color.Black;
                skin.Renderer.DrawFilledRect(m_CaretBounds);
            }
        }
示例#9
0
        public void Initialize(GraphicsDeviceManager graphicsDeviceManager)
        {
            _graphicsDeviceManager = graphicsDeviceManager;

            Platform.Init(new Gwen.Platform.MonoGame.MonoGamePlatform());
            Gwen.Loader.LoaderBase.Init(new Gwen.Loader.MonoGame.MonoGameAssetLoader(Game.Content));

            _renderer = new MonoGameRenderer(GraphicsDevice, Game.Content, Game.Content.Load <Effect>("Gwen/Shaders/GwenEffect"));
            _renderer.Resize(graphicsDeviceManager.PreferredBackBufferWidth, graphicsDeviceManager.PreferredBackBufferHeight);

            _skin             = new TexturedBase(_renderer, "Gwen/Skins/DefaultSkin");
            _skin.DefaultFont = new Font(_renderer, "Gwen/Fonts/Arial", 11);
            _canvas           = new Canvas(_skin);
            _input            = new MonoGameInput(Game);
            _input.Initialize(_canvas);

            _canvas.SetSize(graphicsDeviceManager.PreferredBackBufferWidth, graphicsDeviceManager.PreferredBackBufferHeight);
            _canvas.ShouldDrawBackground = false;
            _canvas.BackgroundColor      = new Gwen.Color(255, 150, 170, 170);

            graphicsDeviceManager.PreparingDeviceSettings += OnPreparingDeviceSettings;
            Game.Window.AllowUserResizing  = true;
            Game.IsMouseVisible            = true;
            Game.Window.ClientSizeChanged += OnClientSizeChanged;

            BuildUI();
        }
示例#10
0
        /// <summary>
        /// Function invoked after layout.
        /// </summary>
        /// <param name="skin">Skin to use.</param>
        protected override void PostLayout(SkinBase skin)
        {
            if (IsCollapsed)
            {
                Height = m_HeaderButton.Height;
            }
            else
            {
                SizeToChildren(false, true);
            }

            // alternate row coloring
            bool b = true;

            foreach (ControlBase child in Children)
            {
                CategoryButton button = child as CategoryButton;
                if (button == null)
                {
                    continue;
                }

                button.m_Alt = b;
                button.UpdateColors();
                b = !b;
            }
        }
示例#11
0
        /// <summary>
        /// Lays out the control's interior according to alignment, padding, dock etc.
        /// </summary>
        /// <param name="skin">Skin to use.</param>
        protected override void Layout(SkinBase skin)
        {
            base.Layout(skin);

            m_ScrollButton[0].Width = Height;
            m_ScrollButton[0].Dock  = Pos.Left;

            m_ScrollButton[1].Width = Height;
            m_ScrollButton[1].Dock  = Pos.Right;

            m_Bar.Height  = ButtonSize;
            m_Bar.Padding = new Padding(ButtonSize, 0, ButtonSize, 0);

            float barWidth = (m_ViewableContentSize / m_ContentSize) * (Width - (ButtonSize * 2));

            if (barWidth < ButtonSize * 0.5f)
            {
                barWidth = (int)(ButtonSize * 0.5f);
            }

            m_Bar.Width    = (int)(barWidth);
            m_Bar.IsHidden = Width - (ButtonSize * 2) <= barWidth;

            //Based on our last scroll amount, produce a position for the bar
            if (!m_Bar.IsHeld)
            {
                SetScrollAmount(ScrollAmount, true);
            }
        }
示例#12
0
 /// <summary>
 /// Function invoked after layout.
 /// </summary>
 /// <param name="skin">Skin to use.</param>
 protected override void PostLayout(SkinBase skin)
 {
     foreach (ControlBase child in Children) // ok?
     {
         child.Position(m_Pos);
     }
 }
示例#13
0
        /// <summary>
        /// Renders the control using specified skin.
        /// </summary>
        /// <param name="skin">Skin to use.</param>
        protected override void Render(SkinBase skin)
        {
            if (m_Alt)
            {
                if (IsDepressed || ToggleState)
                {
                    Skin.Renderer.DrawColor = skin.Colors.Category.LineAlt.Button_Selected;
                }
                else if (IsHovered)
                {
                    Skin.Renderer.DrawColor = skin.Colors.Category.LineAlt.Button_Hover;
                }
                else
                {
                    Skin.Renderer.DrawColor = skin.Colors.Category.LineAlt.Button;
                }
            }
            else
            {
                if (IsDepressed || ToggleState)
                {
                    Skin.Renderer.DrawColor = skin.Colors.Category.Line.Button_Selected;
                }
                else if (IsHovered)
                {
                    Skin.Renderer.DrawColor = skin.Colors.Category.Line.Button_Hover;
                }
                else
                {
                    Skin.Renderer.DrawColor = skin.Colors.Category.Line.Button;
                }
            }

            skin.Renderer.DrawFilledRect(RenderBounds);
        }
示例#14
0
 /// <summary>
 /// Renders the control using specified skin.
 /// </summary>
 /// <param name="skin">Skin to use.</param>
 protected override void Render(SkinBase skin)
 {
     if (ShouldDrawBackground)
     {
         skin.DrawButton(this, true, false, IsDisabled);
     }
 }
示例#15
0
        /// <summary>
        /// Lays out the control's interior according to alignment, padding, dock etc.
        /// </summary>
        /// <param name="skin">Skin to use.</param>
        protected override void Layout(SkinBase skin)
        {
            base.Layout(skin);

            Pos align = m_Align;

            if (m_AutoSizeToContents)
            {
                SizeToContents();
            }

            int x = m_TextPadding.Left + Padding.Left;
            int y = m_TextPadding.Top + Padding.Top;

            if (0 != (align & Pos.Right))
            {
                x = Width - m_Text.Width - m_TextPadding.Right - Padding.Right;
            }
            if (0 != (align & Pos.CenterH))
            {
                x = (int)((m_TextPadding.Left + Padding.Left) + ((Width - m_Text.Width - m_TextPadding.Left - Padding.Left - m_TextPadding.Right - Padding.Right) * 0.5f));
            }

            if (0 != (align & Pos.CenterV))
            {
                y = (int)((m_TextPadding.Top + Padding.Top) + ((Height - m_Text.Height) * 0.5f) - m_TextPadding.Bottom - Padding.Bottom);
            }
            if (0 != (align & Pos.Bottom))
            {
                y = Height - m_Text.Height - m_TextPadding.Bottom - Padding.Bottom;
            }

            m_Text.SetPosition(x, y);
        }
示例#16
0
 /// <summary>
 /// Lays out the control's interior according to alignment, padding, dock etc.
 /// </summary>
 /// <param name="skin">Skin to use.</param>
 protected override void Layout(SkinBase skin)
 {
     if (m_SubmenuArrow != null)
     {
         m_SubmenuArrow.Position(Pos.Right | Pos.CenterV, 4, 0);
     }
     base.Layout(skin);
 }
示例#17
0
 /// <summary>
 /// Lays out the control's interior according to alignment, padding, dock etc.
 /// </summary>
 /// <param name="skin">Skin to use.</param>
 protected override void Layout(SkinBase skin)
 {
     base.Layout(skin);
     if (AutoSizeToContents)
     {
         DoSizeToContents();
     }
 }
示例#18
0
 protected override void PostLayout(SkinBase skin)
 {
     base.PostLayout(skin);
     if (m_SizeToContents)
     {
         DoSizeToContents();
         m_SizeToContents = false;
     }
 }
        public void SetNewCurrent(ThemeModel themeModel)
        {
            if (currentskin != null)
            {
                currentskin.Unload();
            }

            currentskin = new ReferencedAssemblySkin(themeModel.ThemeName, new Uri(themeModel.ThemePath, UriKind.Relative), themeModel);
            OnCurrentSkinChange();
        }
示例#20
0
 protected override void Render(SkinBase skin)
 {
     if (ShouldDrawBackground)
     {
         skin.Renderer.DrawColor = Skin.Colors.ForegroundHighlight;
         var r = this.RenderBounds;
         skin.Renderer.DrawFilledRect(r);
     }
     base.Render(skin);
 }
示例#21
0
        /// <summary>
        /// Lays out the control's interior according to alignment, padding, dock etc.
        /// </summary>
        /// <param name="skin">Skin to use.</param>
        protected override void Layout(SkinBase skin)
        {
            if (null == Parent)
            {
                return;
            }

            //Move to our current position to force clamping - is this a hack?
            MoveTo(X, Y);
        }
示例#22
0
        private static void OnActualSkinChanged(DependencyObject dependencyObject, SkinBase oldSkin, SkinBase newSkin)
        {
            var frameworkElement     = (FrameworkElement)dependencyObject;
            var interactivityService = frameworkElement.GetInteractivityService();

            oldSkin?.OnDetachedInternal(frameworkElement);
            newSkin?.OnAttachedInternal(frameworkElement);

            interactivityService.OnSkinChanged(oldSkin, newSkin);
        }
示例#23
0
        internal FontHolder(SkinBase skin)
        {
            this.skin             = skin;
            skin.DefaultFont.Size = 15;

            Title    = Font.Create(skin.Renderer, FontName, size: 30);
            Subtitle = Font.Create(skin.Renderer, FontName, size: 10);
            Small    = Font.Create(skin.Renderer, FontName, size: 12);
            Path     = Font.Create(skin.Renderer, FontName, size: 10, FontStyle.Italic);
        }
示例#24
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Canvas"/> class.
        /// </summary>
        /// <param name="skin">Skin to use.</param>
        public Canvas(SkinBase skin)
        {
            SetBounds(0, 0, 10000, 10000);
            SetSkin(skin);
            Scale                = 1.0f;
            BackgroundColor      = Color.White;
            ShouldDrawBackground = false;

            m_DisposeQueue = new List <IDisposable>();
        }
示例#25
0
        /// <summary>
        /// Lays out the control's interior according to alignment, padding, dock etc.
        /// </summary>
        /// <param name="skin">Skin to use.</param>
        protected override void Layout(SkinBase skin)
        {
            base.Layout(skin);

            Align.PlaceDownLeft(m_Button, m_Label, 10);
            Align.CenterHorizontally(m_Button);
            m_InnerPanel.SizeToChildren();
            m_InnerPanel.Height += 10;
            SizeToChildren();
        }
示例#26
0
 protected override void Layout(SkinBase skin)
 {
     // ugly stuff because we don't have anchoring without docking (docking resizes children)
     if (m_Label.Height > m_RadioButton.Height) // usually radio is smaller than label so it gets repositioned to avoid clipping with negative Y
     {
         m_RadioButton.Y = (m_Label.Height - m_RadioButton.Height) / 2;
     }
     Align.PlaceRightBottom(m_Label, m_RadioButton);
     SizeToChildren();
     base.Layout(skin);
 }
示例#27
0
        /// <summary>
        /// Function invoked after layout.
        /// </summary>
        /// <param name="skin">Skin to use.</param>
        protected override void PostLayout(SkinBase skin)
        {
            m_SplitterBar.Height = 0;

            if (SizeToChildren(false, true))
            {
                InvalidateParent();
            }

            m_SplitterBar.SetSize(3, Height);
        }
        protected override void Render(SkinBase skin)
        {
            skin.Renderer.DrawColor = System.Drawing.Color.LightGray;
            var r = this.RenderBounds;

            r.X      += 1;
            r.Y      += 1;
            r.Width  -= 2;
            r.Height -= 2;
            skin.Renderer.DrawFilledRect(r);
            base.Render(skin);
        }
示例#29
0
文件: StyleRoot.cs 项目: Egaros/lib
        public override void UpdateSkin(SkinBase newSkin)
        {
            var service = StyleService.GetRuntimeService(InteractivityTarget);

            if (service == null)
            {
                return;
            }

            UpdateSkin(service.Setters, newSkin);
            UpdateSkin(service.Triggers, newSkin);
        }
示例#30
0
        /// <summary>
        /// Renders the control using specified skin.
        /// </summary>
        /// <param name="skin">Skin to use.</param>
        protected override void Render(SkinBase skin)
        {
            int bottom = 0;

            if (m_InnerPanel.Children.Count > 0)
            {
                bottom = m_InnerPanel.Children.Last().Y + m_InnerPanel.Y;
            }

            skin.DrawTreeNode(this, m_InnerPanel.IsVisible, IsSelected, m_Title.Height, m_Title.TextRight,
                              (int)(m_ToggleButton.Y + m_ToggleButton.Height * 0.5f), bottom, m_TreeControl == Parent); // IsRoot
        }