Example #1
0
 public ThemeModel(MediaCenterTheme theme, ThemeManager manager)
     : base((string)null, (ThemeTreeItem)null)
 {
     this.Theme = theme;
     this.ThemeManager = manager;
     this.BiographyItem = new BiographyModel(this);
     this.FontsItem = new FontsItemModel((IThemeItem)theme.FontsItem, this, false);
     this.ColorsItem = new ColorsItemModel((IThemeItem)theme.ColorsItem, this, false);
     this.ImagesCategory = new ImagesCategoryModel("Images", (ThemeTreeItem)this);
     this.Children.Add((ThemeTreeItem)this.BiographyItem);
     this.Children.Add((ThemeTreeItem)this.FontsItem);
     this.Children.Add((ThemeTreeItem)this.ColorsItem);
     this.Children.Add((ThemeTreeItem)this.ImagesCategory);
     this.BiographyItem.IsSelected = true;
     foreach (IThemeItem themeItem in (Collection<IThemeItem>)this.Theme.ThemeItems)
         this.AddThemeItem(themeItem, false);
     foreach (IThemeItem themeItem in this.DefaultThemeItems)
         this.AddThemeItem(themeItem, true);
     this.Sort();
 }
 private void StopScreenshotProcess()
 {
     if (this.IsPreviewing && !this.isStoppingPreview)
     {
         this.isStoppingPreview = true;
         this.mediaCenterProcess.Exited -= new EventHandler(this.MediaCenterProcess_Exited);
         base.Dispatcher.ShutdownStarted -= new EventHandler(this.Dispatcher_ShutdownStarted);
         this.themeManager.AppliedThemes.Clear();
         foreach (ThemeSummary summary in this.previousThemes)
         {
             this.themeManager.AppliedThemes.Add(summary);
         }
         IProgressEnabledOperation operation = this.themeManager.ApplyThemesAsync(false, true);
         operation.Completed += delegate
         {
             Action method = delegate
             {
                 this.IsPreviewing = false;
                 this.isStoppingPreview = false;
                 this.preview.Dispose();
                 this.preview = null;
                 this.previousThemes = null;
                 this.mediaCenterProcess = null;
                 this.themeManager = null;
             };
             base.Dispatcher.Invoke(DispatcherPriority.Normal, method);
         };
         VmcStudioUtil.Application.ExclusiveOperation = operation;
     }
 }
 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;
     }
 }