public WindowWrapper(Window window) { if (ActiveWrappers.Any(x => x.Window == window)) { throw new Exception("Windows already has a wrapper; use Current(window) to fetch."); } Window = window; ActiveWrappers.Add(this); Dispatcher = new DispatcherWrapper(window.Dispatcher); window.Closed += (s, e) => { ActiveWrappers.Remove(this); }; _busyIndicator = new Grid { Background = new SolidColorBrush(Colors.Black) { Opacity = .5 }, }; _busyIndicator.Children.Add(new ProgressRing { Height = 100, Width = 100, Foreground = new SolidColorBrush(Colors.White), IsActive = true, VerticalAlignment = VerticalAlignment.Center, HorizontalAlignment = HorizontalAlignment.Center }); }
internal WindowWrapper(Window window) { if (ActiveWrappers.Any(x => x.Window == window)) { throw new Exception("Windows already has a wrapper; use Current(window) to fetch."); } Window = window; ActiveWrappers.Add(this); Dispatcher = new DispatcherWrapper(window.Dispatcher); window.Closed += (s, e) => { ActiveWrappers.Remove(this); }; }
public WindowContext(Window window) { if (Current(window) != null) { throw new Exception("Windows already has a wrapper; use Current(window) to fetch."); } Window = window; ActiveWrappers.Add(this); Dispatcher = new DispatcherWrapper(window.Dispatcher); IsInMainView = CoreApplication.MainView == CoreApplication.GetCurrentView(); window.CoreWindow.Closed += (s, e) => { ActiveWrappers.Remove(this); }; window.Closed += (s, e) => { ActiveWrappers.Remove(this); }; window.Dispatcher.AcceleratorKeyActivated += Dispatcher_AcceleratorKeyActivated; }