public Backstage(BackstageController Owner) { InitializeComponent(); _owner = Owner; _ownerWindow = Window.GetWindow(Owner); _ownerWindow.Activated += _ownerWindow_Activated; _ownerWindow.Deactivated += _ownerWindow_Deactivated; _ownerWindow.StateChanged += _ownerWindow_StateChanged; _ownerWindow.Closing += _ownerWindow_Closing; UpdateWindowStateVisuals(); _infoControl = new InfoControl(); feedbackButton.Visibility = Settings.JoinedCEIP ? Visibility.Visible : Visibility.Collapsed; printButton.Visibility = Experiments.Printing ? Visibility.Visible : Visibility.Collapsed; Loaded += Backstage_Loaded; Unloaded += Backstage_Unloaded; }
private static void IsOpenCallBack(DependencyObject d, DependencyPropertyChangedEventArgs e) { BackstageController sender = d as BackstageController; Window window = Window.GetWindow(d); Grid grid = window.Content as Grid; if ((bool)e.NewValue) { BackstageEvents.StaticUpdater.InvokeBackstageOpen(sender, EventArgs.Empty); sender._windowMinWidth = window.MinWidth; sender._windowMinHeight = window.MinHeight; window.MinWidth = 500; window.MinHeight = 400; foreach (UIElement each in grid.Children) { SetOldHitTest(each, each.IsHitTestVisible); each.IsHitTestVisible = false; if (GetCollapseOnOpen(each)) { SetOldVisibility(each, each.Visibility); each.Visibility = Visibility.Collapsed; } } sender._backstage = new Backstage(sender); Grid.SetColumnSpan(sender._backstage, grid.ColumnDefinitions.Count > 0 ? grid.ColumnDefinitions.Count : 1); Grid.SetRowSpan(sender._backstage, grid.RowDefinitions.Count > 0 ? grid.RowDefinitions.Count : 1); grid.Children.Add(sender._backstage); sender._backstage.UpdateLayout(); InputManager.Current.PreProcessInput -= Current_PreProcessInput; InputManager.Current.PreProcessInput += Current_PreProcessInput; } else { _animBackstage = sender; _animBackstage._backstage.SaveSettings(); if (Settings.AnimationsEnabled) { SlideOutAnimation(); } else { _animBackstage._backstage.InvokeForceUpdate(); grid.Children.Remove(_animBackstage._backstage); _animBackstage._backstage = null; foreach (UIElement each in grid.Children) { each.IsHitTestVisible = GetOldHitTest(each); if (GetCollapseOnOpen(each)) { each.Visibility = GetOldVisibility(each); } } window.MinWidth = _animBackstage._windowMinWidth; window.MinHeight = _animBackstage._windowMinHeight; BackstageEvents.StaticUpdater.InvokeBackstageClose(sender, EventArgs.Empty); } InputManager.Current.PreProcessInput -= Current_PreProcessInput; } }