/// <summary>
        /// Create the next media node based on the provided options
        /// </summary>
        /// <param name="options"></param>
        /// <returns></returns>
        private Media CreateNextMediaNode(RegionOptions options)
        {
            Media media;

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

            if (options.render == "html")
            {
                media = new IeWebMedia(options);
            }
            else
            {
                // 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 ImagePosition(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;

                    // Which video engine are we using?
                    if (ApplicationSettings.Default.VideoRenderingEngine == "DirectShow")
                    {
                        media = new VideoDS(options);
                    }
                    else
                    {
                        media = new Video(options);
                    }

                    break;

                case "localvideo":
                    // Which video engine are we using?
                    if (ApplicationSettings.Default.VideoRenderingEngine == "DirectShow")
                    {
                        media = new VideoDS(options);
                    }
                    else
                    {
                        media = new Video(options);
                    }

                    break;

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

                case "datasetview":
                case "embedded":
                case "ticker":
                case "text":
                case "webpage":
                    media = new IeWebMedia(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 = new HtmlPackage(options);
                    break;

                default:
                    throw new InvalidOperationException("Not a valid media node type: " + options.type);
                }
            }

            // 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);
        }
Beispiel #2
0
        /// <summary>
        /// Create the next media node based on the provided options
        /// </summary>
        /// <param name="options"></param>
        /// <returns></returns>
        private Media CreateNextMediaNode(RegionOptions options)
        {
            Media media;

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

            if (options.render == "html")
            {
                if (useCef)
                    media = new CefWebMedia(options);
                else
                    media = new IeWebMedia(options);
            }
            else
            {
                switch (options.type)
                {
                    case "image":
                        options.uri = ApplicationSettings.Default.LibraryPath + @"\" + options.uri;
                        media = new ImagePosition(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;

                        // Which video engine are we using?
                        if (ApplicationSettings.Default.VideoRenderingEngine == "DirectShow")
                            media = new VideoDS(options);
                        else
                            media = new Video(options);

                        break;

                    case "localvideo":
                        // Which video engine are we using?
                        if (ApplicationSettings.Default.VideoRenderingEngine == "DirectShow")
                            media = new VideoDS(options);
                        else
                            media = new Video(options);

                        break;

                    case "datasetview":
                    case "embedded":
                    case "ticker":
                    case "text":
                    case "webpage":
                        if (useCef)
                            media = new CefWebMedia(options);
                        else
                            media = new IeWebMedia(options);

                        break;

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

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

                    default:
                        throw new InvalidOperationException("Not a valid media node type: " + options.type);
                }
            }

            // 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;
        }