Ejemplo n.º 1
0
        /// <summary>
        /// Get the configured web media engine
        /// </summary>
        /// <param name="options"></param>
        /// <returns></returns>
        public static WebMedia GetConfiguredWebMedia(RegionOptions options, string type)
        {
            WebMedia media;

            if (type == "ie")
            {
                media = new WebIe(options);
            }
            else if (type == "edge")
            {
                media = new WebEdge(options);
            }
            else if (type == "cef")
            {
                media = new WebCef(options);
            }
            else
            {
                media = GetConfiguredWebMedia(options);
            }
            return(media);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Create the next media node based on the provided options
        /// </summary>
        /// <returns></returns>
        private Media CreateNextMediaNode()
        {
            Media media;

            // Grab a local copy of options
            RegionOptions options = this.options;

            Trace.WriteLine(new LogMessage("Region - CreateNextMediaNode", string.Format("Creating new media: {0}, {1}", options.type, options.mediaid)), LogType.Audit.ToString());

            // We've set our next media node in options already
            // this includes checking that file based media is valid.
            switch (options.type)
            {
            case "image":
                options.uri = ApplicationSettings.Default.LibraryPath + @"\" + options.uri;
                media       = new Image(options);
                break;

            case "powerpoint":
                options.uri = ApplicationSettings.Default.LibraryPath + @"\" + options.uri;
                media       = new PowerPoint(options);
                break;

            case "video":
                options.uri = ApplicationSettings.Default.LibraryPath + @"\" + options.uri;
                media       = new Video(options);
                break;

            case "localvideo":
                // Local video does not update the URI with the library path, it just takes what has been provided in the Widget.
                media = new Video(options);
                break;

            case "audio":
                options.uri = ApplicationSettings.Default.LibraryPath + @"\" + options.uri;
                media       = new Audio(options);
                break;

            case "embedded":
                media = WebMedia.GetConfiguredWebMedia(options, WebMedia.ReadBrowserType(this.options.text));
                break;

            case "datasetview":
            case "ticker":
            case "text":
            case "webpage":
                media = WebMedia.GetConfiguredWebMedia(options);
                break;

            case "flash":
                options.uri = ApplicationSettings.Default.LibraryPath + @"\" + options.uri;
                media       = new Flash(options);
                break;

            case "shellcommand":
                media = new ShellCommand(options);
                break;

            case "htmlpackage":
                media = WebMedia.GetConfiguredWebMedia(options);
                ((WebMedia)media).ConfigureForHtmlPackage();
                break;

            case "spacer":
                media = new Spacer(options);
                break;

            case "hls":
                media = new WebEdge(options);
                break;

            default:
                if (options.render == "html")
                {
                    media = WebMedia.GetConfiguredWebMedia(options);
                }
                else
                {
                    throw new InvalidOperationException("Not a valid media node type: " + options.type);
                }
                break;
            }

            // Set the media width/height
            media.Width  = Width;
            media.Height = Height;

            // Sets up the timer for this media, if it hasn't already been set
            if (media.Duration == 0)
            {
                media.Duration = options.duration;
            }

            // Add event handler for when this completes
            media.DurationElapsedEvent += new Media.DurationElapsedDelegate(media_DurationElapsedEvent);

            return(media);
        }