private void Overlay_SourceInitialized(object sender, EventArgs e) { IntPtr hWnd = new WindowInteropHelper(this).Handle; this.osd = new OnScreenDisplay(); this.osd.Owner = this; this.player = MediaPlayer.MediaPlayerFactory.Create(hWnd); this.player.MediaChange += new MediaChange(this.MediaChange); DatabaseManager.Instance.Load(); if (App.Config.Drive != null) { DatabaseManager.Instance.Drive = App.Config.Drive; } this.hotkeys = new HotKeys(hWnd); HwndSource src = HwndSource.FromHwnd(hWnd); src.AddHook(new HwndSourceHook(this.WndProc)); this.announcer = new DispatcherTimer(); this.announcer.Interval = TimeSpan.FromSeconds(App.Config.OSD.Interval); this.announcer.Tick += new EventHandler(this.AnnounceNext); // Context menu foreach (MenuItem i in this.FontSizes.Items) { if (double.Parse((string)i.Header) == App.Config.Font.Size) { i.IsChecked = true; break; } } }
public static AbstractMediaPlayer Create(IntPtr hWnd) { AbstractMediaPlayer p = null; switch (App.Config.Player.ToLowerInvariant()) { //case "Media Player Classic": // return new MPC(); case "mplayer": p = new MPlayer(hWnd); break; } return(p); }