Esempio n. 1
0
            public ThirdWindow(Screen screen)
                : base(screen)
            {
                Width           = unit * 15;
                Height          = unit * 10;
                BackgroundColor = Color.Blue;

                var stackPanel = new StackPanel(screen)
                {
                    Orientation         = Orientation.Vertical,
                    HorizontalAlignment = HorizontalAlignment.Stretch,
                    VerticalAlignment   = VerticalAlignment.Stretch,
                    Margin = new Thickness(8)
                };

                Content = stackPanel;

                var title = new TextBlock(screen)
                {
                    Text = "3rd window",
                    HorizontalAlignment = HorizontalAlignment.Stretch,
                    ForegroundColor     = Color.White,
                    BackgroundColor     = Color.Black,
                    ShadowOffset        = new Vector2(2),
                    TextOutlineWidth    = 1,
                    FontStretch         = new Vector2(1.5f)
                };

                stackPanel.Children.Add(title);

                var changingLookAndFeelDemoButton = new Button(screen)
                {
                    HorizontalAlignment = HorizontalAlignment.Stretch,
                    Padding             = new Thickness(8),

                    Content = new TextBlock(screen)
                    {
                        Text                = "Changing look & feel demo",
                        ForegroundColor     = Color.White,
                        BackgroundColor     = Color.Black,
                        HorizontalAlignment = HorizontalAlignment.Left
                    }
                };

                changingLookAndFeelDemoButton.Click += (Control s, ref RoutedEventContext c) =>
                {
                    (screen as WindowDemoScreen).SwitchLookAndFeelSource();
                };
                stackPanel.Children.Add(changingLookAndFeelDemoButton);

                var overlayDialogDemoButton = new Button(screen)
                {
                    HorizontalAlignment = HorizontalAlignment.Stretch,
                    Padding             = new Thickness(8),

                    Content = new TextBlock(screen)
                    {
                        Text                = "Overlay dialog demo",
                        ForegroundColor     = Color.White,
                        BackgroundColor     = Color.Black,
                        HorizontalAlignment = HorizontalAlignment.Left
                    }
                };

                overlayDialogDemoButton.Click += (Control sender, ref RoutedEventContext context) =>
                {
                    var dialog = new FirstOverlayDialog(Screen);
                    dialog.Overlay.Opacity = 0.5f;
                    dialog.Show();
                };
                stackPanel.Children.Add(overlayDialogDemoButton);

                var drawing3DDemoButton = new Button(screen)
                {
                    HorizontalAlignment = HorizontalAlignment.Stretch,
                    Padding             = new Thickness(8),

                    Content = new TextBlock(screen)
                    {
                        Text                = "Drawing 3D demo",
                        ForegroundColor     = Color.White,
                        BackgroundColor     = Color.Black,
                        HorizontalAlignment = HorizontalAlignment.Left
                    }
                };

                drawing3DDemoButton.Click += (Control s, ref RoutedEventContext c) =>
                {
                    var window = new CubeWindow(Screen);
                    window.Show();
                };
                stackPanel.Children.Add(drawing3DDemoButton);

                var listBoxDemoButton = new Button(screen)
                {
                    HorizontalAlignment = HorizontalAlignment.Stretch,
                    Padding             = new Thickness(8),

                    Content = new TextBlock(screen)
                    {
                        Text                = "ListBox demo",
                        ForegroundColor     = Color.White,
                        BackgroundColor     = Color.Black,
                        HorizontalAlignment = HorizontalAlignment.Left
                    }
                };

                listBoxDemoButton.Click += (Control s, ref RoutedEventContext c) =>
                {
                    var window = new ListBoxDemoWindow(screen);
                    window.Show();
                };
                stackPanel.Children.Add(listBoxDemoButton);

                var switchScreenButton = new Button(screen)
                {
                    HorizontalAlignment = HorizontalAlignment.Stretch,
                    Padding             = new Thickness(8),

                    Content = new TextBlock(screen)
                    {
                        Text                = "Switch screen",
                        ForegroundColor     = Color.White,
                        BackgroundColor     = Color.Black,
                        HorizontalAlignment = HorizontalAlignment.Left
                    }
                };

                switchScreenButton.Click += OnSwitchScreenButtonClick;
                stackPanel.Children.Add(switchScreenButton);

                var exitButton = new Button(screen)
                {
                    HorizontalAlignment = HorizontalAlignment.Stretch,
                    Padding             = new Thickness(8),

                    Content = new TextBlock(screen)
                    {
                        Text                = "Exit",
                        ForegroundColor     = Color.White,
                        BackgroundColor     = Color.Black,
                        HorizontalAlignment = HorizontalAlignment.Left
                    }
                };

                exitButton.Click += OnExitButtonClick;
                stackPanel.Children.Add(exitButton);

                var startWidthAnimation = new FloatLerpAnimation
                {
                    Action   = (current) => { Width = current; },
                    To       = Width,
                    Duration = TimeSpan.FromSeconds(0.3f),
                    Enabled  = true
                };

                Animations.Add(startWidthAnimation);

                var startHeightAnimation = new FloatLerpAnimation
                {
                    Action   = (current) => { Height = current; },
                    To       = Height,
                    Duration = TimeSpan.FromSeconds(0.3f),
                    Enabled  = true
                };

                Animations.Add(startHeightAnimation);

                overlayDialogDemoButton.Focus();
            }
Esempio n. 2
0
            public ThirdWindow(Screen screen)
                : base(screen)
            {
                Width = unit * 15;
                Height = unit * 10;
                BackgroundColor = Color.Blue;

                var stackPanel = new StackPanel(screen)
                {
                    Orientation = Orientation.Vertical,
                    HorizontalAlignment = HorizontalAlignment.Stretch,
                    VerticalAlignment = VerticalAlignment.Stretch,
                    Margin = new Thickness(8)
                };
                Content = stackPanel;

                var title = new TextBlock(screen)
                {
                    Text = "3rd window",
                    HorizontalAlignment = HorizontalAlignment.Stretch,
                    ForegroundColor = Color.White,
                    BackgroundColor = Color.Black,
                    ShadowOffset = new Vector2(2),
                    TextOutlineWidth = 1,
                    FontStretch = new Vector2(1.5f)
                };
                stackPanel.Children.Add(title);

                var changingLookAndFeelDemoButton = new Button(screen)
                {
                    HorizontalAlignment = HorizontalAlignment.Stretch,
                    Padding = new Thickness(8),

                    Content = new TextBlock(screen)
                    {
                        Text = "Changing look & feel demo",
                        ForegroundColor = Color.White,
                        BackgroundColor = Color.Black,
                        HorizontalAlignment = HorizontalAlignment.Left
                    }
                };
                changingLookAndFeelDemoButton.Click += (Control s, ref RoutedEventContext c) =>
                {
                    (screen as WindowDemoScreen).SwitchLookAndFeelSource();
                };
                stackPanel.Children.Add(changingLookAndFeelDemoButton);

                var overlayDialogDemoButton = new Button(screen)
                {
                    HorizontalAlignment = HorizontalAlignment.Stretch,
                    Padding = new Thickness(8),

                    Content = new TextBlock(screen)
                    {
                        Text = "Overlay dialog demo",
                        ForegroundColor = Color.White,
                        BackgroundColor = Color.Black,
                        HorizontalAlignment = HorizontalAlignment.Left
                    }
                };
                overlayDialogDemoButton.Click += (Control sender, ref RoutedEventContext context) =>
                {
                    var dialog = new FirstOverlayDialog(Screen);
                    dialog.Overlay.Opacity = 0.5f;
                    dialog.Show();
                };
                stackPanel.Children.Add(overlayDialogDemoButton);

                var drawing3DDemoButton = new Button(screen)
                {
                    HorizontalAlignment = HorizontalAlignment.Stretch,
                    Padding = new Thickness(8),

                    Content = new TextBlock(screen)
                    {
                        Text = "Drawing 3D demo",
                        ForegroundColor = Color.White,
                        BackgroundColor = Color.Black,
                        HorizontalAlignment = HorizontalAlignment.Left
                    }
                };
                drawing3DDemoButton.Click += (Control s, ref RoutedEventContext c) =>
                {
                    var window = new CubeWindow(Screen);
                    window.Show();
                };
                stackPanel.Children.Add(drawing3DDemoButton);

                var listBoxDemoButton = new Button(screen)
                {
                    HorizontalAlignment = HorizontalAlignment.Stretch,
                    Padding = new Thickness(8),

                    Content = new TextBlock(screen)
                    {
                        Text = "ListBox demo",
                        ForegroundColor = Color.White,
                        BackgroundColor = Color.Black,
                        HorizontalAlignment = HorizontalAlignment.Left
                    }
                };
                listBoxDemoButton.Click += (Control s, ref RoutedEventContext c) =>
                {
                    var window = new ListBoxDemoWindow(screen);
                    window.Show();
                };
                stackPanel.Children.Add(listBoxDemoButton);

                var switchScreenButton = new Button(screen)
                {
                    HorizontalAlignment = HorizontalAlignment.Stretch,
                    Padding = new Thickness(8),

                    Content = new TextBlock(screen)
                    {
                        Text = "Switch screen",
                        ForegroundColor = Color.White,
                        BackgroundColor = Color.Black,
                        HorizontalAlignment = HorizontalAlignment.Left
                    }
                };
                switchScreenButton.Click += OnSwitchScreenButtonClick;
                stackPanel.Children.Add(switchScreenButton);

                var exitButton = new Button(screen)
                {
                    HorizontalAlignment = HorizontalAlignment.Stretch,
                    Padding = new Thickness(8),

                    Content = new TextBlock(screen)
                    {
                        Text = "Exit",
                        ForegroundColor = Color.White,
                        BackgroundColor = Color.Black,
                        HorizontalAlignment = HorizontalAlignment.Left
                    }
                };
                exitButton.Click += OnExitButtonClick;
                stackPanel.Children.Add(exitButton);

                var startWidthAnimation = new FloatLerpAnimation
                {
                    Action = (current) => { Width = current; },
                    To = Width,
                    Duration = TimeSpan.FromSeconds(0.3f),
                    Enabled = true
                };
                Animations.Add(startWidthAnimation);

                var startHeightAnimation = new FloatLerpAnimation
                {
                    Action = (current) => { Height = current; },
                    To = Height,
                    Duration = TimeSpan.FromSeconds(0.3f),
                    Enabled = true
                };
                Animations.Add(startHeightAnimation);

                overlayDialogDemoButton.Focus();
            }