public FileButton(Screen screen)
                : base(screen)
            {
                Padding             = new Thickness(8);
                HorizontalAlignment = HorizontalAlignment.Stretch;

                var stackPanel = new StackPanel(screen)
                {
                    HorizontalAlignment = HorizontalAlignment.Stretch
                };

                Content = stackPanel;

                blockMeshView = new BlockMeshView(screen)
                {
                    Width  = 64,
                    Height = 64
                };
                stackPanel.Children.Add(blockMeshView);

                fileNameTextBlock = new TextBlock(screen)
                {
                    ForegroundColor         = Color.White,
                    BackgroundColor         = Color.Black,
                    HorizontalAlignment     = HorizontalAlignment.Left,
                    TextHorizontalAlignment = HorizontalAlignment.Left,
                    ShadowOffset            = new Vector2(2)
                };
                stackPanel.Children.Add(fileNameTextBlock);
            }
Example #2
0
        Control CreateLodControl(int levelOfDetail)
        {
            var stackPanel = new StackPanel(Screen)
            {
                Orientation = Orientation.Vertical,
                Padding     = new Thickness(4)
            };

            var textBlock = new TextBlock(Screen)
            {
                Text                    = string.Format(Strings.LevelOfDetailLabel, levelOfDetail),
                FontStretch             = new Vector2(0.7f),
                ForegroundColor         = Color.White,
                HorizontalAlignment     = HorizontalAlignment.Left,
                TextHorizontalAlignment = HorizontalAlignment.Left
            };

            stackPanel.Children.Add(textBlock);

            var viewModel = WorkspaceViewModel.CreateLodViewerViewModel(levelOfDetail);

            var meshView = new BlockMeshView(Screen)
            {
                Width       = 32 * 2,
                Height      = 32 * 2,
                DataContext = viewModel
            };

            stackPanel.Children.Add(meshView);

            return(stackPanel);
        }
Example #3
0
        Control CreateLodControl(int levelOfDetail)
        {
            var stackPanel = new StackPanel(Screen)
            {
                Orientation = Orientation.Vertical,
                Padding = new Thickness(4)
            };

            var textBlock = new TextBlock(Screen)
            {
                Text = string.Format(Strings.LevelOfDetailLabel, levelOfDetail),
                FontStretch = new Vector2(0.7f),
                ForegroundColor = Color.White,
                HorizontalAlignment = HorizontalAlignment.Left,
                TextHorizontalAlignment = HorizontalAlignment.Left
            };
            stackPanel.Children.Add(textBlock);

            var viewModel = WorkspaceViewModel.CreateLodViewerViewModel(levelOfDetail);

            var meshView = new BlockMeshView(Screen)
            {
                Width = 32 * 2,
                Height = 32 * 2,
                DataContext = viewModel
            };
            stackPanel.Children.Add(meshView);

            return stackPanel;
        }
            public FileButton(Screen screen)
                : base(screen)
            {
                Padding = new Thickness(8);
                HorizontalAlignment = HorizontalAlignment.Stretch;

                var stackPanel = new StackPanel(screen)
                {
                    HorizontalAlignment = HorizontalAlignment.Stretch
                };
                Content = stackPanel;

                blockMeshView = new BlockMeshView(screen)
                {
                    Width = 64,
                    Height = 64
                };
                stackPanel.Children.Add(blockMeshView);

                fileNameTextBlock = new TextBlock(screen)
                {
                    ForegroundColor = Color.White,
                    BackgroundColor = Color.Black,
                    HorizontalAlignment = HorizontalAlignment.Left,
                    TextHorizontalAlignment = HorizontalAlignment.Left,
                    ShadowOffset = new Vector2(2)
                };
                stackPanel.Children.Add(fileNameTextBlock);
            }
Example #5
0
        void InitializeControls()
        {
            var canvas = new Canvas(this);
            canvas.BackgroundColor = Color.CornflowerBlue;
            canvas.HorizontalAlignment = HorizontalAlignment.Stretch;
            canvas.VerticalAlignment = VerticalAlignment.Stretch;
            Desktop.Content = canvas;

            blockMeshView = new BlockMeshView(this)
            {
                Width = Desktop.Width,
                Height = Desktop.Height,
                Focusable = true,
                DataContext = mainViewModel.ViewerViewModel
            };
            canvas.Children.Add(blockMeshView);

            mainMenuButton = new ImageButton(this)
            {
                HorizontalAlignment = HorizontalAlignment.Right,
                VerticalAlignment = VerticalAlignment.Top
            };
            mainMenuButton.Image.Texture = Content.Load<Texture2D>("UI/MainMenuButton");
            mainMenuButton.TextBlock.Text = Strings.MainMenuButton;
            mainMenuButton.TextBlock.HorizontalAlignment = HorizontalAlignment.Right;
            mainMenuButton.TextBlock.Padding = new Thickness(4);
            mainMenuButton.TextBlock.ForegroundColor = Color.Yellow;
            mainMenuButton.TextBlock.BackgroundColor = Color.Black;
            mainMenuButton.TextBlock.ShadowOffset = new Vector2(2);
            mainMenuButton.Click += (Control s, ref RoutedEventContext c) =>
            {
                mainMenuButton.Visible = false;
                mainMenuWindow.Show();
            };
            canvas.Children.Add(mainMenuButton);

            mainMenuWindow = new MainMenuWindow(this)
            {
                HorizontalAlignment = HorizontalAlignment.Right,
                VerticalAlignment = VerticalAlignment.Top
            };
            mainMenuWindow.VisibleChanged += (s, e) =>
            {
                mainMenuButton.Visible = !mainMenuWindow.Visible;
            };

            var overlay = new FadeOverlay(this);
            overlay.OpacityAnimation.From = 1;
            overlay.OpacityAnimation.To = 0;
            overlay.OpacityAnimation.Duration = TimeSpan.FromSeconds(1);
            overlay.OpacityAnimation.Completed += (s, e) =>
            {
                overlay.Close();
                // Desktop をアクティブにしておきます。
                Desktop.Activate();
                // キー操作が行えるようにします。
                canHandleKey = true;
            };
            overlay.Show();

            Root.KeyDown += OnRootKeyDown;

            // BlockMeshView にフォーカスを設定しておきます。
            blockMeshView.Focus();

            // Desktop をアクティブ化します。
            Desktop.Activate();
        }
Example #6
0
        void InitializeControls()
        {
            var canvas = new Canvas(this);

            canvas.BackgroundColor     = Color.CornflowerBlue;
            canvas.HorizontalAlignment = HorizontalAlignment.Stretch;
            canvas.VerticalAlignment   = VerticalAlignment.Stretch;
            Desktop.Content            = canvas;

            blockMeshView = new BlockMeshView(this)
            {
                Width       = Desktop.Width,
                Height      = Desktop.Height,
                Focusable   = true,
                DataContext = mainViewModel.ViewerViewModel
            };
            canvas.Children.Add(blockMeshView);

            mainMenuButton = new ImageButton(this)
            {
                HorizontalAlignment = HorizontalAlignment.Right,
                VerticalAlignment   = VerticalAlignment.Top
            };
            mainMenuButton.Image.Texture  = Content.Load <Texture2D>("UI/MainMenuButton");
            mainMenuButton.TextBlock.Text = Strings.MainMenuButton;
            mainMenuButton.TextBlock.HorizontalAlignment = HorizontalAlignment.Right;
            mainMenuButton.TextBlock.Padding             = new Thickness(4);
            mainMenuButton.TextBlock.ForegroundColor     = Color.Yellow;
            mainMenuButton.TextBlock.BackgroundColor     = Color.Black;
            mainMenuButton.TextBlock.ShadowOffset        = new Vector2(2);
            mainMenuButton.Click += (Control s, ref RoutedEventContext c) =>
            {
                mainMenuButton.Visible = false;
                mainMenuWindow.Show();
            };
            canvas.Children.Add(mainMenuButton);

            mainMenuWindow = new MainMenuWindow(this)
            {
                HorizontalAlignment = HorizontalAlignment.Right,
                VerticalAlignment   = VerticalAlignment.Top
            };
            mainMenuWindow.VisibleChanged += (s, e) =>
            {
                mainMenuButton.Visible = !mainMenuWindow.Visible;
            };

            var overlay = new FadeOverlay(this);

            overlay.OpacityAnimation.From       = 1;
            overlay.OpacityAnimation.To         = 0;
            overlay.OpacityAnimation.Duration   = TimeSpan.FromSeconds(1);
            overlay.OpacityAnimation.Completed += (s, e) =>
            {
                overlay.Close();
                // Desktop をアクティブにしておきます。
                Desktop.Activate();
                // キー操作が行えるようにします。
                canHandleKey = true;
            };
            overlay.Show();

            Root.KeyDown += OnRootKeyDown;

            // BlockMeshView にフォーカスを設定しておきます。
            blockMeshView.Focus();

            // Desktop をアクティブ化します。
            Desktop.Activate();
        }