/// <summary>
        /// Creates an instance of the TimedBroadcasterPlugin class, attempting to make a connection to XSplit.
        /// </summary>
        /// <param name="connectionUID">
        /// A unique ID for this application, to be matched in the accompanying .xbs file.
        /// </param>
        /// <param name="visual">
        /// The visual to be rendered.
        /// </param>
        /// <param name="width">
        /// Desired output render width, in pixels.
        /// </param>
        /// <param name="height">
        /// Desired output render height, in pixels.
        /// </param>
        /// <param name="timeInterval">
        /// The time interval between updates, in milliseconds.
        /// </param>
        /// <returns>
        /// Returns an instance of a TimedBroadcasterPlugin if the connection to XSplit was successful, otherwise null is returned.
        /// </returns>
        public static TimedBroadcasterPlugin CreateInstance(
            string connectionUID, Visual visual, int width, int height, int timeInterval)
        {
            TimedBroadcasterPlugin plugin = null;

            try
            {
                var extsrc = new VHCOMRenderEngineExtSrc2 {
                    ConnectionUID = connectionUID
                };
                plugin = new TimedBroadcasterPlugin(extsrc, timeInterval)
                {
                    visual        = visual,
                    width         = width,
                    height        = height,
                    taskScheduler = TaskScheduler.FromCurrentSynchronizationContext()
                };
            }
            catch (COMException)
            {
                // Do nothing, the plugin failed to load so null will be returned.
            }

            return(plugin);
        }
        /// <summary>
        /// Creates an instance of the TimedBroadcasterPlugin class, attempting to make a connection to XSplit.
        /// </summary>
        /// <param name="connectionUID">
        /// A unique ID for this application, to be matched in the accompanying .xbs file. 
        /// </param>
        /// <param name="visual">
        /// The visual to be rendered. 
        /// </param>
        /// <param name="width">
        /// Desired output render width, in pixels. 
        /// </param>
        /// <param name="height">
        /// Desired output render height, in pixels. 
        /// </param>
        /// <param name="timeInterval">
        /// The time interval between updates, in milliseconds. 
        /// </param>
        /// <returns>
        /// Returns an instance of a TimedBroadcasterPlugin if the connection to XSplit was successful, otherwise null is returned. 
        /// </returns>
        public static TimedBroadcasterPlugin CreateInstance(
            string connectionUID, Visual visual, int width, int height, int timeInterval)
        {
            TimedBroadcasterPlugin plugin = null;

            try
            {
                var extsrc = new VHCOMRenderEngineExtSrc2 { ConnectionUID = connectionUID };
                plugin = new TimedBroadcasterPlugin(extsrc, timeInterval)
                    {
                        visual = visual, 
                        width = width, 
                        height = height, 
                        taskScheduler = TaskScheduler.FromCurrentSynchronizationContext()
                    };
            }
            catch (COMException)
            {
                // Do nothing, the plugin failed to load so null will be returned.
            }

            return plugin;
        }