private async void UserControl_Loaded(object sender, RoutedEventArgs e)
        {
            MainWindow.mISourceItems.Add(this);

            mEncoderControl = await MainWindow.mCaptureManager.createEncoderControlAsync();

            if (mEncoderControl == null)
            {
                return;
            }

            mSourceControl = await MainWindow.mCaptureManager.createSourceControlAsync();

            if (mSourceControl == null)
            {
                return;
            }



            mStreamControl = await MainWindow.mCaptureManager.createStreamControlAsync();

            if (mStreamControl == null)
            {
                return;
            }

            mSpreaderNodeFactory = await mStreamControl.createSpreaderNodeFactoryAsync();

            if (mSpreaderNodeFactory == null)
            {
                return;
            }



            mSinkControl = await MainWindow.mCaptureManager.createSinkControlAsync();

            if (mSinkControl == null)
            {
                return;
            }

            mEVRMultiSinkFactory = await mSinkControl.createEVRMultiSinkFactoryAsync(Guid.Empty);

            if (mEVRMultiSinkFactory == null)
            {
                return;
            }
        }
        private async void Window_Loaded(object sender, RoutedEventArgs e)
        {
            try
            {
                mCaptureManager = new CaptureManager("CaptureManager.dll");
            }
            catch (System.Exception)
            {
                try
                {
                    mCaptureManager = new CaptureManager();
                }
                catch (System.Exception)
                {
                }
            }

            LogManager.getInstance().WriteDelegateEvent += MainWindow_WriteDelegateEvent;

            mSourceControl = await mCaptureManager.createSourceControlAsync();

            mEncoderControl = await mCaptureManager.createEncoderControlAsync();

            mSinkControl = await mCaptureManager.createSinkControlAsync();

            mStreamControl = await mCaptureManager.createStreamControlAsync();

            mISessionControl = await mCaptureManager.createSessionControlAsync();


            mSpreaderNodeFactory = await mStreamControl.createSpreaderNodeFactoryAsync();

            if (mSpreaderNodeFactory == null)
            {
                return;
            }

            XmlDataProvider lXmlDataProvider = (XmlDataProvider)this.Resources["XmlSources"];

            if (lXmlDataProvider == null)
            {
                return;
            }

            XmlDocument doc = new XmlDocument();

            string lxmldoc = await mCaptureManager.getCollectionOfSourcesAsync();

            doc.LoadXml(lxmldoc);

            lXmlDataProvider.Document = doc;



            XmlDataProvider lXmlContainerTypeProvider = (XmlDataProvider)this.Resources["XmlContainerTypeProvider"];

            if (lXmlDataProvider == null)
            {
                return;
            }

            doc = new XmlDocument();

            lxmldoc = await mCaptureManager.getCollectionOfSinksAsync();

            doc.LoadXml(lxmldoc);

            lXmlContainerTypeProvider.Document = doc;
        }
        private async void Window_Loaded(object sender, RoutedEventArgs e)
        {
            try
            {
                mCaptureManager = new CaptureManager("CaptureManager.dll");
            }
            catch (System.Exception)
            {
                try
                {
                    mCaptureManager = new CaptureManager();
                }
                catch (System.Exception)
                {
                }
            }

            LogManager.getInstance().WriteDelegateEvent += MainWindow_WriteDelegateEvent;

            if (mCaptureManager == null)
            {
                return;
            }

            mSourceControl = await mCaptureManager.createSourceControlAsync();

            if (mSourceControl == null)
            {
                return;
            }

            mEncoderControl = await mCaptureManager.createEncoderControlAsync();

            if (mEncoderControl == null)
            {
                return;
            }

            mSinkControl = await mCaptureManager.createSinkControlAsync();

            if (mSinkControl == null)
            {
                return;
            }

            mISessionControl = await mCaptureManager.createSessionControlAsync();

            if (mISessionControl == null)
            {
                return;
            }

            mStreamControl = await mCaptureManager.createStreamControlAsync();

            if (mStreamControl == null)
            {
                return;
            }

            mSpreaderNodeFactory = await mStreamControl.createSpreaderNodeFactoryAsync();

            if (mSpreaderNodeFactory == null)
            {
                return;
            }

            mEVRMultiSinkFactory = await mSinkControl.createEVRSinkFactoryAsync(Guid.Empty);

            if (mEVRMultiSinkFactory == null)
            {
                return;
            }


            XmlDataProvider lXmlDataProvider = (XmlDataProvider)this.Resources["XmlSources"];

            if (lXmlDataProvider == null)
            {
                return;
            }

            XmlDocument doc = new XmlDocument();

            string lxmldoc = await mCaptureManager.getCollectionOfSourcesAsync();

            doc.LoadXml(lxmldoc);

            lXmlDataProvider.Document = doc;

            lXmlDataProvider = (XmlDataProvider)this.Resources["XmlEncoders"];

            if (lXmlDataProvider == null)
            {
                return;
            }

            doc = new XmlDocument();

            lxmldoc = await mCaptureManager.getCollectionOfEncodersAsync();

            doc.LoadXml(lxmldoc);

            lXmlDataProvider.Document = doc;



            lxmldoc = await mCaptureManager.getCollectionOfSinksAsync();


            lXmlDataProvider = (XmlDataProvider)this.Resources["XmlContainerTypeProvider"];

            if (lXmlDataProvider == null)
            {
                return;
            }

            doc = new XmlDocument();

            doc.LoadXml(lxmldoc);

            lXmlDataProvider.Document = doc;


            ProcessPriorityClass lpriority = Process.GetCurrentProcess().PriorityClass;

            Process.GetCurrentProcess().PriorityClass = ProcessPriorityClass.RealTime;
        }
        private async void Window_Loaded(object sender, RoutedEventArgs e)
        {
            try
            {
                mCaptureManager = new CaptureManager("CaptureManager.dll");
            }
            catch (System.Exception)
            {
                try
                {
                    mCaptureManager = new CaptureManager();
                }
                catch (System.Exception)
                {
                }
            }

            m_Thumbnail.mChangeState += m_Thumbnail_mChangeState;

            LogManager.getInstance().WriteDelegateEvent += MainWindow_WriteDelegateEvent;

            if (mCaptureManager == null)
            {
                return;
            }

            mSourceControl = await mCaptureManager.createSourceControlAsync();

            if (mSourceControl == null)
            {
                return;
            }

            mSinkControl = await mCaptureManager.createSinkControlAsync();

            if (mSinkControl == null)
            {
                return;
            }

            mISessionControl = await mCaptureManager.createSessionControlAsync();

            if (mISessionControl == null)
            {
                return;
            }

            mStreamControl = await mCaptureManager.createStreamControlAsync();

            if (mStreamControl == null)
            {
                return;
            }

            mSpreaderNodeFactory = await mStreamControl.createSpreaderNodeFactoryAsync();

            if (mSpreaderNodeFactory == null)
            {
                return;
            }

            mEVRMultiSinkFactory = await mSinkControl.createEVRMultiSinkFactoryAsync(Guid.Empty);

            if (mEVRMultiSinkFactory == null)
            {
                return;
            }

            mSwitcherControl = await mCaptureManager.createSwitcherControlAsync();

            if (mSwitcherControl == null)
            {
                return;
            }



            XmlDataProvider lXmlDataProvider = (XmlDataProvider)this.Resources["XmlSources"];

            if (lXmlDataProvider == null)
            {
                return;
            }

            XmlDocument doc = new XmlDocument();

            string lxmldoc = await mCaptureManager.getCollectionOfSourcesAsync();

            doc.LoadXml(lxmldoc);

            lXmlDataProvider.Document = doc;

            lXmlDataProvider = (XmlDataProvider)this.Resources["XmlEncoders"];

            if (lXmlDataProvider == null)
            {
                return;
            }

            doc = new XmlDocument();

            lxmldoc = await mCaptureManager.getCollectionOfEncodersAsync();

            doc.LoadXml(lxmldoc);

            lXmlDataProvider.Document = doc;
        }