示例#1
0
        /// <summary> Recreates the scoreboard display to turn off transparency. </summary>
        /// <param name="sender"> The sender. </param>
        /// <param name="e"> The event arguments. </param>
        private void TransparencyOptionUnchecked(object sender, RoutedEventArgs e)
        {
            var opacity = this.display.MaxOpacity;
            var showing = this.display.IsVisible;
            var size    = this.sldrSize.Value;

            var left = this.display.Left;
            var top  = this.display.Top;

            this.display.Close();
            this.display = null;

            this.display = new ScoreboardDisplay {
                AllowsTransparency = false
            };
            this.display.SetViewModel(this.viewModel);

            this.display.MaxOpacity         = opacity;
            this.sldrTransparency.IsEnabled = false;

            this.sldrSize.DataContext = this.display;
            this.sldrSize.Value       = size;

            // Retain the previous position settings.
            this.display.InitializePositionOnLoad = false;
            this.display.IsWindowMovable          = cbxWindowMovable.IsChecked == true;
            this.display.SetValue(TopProperty, top);
            this.display.SetValue(LeftProperty, left);

            if (showing)
            {
                this.display.Show();
            }
        }
示例#2
0
        /// <summary> Recreates the scoreboard display to turn off transparency. </summary>
        /// <param name="sender"> The sender. </param>
        /// <param name="e"> The event arguments. </param>
        private void TransparencyOptionUnchecked(object sender, RoutedEventArgs e)
        {
            var opacity = this.display.MaxOpacity;
            var showing = this.display.IsVisible;
            var size = this.sldrSize.Value;

            var left = this.display.Left;
            var top = this.display.Top;

            this.display.Close();
            this.display = null;

            this.display = new ScoreboardDisplay { AllowsTransparency = false };
            this.display.SetViewModel(this.viewModel);

            this.display.MaxOpacity = opacity;
            this.sldrTransparency.IsEnabled = false;

            this.sldrSize.DataContext = this.display;
            this.sldrSize.Value = size;

            // Retain the previous position settings.
            this.display.InitializePositionOnLoad = false;
            this.display.IsWindowMovable = cbxWindowMovable.IsChecked == true;
            this.display.SetValue(TopProperty, top);
            this.display.SetValue(LeftProperty, left);

            if (showing)
            {
                this.display.Show();
            }
        }