コード例 #1
0
        private void Login_Load(object sender, EventArgs e)
        {
            FillStyleGradientEx highlightGradient = new FillStyleGradientEx(Color.LightGreen, Color.GreenYellow, Color.Green, Color.DarkGreen, 90f, 0.2f, 0.3f);
            FillStyleGradientEx defaultGradient   = new FillStyleGradientEx(Color.Black, Color.Black, Color.Black, Color.Black, 90f, 0.3f, 0.5f);
            FillStyleGradientEx pressedGradient   = new FillStyleGradientEx(Color.Black, Color.Black, Color.Black, Color.Black, 90f, 0.4f, 0.5f);
            FillStyleGradientEx disabledGradient  = new FillStyleGradientEx(Color.Silver, Color.Silver, Color.Silver, Color.Silver, 90f, 0.4f, 0.5f);
            ControlTheme        theme             = ControlTheme.GetDefaultTheme(VIBLEND_THEME.STEEL);

            theme.StyleHighlight.FillStyle       = highlightGradient;
            theme.StyleDisabled.FillStyle        = disabledGradient;
            theme.StylePressed.FillStyle         = pressedGradient;
            theme.StyleNormal.FillStyle          = defaultGradient;
            this.button_login.StyleKey           = "loginStyle";
            this.button_login.Theme              = theme;
            this.button_login.UseThemeTextColor  = false;
            this.button_login.HighlightTextColor = Color.White;
            this.button_login.ForeColor          = Color.White;
            this.button_login.PressedTextColor   = Color.White;
            ActiveControl = txtUserName;
            txtUserName.Select();

            bool ok;

            //The name used when creating the mutex can be any string you want
            mutex = new Mutex(true, "DuoSoftPhone", out ok);

            if (!ok)
            {
                MessageBox.Show("Application Already Running", "Duo Soft Phone", MessageBoxButtons.OK, MessageBoxIcon.Error,
                                MessageBoxDefaultButton.Button1, MessageBoxOptions.ServiceNotification, false);
                Environment.Exit(100);
            }
            button_login.Enabled = true;
            ProgressBar.Hide();
        }
コード例 #2
0
        public void Items_Should_Be_Created_Using_ItemConatinerTheme_If_Present()
        {
            TreeView target;
            var      theme = new ControlTheme();

            var root = new TestRoot
            {
                Child = target = new TreeView
                {
                    Template           = CreateTreeViewTemplate(),
                    Items              = CreateTestTreeData(),
                    ItemContainerTheme = theme,
                    ItemTemplate       = new FuncTreeDataTemplate <Node>(
                        (_, __) => new Canvas(),
                        x => x.Children),
                }
            };

            ApplyTemplates(target);

            var items = target.ItemContainerGenerator.Index.Containers
                        .OfType <TreeViewItem>()
                        .ToList();

            Assert.Equal(5, items.Count);
            Assert.All(items, x => Assert.Same(theme, x.ItemContainerTheme));
        }
コード例 #3
0
        public void Style_Without_Selector_Cannot_Be_Added_To_Children()
        {
            var target = new ControlTheme(typeof(Button));
            var child  = new Style();

            Assert.Throws <InvalidOperationException>(() => target.Children.Add(child));
        }
コード例 #4
0
        public void Style_With_Double_Template_Selector_Cannot_Be_Added_To_Children()
        {
            var target = new ControlTheme(typeof(Button));
            var child  = new Style(x => x.Nesting().Template().OfType <ToggleButton>().Template().OfType <Border>());

            Assert.Throws <InvalidOperationException>(() => target.Children.Add(child));
        }
コード例 #5
0
        public void ControlTheme_Cannot_Be_Added_To_Style_Children()
        {
            var target = new ControlTheme(typeof(Button));
            var style  = new Style();

            Assert.Throws <InvalidOperationException>(() => style.Children.Add(target));
        }
コード例 #6
0
        public void ControlTheme_Cannot_Be_Added_To_ControlTheme_Children()
        {
            var target = new ControlTheme(typeof(Button));
            var other  = new ControlTheme(typeof(CheckBox));

            Assert.Throws <InvalidOperationException>(() => other.Children.Add(target));
        }
コード例 #7
0
        public void Theme_Is_Detached_From_Template_Controls_When_Theme_Property_Cleared()
        {
            using var app = UnitTestApplication.Start(TestServices.RealStyler);

            var theme = new ControlTheme
            {
                TargetType = typeof(ThemedControl),
                Children   =
                {
                    new Style(x => x.Nesting().Template().OfType <Canvas>())
                    {
                        Setters =
                        {
                            new Setter(Panel.BackgroundProperty, Brushes.Red),
                        }
                    },
                }
            };

            var target = CreateTarget(theme);

            target.Template = new FuncControlTemplate <ThemedControl>((o, n) => new Canvas());

            var root = CreateRoot(target);

            var canvas = Assert.IsType <Canvas>(target.VisualChild);

            Assert.Equal(Brushes.Red, canvas.Background);

            target.Theme = null;

            Assert.IsType <Canvas>(target.VisualChild);
            Assert.Null(canvas.Background);
        }
コード例 #8
0
        public void Theme_Can_Be_Changed_By_Style_Class()
        {
            using var app = UnitTestApplication.Start(TestServices.RealStyler);
            var target = CreateTarget();
            var theme1 = CreateTheme();
            var theme2 = new ControlTheme(typeof(ThemedControl));
            var root   = new TestRoot()
            {
                Styles =
                {
                    new Style(x => x.OfType <ThemedControl>())
                    {
                        Setters ={ new Setter(StyledElement.ThemeProperty,               theme1) }
                    },
                    new Style(x => x.OfType <ThemedControl>().Class("bar"))
                    {
                        Setters ={ new Setter(StyledElement.ThemeProperty,               theme2) }
                    },
                }
            };

            root.Child = target;
            root.LayoutManager.ExecuteInitialLayoutPass();

            Assert.Same(theme1, target.Theme);
            Assert.NotNull(target.Template);

            target.Classes.Add("bar");
            Assert.Same(theme2, target.Theme);
            Assert.Null(target.Template);
        }
コード例 #9
0
        public void Container_Should_Have_Theme_Set_To_ItemContainerTheme()
        {
            var theme  = new ControlTheme();
            var target = new ItemsControl
            {
                ItemContainerTheme = theme,
            };

            target.Template = GetTemplate();
            target.Items    = new[] { "Foo" };
            target.ApplyTemplate();
            target.Presenter.ApplyTemplate();

            var container = (ContentPresenter)target.Presenter.Panel.Children[0];

            Assert.Same(container.Theme, theme);
        }
コード例 #10
0
        public frmIncomingCall(bool isNotAllowToReject, int reginTime = 60)
        {
            InitializeComponent();
            Interval = reginTime;

            FillStyleGradientEx rejecthighlightGradient = new FillStyleGradientEx(Color.OrangeRed, Color.OrangeRed, Color.DarkRed, Color.DarkRed, 90f, 0.2f, 0.3f);
            FillStyleGradientEx rejectdefaultGradient   = new FillStyleGradientEx(Color.DarkRed, Color.DarkRed, Color.OrangeRed, Color.OrangeRed, 90f, 0.3f, 0.5f);
            FillStyleGradientEx rejectpressedGradient   = new FillStyleGradientEx(Color.Black, Color.Black, Color.Black, Color.Black, 90f, 0.4f, 0.5f);
            FillStyleGradientEx rejectdisabledGradient  = new FillStyleGradientEx(Color.Silver, Color.Silver, Color.Silver, Color.Silver, 90f, 0.4f, 0.5f);
            ControlTheme        rejecttheme             = ControlTheme.GetDefaultTheme(VIBLEND_THEME.STEEL);

            rejecttheme.StyleHighlight.FillStyle = rejecthighlightGradient;
            rejecttheme.StyleDisabled.FillStyle  = rejectdisabledGradient;
            rejecttheme.StylePressed.FillStyle   = rejectpressedGradient;
            rejecttheme.StyleNormal.FillStyle    = rejectdefaultGradient;
            this.buttonReject.StyleKey           = "rejectStyle1";
            this.buttonReject.Theme              = rejecttheme;
            this.buttonReject.UseThemeTextColor  = false;
            this.buttonReject.HighlightTextColor = Color.White;
            this.buttonReject.ForeColor          = Color.White;
            this.buttonReject.PressedTextColor   = Color.White;


            FillStyleGradientEx highlightGradient = new FillStyleGradientEx(Color.LightGreen, Color.GreenYellow, Color.Green, Color.DarkGreen, 90f, 0.2f, 0.3f);
            FillStyleGradientEx defaultGradient   = new FillStyleGradientEx(Color.DarkGreen, Color.Green, Color.GreenYellow, Color.LightGreen, 90f, 0.3f, 0.5f);
            FillStyleGradientEx pressedGradient   = new FillStyleGradientEx(Color.Black, Color.Black, Color.Black, Color.Black, 90f, 0.4f, 0.5f);
            FillStyleGradientEx disabledGradient  = new FillStyleGradientEx(Color.Silver, Color.Silver, Color.Silver, Color.Silver, 90f, 0.4f, 0.5f);
            ControlTheme        theme             = ControlTheme.GetDefaultTheme(VIBLEND_THEME.STEEL);

            theme.StyleHighlight.FillStyle = highlightGradient;
            theme.StyleDisabled.FillStyle  = disabledGradient;
            theme.StylePressed.FillStyle   = pressedGradient;
            theme.StyleNormal.FillStyle    = defaultGradient;

            this.buttonAnswer.StyleKey           = "answerStyle1";
            this.buttonAnswer.Theme              = theme;
            this.buttonAnswer.UseThemeTextColor  = false;
            this.buttonAnswer.HighlightTextColor = Color.White;
            this.buttonAnswer.ForeColor          = Color.White;
            this.buttonAnswer.PressedTextColor   = Color.White;

            buttonReject.Enabled       = !isNotAllowToReject;
            menuItemRejectCall.Enabled = !isNotAllowToReject;
        }
コード例 #11
0
        public void Container_Should_Have_Theme_Set_To_ItemContainerTheme()
        {
            using (UnitTestApplication.Start(TestServices.MockPlatformRenderInterface))
            {
                var items  = new[] { "Foo", "Bar", "Baz " };
                var theme  = new ControlTheme();
                var target = new ListBox
                {
                    Template           = ListBoxTemplate(),
                    Items              = items,
                    ItemContainerTheme = theme,
                };

                Prepare(target);

                var container = (ListBoxItem)target.Presenter.Panel.Children[0];

                Assert.Same(container.Theme, theme);
            }
        }
コード例 #12
0
        public void Theme_Can_Be_Set_To_LocalValue_While_Updating_Due_To_Style_Class()
        {
            using var app = UnitTestApplication.Start(TestServices.RealStyler);
            var target = CreateTarget();
            var theme1 = CreateTheme();
            var theme2 = new ControlTheme(typeof(ThemedControl));
            var theme3 = new ControlTheme(typeof(ThemedControl));
            var root   = new TestRoot()
            {
                Styles =
                {
                    new Style(x => x.OfType <ThemedControl>())
                    {
                        Setters ={ new Setter(StyledElement.ThemeProperty,               theme1) }
                    },
                    new Style(x => x.OfType <ThemedControl>().Class("bar"))
                    {
                        Setters ={ new Setter(StyledElement.ThemeProperty,               theme2) }
                    },
                }
            };

            root.Child = target;
            root.LayoutManager.ExecuteInitialLayoutPass();

            Assert.Same(theme1, target.Theme);
            Assert.NotNull(target.Template);

            target.Classes.Add("bar");

            // At this point, theme2 has been promoted to a local value internally in StyledElement;
            // make sure that setting a new local value here doesn't cause it to be cleared when we
            // do a layout pass because StyledElement thinks its clearing the promoted theme.
            target.Theme = theme3;

            root.LayoutManager.ExecuteLayoutPass();

            Assert.Same(target.Theme, theme3);
        }
コード例 #13
0
 public MapBirdsEyeButton()
     : base("GoBirdsEye")
 {
     _theme = new ControlTheme(this, true);
 }
コード例 #14
0
 public BlogPostSourceListBox()
 {
     _theme = new ControlTheme(this, true);
 }
コード例 #15
0
        private void applyStyle()
        {
            //using vblend styles downloaded from http://www.viblend.com/products/net/windows-forms/controls/free-winforms-controls.aspx

            FillStyleGradientEx highlightGradient = new FillStyleGradientEx(Color.LightGreen, Color.GreenYellow, Color.Green, Color.DarkGreen, 90f, 0.2f, 0.3f);
            FillStyleGradientEx defaultGradient   = new FillStyleGradientEx(Color.Black, Color.Black, Color.Black, Color.Black, 90f, 0.3f, 0.5f);
            FillStyleGradientEx pressedGradient   = new FillStyleGradientEx(Color.Black, Color.Black, Color.Black, Color.Black, 90f, 0.4f, 0.5f);
            FillStyleGradientEx disabledGradient  = new FillStyleGradientEx(Color.Silver, Color.Silver, Color.Silver, Color.Silver, 90f, 0.4f, 0.5f);
            ControlTheme        theme             = ControlTheme.GetDefaultTheme(VIBLEND_THEME.STEEL);

            theme.StyleHighlight.FillStyle = highlightGradient;
            theme.StyleDisabled.FillStyle  = disabledGradient;
            theme.StylePressed.FillStyle   = pressedGradient;
            theme.StyleNormal.FillStyle    = defaultGradient;
            //this.buttonAnswer.StyleKey = "answerStyle";
            //this.buttonAnswer.Theme = theme;
            //this.buttonAnswer.UseThemeTextColor = false;
            //this.buttonAnswer.HighlightTextColor = Color.White;
            //this.buttonAnswer.ForeColor = Color.White;
            //this.buttonAnswer.PressedTextColor = Color.White;

            vCircularProgressBar1.UseThemeBackground = true;

            vCircularProgressBar1.Theme = theme;
            //vButton1.Theme = theme;

            FillStyleGradientEx rejecthighlightGradient = new FillStyleGradientEx(Color.OrangeRed, Color.OrangeRed, Color.DarkRed, Color.DarkRed, 90f, 0.2f, 0.3f);
            FillStyleGradientEx rejectdefaultGradient   = new FillStyleGradientEx(Color.Black, Color.Black, Color.Black, Color.Black, 90f, 0.3f, 0.5f);
            FillStyleGradientEx rejectpressedGradient   = new FillStyleGradientEx(Color.Black, Color.Black, Color.Black, Color.Black, 90f, 0.4f, 0.5f);
            FillStyleGradientEx rejectdisabledGradient  = new FillStyleGradientEx(Color.Silver, Color.Silver, Color.Silver, Color.Silver, 90f, 0.4f, 0.5f);
            ControlTheme        rejecttheme             = ControlTheme.GetDefaultTheme(VIBLEND_THEME.STEEL);

            rejecttheme.StyleHighlight.FillStyle = rejecthighlightGradient;
            rejecttheme.StyleDisabled.FillStyle  = rejectdisabledGradient;
            rejecttheme.StylePressed.FillStyle   = rejectpressedGradient;
            rejecttheme.StyleNormal.FillStyle    = rejectdefaultGradient;

            //vButton2.Theme = rejecttheme;

            FillStyleGradientEx numhighlightGradient = new FillStyleGradientEx(Color.Blue, Color.Blue, Color.Blue, Color.Blue, 90f, 0.2f, 0.3f);
            FillStyleGradientEx numdefaultGradient   = new FillStyleGradientEx(Color.Black, Color.Black, Color.Black, Color.Black, 90f, 0.3f, 0.5f);
            FillStyleGradientEx numpressedGradient   = new FillStyleGradientEx(Color.Black, Color.Black, Color.Black, Color.Black, 90f, 0.4f, 0.5f);
            FillStyleGradientEx numdisabledGradient  = new FillStyleGradientEx(Color.Silver, Color.Silver, Color.Silver, Color.Silver, 90f, 0.4f, 0.5f);
            ControlTheme        numtheme             = ControlTheme.GetDefaultTheme(VIBLEND_THEME.STEEL);

            numtheme.StyleHighlight.FillStyle = numhighlightGradient;
            numtheme.StyleDisabled.FillStyle  = numdisabledGradient;
            numtheme.StylePressed.FillStyle   = numpressedGradient;
            numtheme.StyleNormal.FillStyle    = numdefaultGradient;



            FillStyleGradientEx holdhighlightGradient = new FillStyleGradientEx(Color.OrangeRed, Color.OrangeRed, Color.DarkRed, Color.DarkRed, 90f, 0.2f, 0.3f);
            FillStyleGradientEx holddefaultGradient   = new FillStyleGradientEx(Color.Gray, Color.LightGray, Color.Black, Color.Black, 90f, 0.3f, 0.5f);
            FillStyleGradientEx holdpressedGradient   = new FillStyleGradientEx(Color.Gray, Color.LightGray, Color.Black, Color.Black, 90f, 0.4f, 0.5f);
            FillStyleGradientEx holddisabledGradient  = new FillStyleGradientEx(Color.Black, Color.Black, Color.Black, Color.Black, 90f, 0.4f, 0.5f);
            ControlTheme        holdtheme             = ControlTheme.GetDefaultTheme(VIBLEND_THEME.STEEL);

            holdtheme.StyleHighlight.FillStyle = holdhighlightGradient;
            holdtheme.StyleDisabled.FillStyle  = holddisabledGradient;
            holdtheme.StylePressed.FillStyle   = holdpressedGradient;
            holdtheme.StyleNormal.FillStyle    = holddefaultGradient;
            //this.buttonHold.StyleKey = "holdStyle";
            //this.buttonHold.Theme = holdtheme;
            //this.buttonHold.UseThemeTextColor = false;
            //this.buttonHold.HighlightTextColor = Color.White;
            //this.buttonHold.ForeColor = Color.White;
            //this.buttonHold.PressedTextColor = Color.White;

            //vButton4.Theme = holdtheme;
            //this.vButton4.StyleKey = "theme";
            //this.vButton4.Theme = theme;
            //this.vButton4.UseThemeTextColor = false;
            //this.vButton4.HighlightTextColor = Color.White;
            //this.vButton4.ForeColor = Color.White;
            //this.vButton4.PressedTextColor = Color.White;

            gbVolume.Theme = holdtheme;
            gbVolume.UseThemeBorderColor = true;
            gbVolume.UseThemeBorderColor = true;
            gbVolume.UseThemeTextColor   = true;
            gbVolume.UseTitleBackColor   = true;
            gbVolume.VIBlendTheme        = VIBLEND_THEME.NERO;
        }
コード例 #16
0
 public BlogPostSourceListBox()
 {
     _theme = new ControlTheme(this, true);
 }
コード例 #17
0
 public SidebarListBox()
 {
     _theme = new ControlTheme(this, true);
 }
コード例 #18
0
 public MapBirdsEyeButton()
     : base("GoBirdsEye")
 {
     _theme = new ControlTheme(this, true);
 }