public void Init(MediaCenter.MCAutomation mcRef) { try { //if (checkVersion()) //{ // Tell MC to call our MJEvent Routine in case of evenst this.mcRef = mcRef; this.mcRef.FireMJEvent += new IMJAutomationEvents_FireMJEventEventHandler(MJEvent); // Init our plugin initAll(); // This is the main entry for MC Automation txtUserInfo.Visible = true; addUserInfoText("Plugin Initiated OK"); StartSubclass((IntPtr)mcRef.GetWindowHandle()); windowsize = new Rectangle(); GetWindowRect((IntPtr)mcRef.GetWindowHandle(), ref windowsize); screen = new Bitmap(windowsize.Width, windowsize.Height, System.Drawing.Imaging.PixelFormat.Format32bppArgb); screen = ScreenCapture.GrabWindowBitmap((IntPtr)mcRef.GetWindowHandle(), new Size(windowsize.Width, windowsize.Height)); screen.RotateFlip(RotateFlipType.Rotate180FlipX); GetWindowText((IntPtr)mcRef.GetWindowHandle(), oldWindowText, oldWindowText.Capacity); backgroundWorker1.RunWorkerAsync(); } catch (Exception e) { errorHandler(e); } }
private void setWindowTitle() { IMJPlaybackAutomation playback = mcRef.GetPlayback(); if (playback.State != MJPlaybackStates.PLAYSTATE_STOPPED && displayArtistTrackName.Checked) { Windows7Taskbar.SetThumbnailTooltip((IntPtr)mcRef.GetWindowHandle(), nowPlayingFile.Artist + " - " + nowPlayingFile.Name); SetWindowText((IntPtr)mcRef.GetWindowHandle(), nowPlayingFile.Artist + " - " + nowPlayingFile.Name); } else { SetWindowText((IntPtr)mcRef.GetWindowHandle(), oldWindowText.ToString()); Windows7Taskbar.SetThumbnailTooltip((IntPtr)mcRef.GetWindowHandle(), oldWindowText.ToString()); } }