예제 #1
0
        static Button New(string label, int i, bool isDefault = false, bool isCancel = false)
        {
            var result = new Button()
            {
                Content = label, IsDefault = isDefault, IsCancel = isCancel
            };

            ButtonExtensions.SetResult(result, i);
            return(result);
        }
예제 #2
0
 public Buttons(Window window, params Button[] input) : base(input)
 {
     foreach (var i in this)
     {
         i.Command
             = WindowExtensions.CloseCommand;
         i.CommandParameter
             = ButtonExtensions.GetResult(i);
         i.CommandTarget
             = window;
     }
 }
        private void ConfigureToast()
        {
            // Configure toast display mode specific attributes
            ConfigureToastCustomizations();

            // Configure toast generic attributes
            switch (Style)
            {
                case Style.Info:
                    Content.Foreground = (SolidColorBrush)Application.Current.FindResource("Grey/White");

                    ButtonExtensions.SetIconUri(this, Application.Current.FindResource("close-white").ToString());

                    ButtonExtensions.SetBackground(this, (SolidColorBrush)Application.Current.FindResource("Blue/Blue 50"));
                    ButtonExtensions.SetHoverBackground(this, (SolidColorBrush)Application.Current.FindResource("Blue/Blue 70"));
                    ButtonExtensions.SetPressedBackground(this, (SolidColorBrush)Application.Current.FindResource("Blue/Blue 80"));

                    ButtonExtensions.SetSecondaryBackground(this, (SolidColorBrush)Application.Current.FindResource("Blue/Blue 60"));
                    ButtonExtensions.SetSecondaryHoverBackground(this, (SolidColorBrush)Application.Current.FindResource("Blue/Blue 70"));
                    ButtonExtensions.SetSecondaryPressedBackground(this, (SolidColorBrush)Application.Current.FindResource("Blue/Blue 80"));

                    break;

                case Style.Error:
                    Content.Foreground = (SolidColorBrush)Application.Current.FindResource("Grey/Grey 50");

                    ButtonExtensions.SetIconUri(this, Application.Current.FindResource("close").ToString());

                    ButtonExtensions.SetBackground(this, (SolidColorBrush)Application.Current.FindResource("Red/Red 40"));
                    ButtonExtensions.SetHoverBackground(this, (SolidColorBrush)Application.Current.FindResource("Red/Red 60"));
                    ButtonExtensions.SetPressedBackground(this, (SolidColorBrush)Application.Current.FindResource("Red/Red 70"));

                    ButtonExtensions.SetSecondaryBackground(this, (SolidColorBrush)Application.Current.FindResource("Red/Red 50"));
                    ButtonExtensions.SetSecondaryHoverBackground(this, (SolidColorBrush)Application.Current.FindResource("Red/Red 60"));
                    ButtonExtensions.SetSecondaryPressedBackground(this, (SolidColorBrush)Application.Current.FindResource("Red/Red 70"));

                    break;

                case Style.Success:
                    Content.Foreground = (SolidColorBrush)Application.Current.FindResource("Grey/Grey 50");

                    ButtonExtensions.SetIconUri(this, Application.Current.FindResource("close").ToString());

                    ButtonExtensions.SetBackground(this, (SolidColorBrush)Application.Current.FindResource("Green/Green 40"));
                    ButtonExtensions.SetHoverBackground(this, (SolidColorBrush)Application.Current.FindResource("Green/Green 60"));
                    ButtonExtensions.SetPressedBackground(this, (SolidColorBrush)Application.Current.FindResource("Green/Green 70"));

                    ButtonExtensions.SetSecondaryBackground(this, (SolidColorBrush)Application.Current.FindResource("Green/Green 50"));
                    ButtonExtensions.SetSecondaryHoverBackground(this, (SolidColorBrush)Application.Current.FindResource("Green/Green 60"));
                    ButtonExtensions.SetSecondaryPressedBackground(this, (SolidColorBrush)Application.Current.FindResource("Green/Green 70"));

                    break;

                default:
                    break;
            }

            // Configure toast main content
            Content.TextWrapping = TextWrapping.Wrap;
            Content.TextAlignment = TextAlignment.Center;
            ButtonExtensions.SetButtonContent(this, Content);
        }