public OSDWindow(OSDWindowViewModel viewModel) { _viewModel = viewModel; DataContext = _viewModel; InitializeComponent(); _viewModel.StateChanged += OnStateChanged; _viewModel.ContentChanged += OnOSDContentChanged; SourceInitialized += (_, __) => this.Cloak(); UI.Themes.Manager.Current.ThemeChanged += () => EnableAcrylicIfApplicable(WindowsTaskbar.Current); }
public void OnAddonEvent(AddonEventKind evt) { if (evt == AddonEventKind.InitializeAddon) { Current = this; DeviceCollection = ((App)App.Current).CollectionViewModel; m_hardwareManager = new HardwareManager(DeviceCollection, WindowsAudioFactory.Create(AudioDeviceKind.Playback)); // Monitor the EarTrumpet flyout so we don't show when the flyout is showing. _flyoutViewModel = (FlyoutViewModel)((App)Application.Current).FlyoutWindow.DataContext; _flyoutViewModel.StateChanged += OnFlyoutViewModelStateChanged; // Create a window to use as OSD. _osdWindowViewModel = new OSDWindowViewModel(); _osdWindow = new OSDWindow(_osdWindowViewModel); _osdWindow.Initialize(); // Listen to events and then present the active ViewModel to the OSD window. PlaybackDataModelHost.Current.AppPropertyChanged += OnAppPropertyChanged; PlaybackDataModelHost.Current.DevicePropertyChanged += OnDevicePropertyChanged; } }