예제 #1
0
 private void StartScreenshotProcess()
 {
     if (!this.IsPreviewing && !this.isStartingPreview)
     {
         this.isStartingPreview = true;
         this.themeManager      = VmcStudioUtil.Application.ThemeManager;
         this.previousThemes    = new List <ThemeSummary>(this.themeManager.AppliedThemes);
         this.themeManager.AppliedThemes.Clear();
         this.themeManager.AppliedThemes.Add(Enumerable.First <ThemeSummary>(this.themeManager.Themes, (Func <ThemeSummary, bool>)(o => (this.ThemeItem.Theme.ID == o.ID))));
         IProgressEnabledOperation operation = this.themeManager.ApplyThemesAsync(true, true);
         operation.Completed += delegate
         {
             Action action2 = null;
             this.mediaCenterProcess = MediaCenterUtil.LaunchMediaCenter(false, true, true);
             this.mediaCenterProcess.EnableRaisingEvents = true;
             this.mediaCenterProcess.Exited  += new EventHandler(this.MediaCenterProcess_Exited);
             base.Dispatcher.ShutdownStarted += new EventHandler(this.Dispatcher_ShutdownStarted);
             IntPtr windowHandle = IntPtr.Zero;
             for (int j = 0; (windowHandle == IntPtr.Zero) && (j < 20); j++)
             {
                 Thread.Sleep(500);
                 windowHandle = MediaCenterUtil.GetMediaCenterWindow();
             }
             if (windowHandle != IntPtr.Zero)
             {
                 if (action2 == null)
                 {
                     action2 = delegate
                     {
                         this.preview = new WindowPreview(this.previewWindow, windowHandle);
                         this.preview.ClientAreaOnly = true;
                         this.preview.IsVisible      = true;
                         this.IsPreviewing           = true;
                         this.isStartingPreview      = false;
                     };
                 }
                 Action method = action2;
                 base.Dispatcher.Invoke(DispatcherPriority.Normal, method);
             }
         };
         VmcStudioUtil.Application.ExclusiveOperation = operation;
     }
 }