public void EvaluateOptions() { if (!Paused) { Action start = null; OldMedia = CurrentMedia; if (this.currentSequence == -1) { this.Location = new Point((double)this.options.Left, (double)this.options.Top); this.Size = new System.Windows.Size((double)this.options.Width, (double)this.options.Height); } int currentSequence = this.currentSequence; if ((this.options.FileType != "Widget") && !this.SetNextMediaNode()) { this.hasExpired = true; this.DurationElapsedEvent(); } else if (((this.currentSequence != currentSequence) && !this.layoutExpired) || (this.options.FileType == "Widget")) { try { if (start == null) { start = new Action(() => { Action <Media> method = null; ClientApp.Core.RegionOptions options = this.RegionOptions; Console.WriteLine("type: " + options.FileType); switch (options.FileType) { case "Image": options.Uri = Settings.Default.LibraryPath + @"\" + options.Uri; this.CurrentMedia = new Picture(options); break; case "Marquee": options.Uri = Settings.Default.LibraryPath + @"\" + options.Uri; this.CurrentMedia = new Text(options); break; case "Powerpoint": options.Uri = Settings.Default.LibraryPath + @"\" + options.Uri; this.CurrentMedia = new WebContent(options); break; case "Video": options.Uri = Settings.Default.LibraryPath + @"\" + options.Uri; this.CurrentMedia = new Video(options); break; case "Webpage": this.CurrentMedia = new WebContent(options); break; case "Flash": options.Uri = Settings.Default.LibraryPath + @"\" + options.Uri; this.CurrentMedia = new Flash(options); break; case "Ticker": this.CurrentMedia = new Rss(options); break; case "Embedded": this.CurrentMedia = new Text(options); break; case "Datasetview": this.CurrentMedia = new DataSetView(options); break; case "Widget": this.CurrentMedia = WidgetsFactory.CreateFrom(options); break; case "KeepAlive": this.CurrentMedia = new KeepAlive(options); break; default: this.SetNextMediaNode(); return; } if (this.CurrentMedia != null) { this.CurrentMedia.Duration = options.Duration; this.CurrentMedia.DurationElapsedEvent += new Media.DurationElapsedDelegate( this.MediaDurationElapsedEvent); this.CurrentMedia.Height = base.Height; this.CurrentMedia.Width = base.Width; this.CurrentMedia.Margin = new Thickness(0.0, 0.0, 0.0, 0.0); this.CurrentMedia.RenderMedia(); if (method == null) { method = delegate(Media med) { med.AnimateIn(this.MediaCanvas, OldMedia); if (med != null) { base.MediaCanvas.Children.Add( med); if (med.SnapShot != null) { base.MediaCanvas.Background = new ImageBrush( med. GetRenderTargetBitmap (1.0)); } } if (OldMedia != null) { OldMedia.Dispose(); OldMedia = null; } }; } base.Dispatcher.BeginInvoke(DispatcherPriority.Normal, method, this.CurrentMedia); } else { Trace.WriteLine(new LogMessage("EvalOptions", "Unable to start media. media == null" + LogType.Error.ToString())); this.SetNextMediaNode(); } }); } base.Dispatcher.BeginInvoke(DispatcherPriority.Normal, start); } catch (Exception exception) { Trace.WriteLine( new LogMessage("EvalOptions", "Unable to start media. " + exception.Message), LogType.Error.ToString()); this.SetNextMediaNode(); } ClientApp.Core.Stat stat = new ClientApp.Core.Stat { FileType = StatType.Media, FromDate = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), ScheduleID = this.options.scheduleId, LayoutID = this.options.layoutId, MediaID = this.options.mediaid }; this._stat = stat; } } }
public void EvaluateOptions() { if (!Paused) { Action start = null; OldMedia = CurrentMedia; if (this.currentSequence == -1) { this.Location = new Point((double) this.options.Left, (double) this.options.Top); this.Size = new System.Windows.Size((double) this.options.Width, (double) this.options.Height); } int currentSequence = this.currentSequence; if ((this.options.FileType != "Widget") && !this.SetNextMediaNode()) { this.hasExpired = true; this.DurationElapsedEvent(); } else if (((this.currentSequence != currentSequence) && !this.layoutExpired) || (this.options.FileType == "Widget")) { try { if (start == null) { start = new Action(() => { Action<Media> method = null; ClientApp.Core.RegionOptions options = this.RegionOptions; Console.WriteLine("type: " + options.FileType); switch (options.FileType) { case "Image": options.Uri = Settings.Default.LibraryPath + @"\" + options.Uri; this.CurrentMedia = new Picture(options); break; case "Marquee": options.Uri = Settings.Default.LibraryPath + @"\" + options.Uri; this.CurrentMedia = new Text(options); break; case "Powerpoint": options.Uri = Settings.Default.LibraryPath + @"\" + options.Uri; this.CurrentMedia = new WebContent(options); break; case "Video": options.Uri = Settings.Default.LibraryPath + @"\" + options.Uri; this.CurrentMedia = new Video(options); break; case "Webpage": this.CurrentMedia = new WebContent(options); break; case "Flash": options.Uri = Settings.Default.LibraryPath + @"\" + options.Uri; this.CurrentMedia = new Flash(options); break; case "Ticker": this.CurrentMedia = new Rss(options); break; case "Embedded": this.CurrentMedia = new Text(options); break; case "Datasetview": this.CurrentMedia = new DataSetView(options); break; case "Widget": this.CurrentMedia = WidgetsFactory.CreateFrom(options); break; case "KeepAlive": this.CurrentMedia = new KeepAlive(options); break; default: this.SetNextMediaNode(); return; } if (this.CurrentMedia != null) { this.CurrentMedia.Duration = options.Duration; this.CurrentMedia.DurationElapsedEvent += new Media.DurationElapsedDelegate( this.MediaDurationElapsedEvent); this.CurrentMedia.Height = base.Height; this.CurrentMedia.Width = base.Width; this.CurrentMedia.Margin = new Thickness(0.0, 0.0, 0.0, 0.0); this.CurrentMedia.RenderMedia(); if (method == null) { method = delegate(Media med) { med.AnimateIn(this.MediaCanvas, OldMedia); if (med != null) { base.MediaCanvas.Children.Add( med); if (med.SnapShot != null) { base.MediaCanvas.Background = new ImageBrush( med. GetRenderTargetBitmap (1.0)); } } if (OldMedia != null) { OldMedia.Dispose(); OldMedia = null; } }; } base.Dispatcher.BeginInvoke(DispatcherPriority.Normal, method, this.CurrentMedia); } else { Trace.WriteLine(new LogMessage("EvalOptions", "Unable to start media. media == null" + LogType.Error.ToString())); this.SetNextMediaNode(); } }); } base.Dispatcher.BeginInvoke(DispatcherPriority.Normal, start); } catch (Exception exception) { Trace.WriteLine( new LogMessage("EvalOptions", "Unable to start media. " + exception.Message), LogType.Error.ToString()); this.SetNextMediaNode(); } ClientApp.Core.Stat stat = new ClientApp.Core.Stat { FileType = StatType.Media, FromDate = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), ScheduleID = this.options.scheduleId, LayoutID = this.options.layoutId, MediaID = this.options.mediaid }; this._stat = stat; } } }