private void CreateNewInstance(string url = null)
        {
            var id             = new BrowserInstanceIdentifier(++instanceIdCounter);
            var isMainInstance = instances.Count == 0;
            var instanceLogger = logger.CloneFor($"BrowserInstance {id}");
            var startUrl       = url ?? settings.StartUrl;
            var instance       = new BrowserApplicationInstance(appConfig, settings, id, isMainInstance, messageBox, instanceLogger, text, uiFactory, startUrl);

            instance.ConfigurationDownloadRequested += (fileName, args) => ConfigurationDownloadRequested?.Invoke(fileName, args);
            instance.PopupRequested += Instance_PopupRequested;
            instance.Terminated     += Instance_Terminated;

            instance.Initialize();
            instances.Add(instance);
            InstanceStarted?.Invoke(instance);

            logger.Info($"Created browser instance {instance.Id}.");
        }
Example #2
0
        private void CreateNewInstance(string url = null)
        {
            var id             = ++instanceIdCounter;
            var isMainInstance = instances.Count == 0;
            var instanceLogger = logger.CloneFor($"Browser Instance #{id}");
            var startUrl       = url ?? GenerateStartUrl();
            var instance       = new BrowserApplicationInstance(appConfig, settings, id, isMainInstance, fileSystemDialog, hashAlgorithm, messageBox, instanceLogger, text, uiFactory, startUrl);

            instance.ConfigurationDownloadRequested += (fileName, args) => ConfigurationDownloadRequested?.Invoke(fileName, args);
            instance.PopupRequested            += Instance_PopupRequested;
            instance.ResetRequested            += Instance_ResetRequested;
            instance.SessionIdentifierDetected += (i) => SessionIdentifierDetected?.Invoke(i);
            instance.Terminated           += Instance_Terminated;
            instance.TerminationRequested += () => TerminationRequested?.Invoke();

            instance.Initialize();
            instances.Add(instance);

            logger.Info($"Created browser instance {instance.Id}.");
            WindowsChanged?.Invoke();
        }