/// <summary> /// Record a complete Event /// </summary> /// <param name="fromDT"></param> /// <param name="toDT"></param> /// <param name="tag"></param> public void RecordEvent(String fromDT, String toDT, String tag) { if (!Settings.Default.statsEnabled) return; Stat stat = new Stat(); stat.FileType = StatType.Event; stat.FromDate = fromDT; stat.ToDate = toDT; stat.Tag = tag; _stats.Add(stat); return; }
///<summary> /// Evaulates the change in options ///</summary> private void EvaluateOptions() { if (currentSequence == -1) { //evaluate the Width, etc this.Location = new Point(options.Left, options.Top); this.Size = new Size(options.Width, options.Height); } int temp = currentSequence; //set the next media node for this panel if (!SetNextMediaNode() && options.FileType!="Widget") { // For some reason we cannot set a media node... so we need this region to become invalid hasExpired = true; DurationElapsedEvent(); return; } // If the sequence hasnt been changed, OR the layout has been expired if ((currentSequence == temp || layoutExpired) && options.FileType != "Widget") { //there has been no change to the sequence, therefore the media we have already created is still valid //or this media has actually been destroyed and we are working out way out the call stack return; } var oldmedia = media; System.Diagnostics.Debug.WriteLine(String.Format("Creating new media: {0}, {1}", options.FileType, options.mediaid), "Region - EvaluateOptions"); try { Dispatcher.BeginInvoke(DispatcherPriority.Normal, new ThreadStart(() => { var regionOptions = RegionOptions; switch (regionOptions.FileType) { case "Image": regionOptions.Uri =Settings.Default.LibraryPath +@"\" + regionOptions.Uri; media =new ImagePosition(regionOptions); break; case "Text": media = new Text(regionOptions); break; case "Powerpoint": regionOptions.Uri =Settings.Default.LibraryPath +@"\" + regionOptions.Uri; media =new WebContent(regionOptions); break; case "Video": regionOptions.Uri =Settings.Default.LibraryPath +@"\" + regionOptions.Uri; media =new Video(regionOptions); break; case "Webpage": media = new WebContent(regionOptions); break; case "Flash": regionOptions.Uri =Settings.Default.LibraryPath +@"\" + regionOptions.Uri; media =new Flash(regionOptions); break; case "Ticker": media = new Rss(regionOptions); break; case "Embedded": media = new Text(regionOptions); break; case "Datasetview": media = new DataSetView(regionOptions); break; case "Widget": media = WidgetsFactory.CreateFrom(regionOptions); break; default: //do nothing SetNextMediaNode(); return; } //Dispatcher.BeginInvoke( // DispatcherPriority.Normal, // new ThreadStart(() => // { if (media != null) { //sets up the timer for this media media.Duration =regionOptions.Duration; //add event handler media.DurationElapsedEvent+=media_DurationElapsedEvent; media.Height = this.Height; media.Width = this.Width; media.Margin =new Thickness(0, 0, 0,0); media.RenderMedia(); // media.Opacity = 0; //media.OldOne = oldmedia; //if (!media.HasOnLoaded) // //not so useful //{ // media.AnimateIn(MediaCanvas,oldmedia); //} Dispatcher.BeginInvoke(DispatcherPriority.Normal, new Action<Media>((med) => { if(med!=null) MediaCanvas.Children.Add(med); }),media); } else { Trace.WriteLine(new LogMessage("EvalOptions","Unable to start media. media == null" +LogType.Error.ToString())); SetNextMediaNode(); } // })); //any additional media specific render options (and starts the timer) })); } catch (Exception ex) { Trace.WriteLine(new LogMessage("EvalOptions", "Unable to start media. " + ex.Message), LogType.Error.ToString()); SetNextMediaNode(); } // This media has started and is being replaced _stat = new Stat { FileType = StatType.Media, FromDate = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), ScheduleID = options.scheduleId, LayoutID = options.layoutId, MediaID = options.mediaid }; Debug.WriteLine("Showing new media", "Region - Eval Options"); }
/// <summary> /// Record a complete Layout Event /// </summary> /// <param name="fromDT"></param> /// <param name="toDT"></param> /// <param name="scheduleID"></param> /// <param name="layoutID"></param> public void RecordLayout(String fromDT, String toDT, int scheduleID, int layoutID) { if (!Settings.Default.statsEnabled) return; Stat stat = new Stat(); stat.FileType = StatType.Layout; stat.FromDate = fromDT; stat.ToDate = toDT; stat.ScheduleID = scheduleID; stat.LayoutID = layoutID; _stats.Add(stat); return; }
/// <summary> /// RecordStat /// </summary> /// <param name="stat"></param> public void RecordStat(Stat stat) { if (!Settings.Default.statsEnabled) return; System.Diagnostics.Debug.WriteLine(String.Format("Recording a Stat Record. Current Count = {0}", _stats.Count.ToString()), LogType.Audit.ToString()); _stats.Add(stat); // At some point we will need to flush the stats if (_stats.Count >= Settings.Default.StatsFlushCount) { Flush(); } return; }
/// <summary> /// Record a complete Media Event /// </summary> /// <param name="fromDT"></param> /// <param name="toDT"></param> /// <param name="layoutID"></param> /// <param name="mediaID"></param> public void RecordMedia(String fromDT, String toDT, int layoutID, String mediaID) { if (!Settings.Default.statsEnabled) return; Stat stat = new Stat(); stat.FileType = StatType.Media; stat.FromDate = fromDT; stat.ToDate = toDT; stat.LayoutID = layoutID; stat.MediaID = mediaID; _stats.Add(stat); return; }
public void RecordStat(Stat stat) { if (Settings.Default.statsEnabled) { this._stats.Add(stat); if (this._stats.Count >= Settings.Default.StatsFlushCount) { this.Flush(); } } }
public void RecordMedia(string fromDT, string toDT, int layoutID, string mediaID) { if (Settings.Default.statsEnabled) { Stat item = new Stat { FileType = StatType.Media, FromDate = fromDT, ToDate = toDT, LayoutID = layoutID, MediaID = mediaID }; this._stats.Add(item); } }
public void RecordLayout(string fromDT, string toDT, int scheduleID, int layoutID) { if (Settings.Default.statsEnabled) { Stat item = new Stat { FileType = StatType.Layout, FromDate = fromDT, ToDate = toDT, ScheduleID = scheduleID, LayoutID = layoutID }; this._stats.Add(item); } }
public void RecordEvent(string fromDT, string toDT, string tag) { if (Settings.Default.statsEnabled) { Stat item = new Stat { FileType = StatType.Event, FromDate = fromDT, ToDate = toDT, Tag = tag }; this._stats.Add(item); } }