Example #1
0
        /// <summary>
        /// The form is loaded - let's navigate to the video
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void BrowserForm_Load(object sender, EventArgs e)
        {
            try
            {
                _logger.Debug("Setting current screen");
                SetScreenState();
                SetCurrentScreen();

                ForceClose = false;
                this.Activate();
                this.Focus();
                _logger.Debug("AppDomain Root {0}", AppDomain.CurrentDomain.BaseDirectory);
                _logger.Debug("Current Directory {0}", Directory.GetCurrentDirectory());
                _logger.Debug(string.Format("Browser Host started with connector type: {0}, video info: {1}", _connectorType, _videoInfo));
                WebBrowserPlayerCallbackService.LogInfo(string.Format("Browser Host started with connector type: {0}, video info: {1}", _connectorType, _videoInfo));

                // Set up remote handling
                _remoteProcessing.ActionReceived += RemoteProcessing_OnNewAction;
                _remoteProcessing.InitHandlers();

                _logger.Debug("Loading Connector");
                _connector = BrowserInstanceConnectorFactory.GetConnector(_connectorType, _logger, webBrowser);

                if (_connector == null)
                {
                    _logger.Error(string.Format("Unable to load connector type {0}, not found in any site utils", _connectorType));
                    throw new ApplicationException(string.Format("Unable to load connector type {0}, not found in any site utils", _connectorType));
                }

                _connector.DebugMode = _debugMode;
                _logger.Debug("Performing Log in");
                _connector.PerformLogin(_userName, _password);

                var result = _connector.WaitForComplete(ForceQuitting, _connectorTimeout);

                if (result)
                {
                    _logger.Debug("Playing Video");
                    _connector.PlayVideo(_videoInfo);
                    result = _connector.WaitForComplete(ForceQuitting, _connectorTimeout);
                    _logger.Debug("Playing WaitforComplete " + result.ToString());
                    if (!result)
                    {
                        ForceQuit();
                    }
                }
                else
                {
                    _logger.Error("Log in failed");
                    ForceQuit();
                }
            }
            catch (Exception ex)
            {
                _logger.Error(ex);
                Console.Error.WriteLine(string.Format("{0}\r\n{1}", ex.Message, ex.StackTrace));
                Console.Error.Flush();
                WebBrowserPlayerCallbackService.LogError(ex);
                ForceQuit();
            }
        }
        /// <summary>
        /// The form is loaded - let's navigate to the video
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void BrowserForm_Load(object sender, EventArgs e)
        {
            try
            {

                _logger.Debug("Setting current screen");
                SetScreenState(_debugMode ? ScreenMode.Debug : ScreenMode.Fullscreen);
                SetCurrentScreen();

                ForceClose = false;
                Activate();
                Focus();
                _logger.Debug("AppDomain Root {0}", AppDomain.CurrentDomain.BaseDirectory);
                _logger.Debug("Current Directory {0}", Directory.GetCurrentDirectory());
                _logger.Debug(string.Format("Browser Host started with connector type: {0}, video info: {1}", _connectorType, _videoInfo));
                WebBrowserPlayerCallbackService.LogInfo(string.Format("Browser Host started with connector type: {0}, video info: {1}", _connectorType, _videoInfo));

                // Set up remote handling
                _remoteProcessing.ActionReceived += RemoteProcessing_OnNewAction;
                _remoteProcessing.InitHandlers();

                _logger.Debug("Loading Connector");
                _connector = BrowserInstanceConnectorFactory.GetConnector(_connectorType, _logger, webBrowser);

                if (_connector == null)
                {
                    _logger.Error(string.Format("Unable to load connector type {0}, not found in any site utils", _connectorType));
                    throw new ApplicationException(string.Format("Unable to load connector type {0}, not found in any site utils", _connectorType));
                }

                _connector.DebugMode = _debugMode;
                _logger.Debug("Performing Log in");
                _connector.PerformLogin(_userName, _password);

                var result = _connector.WaitForComplete(ForceQuitting, _connectorTimeout);

                if (result)
                {
                    _logger.Debug("Playing Video");
                    _connector.PlayVideo(_videoInfo);
                    result = _connector.WaitForComplete(ForceQuitting, _connectorTimeout);
                    _logger.Debug("Playing WaitforComplete " + result);
                    if (!result)
                        ForceQuit();
                }
                else
                {
                    _logger.Error("Log in failed");
                    ForceQuit();
                }
            }
            catch (Exception ex)
            {
                _logger.Error(ex);
                Console.Error.WriteLine("{0}\r\n{1}", ex.Message, ex.StackTrace);
                Console.Error.Flush();
                WebBrowserPlayerCallbackService.LogError(ex);
                ForceQuit();
            }
        }