public void Load(IServices services) { this.services = services; IPlatformService platformService = (IPlatformService) new PlatformService(); this.services.AddService(typeof(IPlatformService), (object)platformService); platformService.RegisterPlatformCreator(".NETFramework", new PlatformCreatorCallback(PlatformPackage.CreateWpfPlatformCreator)); platformService.RegisterPlatformCreator("Silverlight", new PlatformCreatorCallback(PlatformPackage.CreateSilverlightPlatformCreator)); this.thumnailGrabber = new MediaElementThumnailGrabber(this.services); platformService.SetProperty(".NETFramework", "MediaElementThumbnailGrabberDelegate", (object)new Action <Uri, Action <Uri, BitmapSource, string> >(this.thumnailGrabber.BeginGrabThumbnail)); SilverlightChecker silverlightChecker = new SilverlightChecker((IServiceProvider)this.services); platformService.SetProperty("Silverlight", "SilverlightReferenceAssembliesPath", (object)silverlightChecker.ReferenceAssembliesPath); platformService.SetProperty("Silverlight", "SilverlightClientLibrariesPath", (object)silverlightChecker.ClientLibrariesPath); }
private void ProcessNextQueueItem() { if (this.workQueue.Count == 0) { if (this.workerMediaPlayer == null) { return; } this.workerMediaPlayer.MediaOpened -= new EventHandler(this.OnMediaOpened); this.workerMediaPlayer.MediaFailed -= new EventHandler <ExceptionEventArgs>(this.OnMediaFailed); this.workerMediaPlayer.Close(); this.workerMediaPlayer = (MediaPlayer)null; } else { MediaElementThumnailGrabber.ThumbnailWorkerParameters parameters = this.workQueue.Peek(); if (MediaElementThumnailGrabber.ShouldSkipPreviewFor(parameters)) { this.workQueue.Dequeue(); UIThreadDispatcher.Instance.BeginInvoke(DispatcherPriority.Normal, (Action)(() => this.ProcessNextQueueItem())); } else { if (this.workerMediaPlayer == null) { this.workerMediaPlayer = new MediaPlayer(); this.workerMediaPlayer.MediaOpened += new EventHandler(this.OnMediaOpened); this.workerMediaPlayer.MediaFailed += new EventHandler <ExceptionEventArgs>(this.OnMediaFailed); } if (this.workerMediaPlayer.Source != parameters.Source) { try { this.workerMediaPlayer.ScrubbingEnabled = false; this.workerMediaPlayer.Open(parameters.Source); } catch (Exception ex) { this.HandleLoadFail(); } } else { this.MoveToNextWorkItem(this.RenderFrame(), (string)null); } } } }