diff --git a/SafeExamBrowser.Browser/BrowserApplicationController.cs b/SafeExamBrowser.Browser/BrowserApplicationController.cs index cac570e6..e092307e 100644 --- a/SafeExamBrowser.Browser/BrowserApplicationController.cs +++ b/SafeExamBrowser.Browser/BrowserApplicationController.cs @@ -82,11 +82,13 @@ namespace SafeExamBrowser.Browser { var instance = new BrowserApplicationInstance(settings, text, uiFactory, instances.Count == 0); + instance.Initialize(); + instance.ConfigurationDetected += Instance_ConfigurationDetected; + instance.Terminated += Instance_Terminated; + button.RegisterInstance(instance); instances.Add(instance); - instance.ConfigurationDetected += Instance_ConfigurationDetected; - instance.Terminated += Instance_Terminated; instance.Window.Show(); } diff --git a/SafeExamBrowser.Browser/BrowserApplicationInstance.cs b/SafeExamBrowser.Browser/BrowserApplicationInstance.cs index a7f1a275..a442945f 100644 --- a/SafeExamBrowser.Browser/BrowserApplicationInstance.cs +++ b/SafeExamBrowser.Browser/BrowserApplicationInstance.cs @@ -19,6 +19,10 @@ namespace SafeExamBrowser.Browser { private IBrowserControl control; private IBrowserWindow window; + private bool isMainInstance; + private BrowserSettings settings; + private IText text; + private IUserInterfaceFactory uiFactory; public Guid Id { get; private set; } public string Name { get; private set; } @@ -29,10 +33,17 @@ namespace SafeExamBrowser.Browser public event NameChangedEventHandler NameChanged; public BrowserApplicationInstance(BrowserSettings settings, IText text, IUserInterfaceFactory uiFactory, bool isMainInstance) + { + this.isMainInstance = isMainInstance; + this.settings = settings; + this.text = text; + this.uiFactory = uiFactory; + } + + internal void Initialize() { Id = Guid.NewGuid(); - // TODO: Move to initialize method! control = new BrowserControl(settings, text); control.AddressChanged += Control_AddressChanged; (control as BrowserControl).ConfigurationDetected += (url, args) => ConfigurationDetected?.Invoke(url, args); diff --git a/SafeExamBrowser.Runtime/Behaviour/SessionController.cs b/SafeExamBrowser.Runtime/Behaviour/SessionController.cs index 3d0d1378..c2b1b440 100644 --- a/SafeExamBrowser.Runtime/Behaviour/SessionController.cs +++ b/SafeExamBrowser.Runtime/Behaviour/SessionController.cs @@ -137,8 +137,7 @@ namespace SafeExamBrowser.Runtime.Behaviour return false; } - logger.Info("Client has been successfully started and initialized."); - logger.Info("Creating communication proxy for client host..."); + logger.Info("Client has been successfully started and initialized. Creating communication proxy for client host..."); configuration.CurrentSession.ClientProxy = proxyFactory.CreateClientProxy(configuration.RuntimeInfo.ClientAddress); if (!configuration.CurrentSession.ClientProxy.Connect(configuration.CurrentSession.StartupToken))