public CubeWindow(Screen screen) : base(screen) { var stackPanel = new StackPanel(screen) { Orientation = Orientation.Vertical, Margin = new Thickness(8) }; Content = stackPanel; var cubeControl = new CubeControl(screen) { CubePrimitive = CreateCubePrimitive(), ForegroundColor = Color.White, Width = unit * 7, Height = unit * 7, CubeVisible = true }; stackPanel.Children.Add(cubeControl); var closeButton = new Button(screen) { HorizontalAlignment = HorizontalAlignment.Stretch, Padding = new Thickness(8), Content = new TextBlock(screen) { Text = "Close", ForegroundColor = Color.White, BackgroundColor = Color.Black } }; closeButton.Click += (Control s, ref RoutedEventContext c) => Close(); stackPanel.Children.Add(closeButton); rotateCubeAnimation = new FloatLerpAnimation { Action = (current) => { cubeControl.Orientation = Matrix.CreateFromYawPitchRoll(current, current, current); }, To = MathHelper.TwoPi, Duration = TimeSpan.FromSeconds(4), Repeat = Repeat.Forever }; cubeControl.MouseEnter += OnCubeControlMouseEnter; cubeControl.MouseLeave += OnCubeControlMouseLeave; Animations.Add(rotateCubeAnimation); }
public CubeWindow(Screen screen) : base(screen) { var stackPanel = new StackPanel(screen) { Orientation = Orientation.Vertical, Margin = new Thickness(8) }; Content = stackPanel; var cubeControl = new CubeControl(screen) { CubePrimitive = CreateCubePrimitive(), ForegroundColor = Color.White, Width = unit * 7, Height = unit * 7, CubeVisible = true }; stackPanel.Children.Add(cubeControl); var closeButton = new Button(screen) { HorizontalAlignment = HorizontalAlignment.Stretch, Padding = new Thickness(8), Content = new TextBlock(screen) { Text = "Close", ForegroundColor = Color.White, BackgroundColor = Color.Black } }; closeButton.Click += (Control s, ref RoutedEventContext c) => Close(); stackPanel.Children.Add(closeButton); rotateCubeAnimation = new FloatLerpAnimation { Action = (current) => { cubeControl.Orientation = Matrix.CreateFromYawPitchRoll(current, current, current); }, To = MathHelper.TwoPi, Duration = TimeSpan.FromSeconds(4), Repeat = Repeat.Forever }; cubeControl.MouseEnter += OnCubeControlMouseEnter; cubeControl.MouseLeave += OnCubeControlMouseLeave; Animations.Add(rotateCubeAnimation); }