コード例 #1
0
        internal BrowserApplication(AppSettings appSettings, IMessageBox messageBox, bool mainInstance, IModuleLogger logger, IText text)
        {
            this.appSettings   = appSettings;
            this.messageBox    = messageBox;
            this.logger        = logger;
            this.text          = text;
            this.instances     = new List <BrowserApplicationInstance>();
            this.sameWindowRxs = new List <Regex>();
            Icon = new BrowserIconResource();

            _dispatcher = Dispatcher.CurrentDispatcher;

            this.WindowsChanged += Instance_WindowsChanged;

            foreach (var item in appSettings.AllowedUrlRegexps)
            {
                Regex rx = new Regex(item, RegexOptions.Compiled | RegexOptions.IgnoreCase);
                this.sameWindowRxs.Add(rx);
            }
        }
コード例 #2
0
        public BrowserApplicationInstance(
            AppSettings appSettings,
            IMessageBox messageBox,
            int id,
            bool isMainInstance,
            int numWindows,
            string startUrl,
            IModuleLogger logger,
            IText text)
        {
            this.appSettings                         = appSettings;
            this.messageBox                          = messageBox;
            this.Id                                  = id;
            this.isMainInstance                      = isMainInstance;
            this.logger                              = logger;
            this.text                                = text;
            this.startUrl                            = startUrl;
            this.settings                            = new BrowserSettings();
            settings.QuitUrl                         = appSettings.QuitUrl;
            settings.DownloadDirectory               = appSettings.DownloadDirectory;
            settings.AllowDownloads                  = true;
            settings.MainWindow.AllowReloading       = appSettings.AllowReload;
            settings.AdditionalWindow.AllowReloading = appSettings.AllowReload;

            var instanceLogger = new ModuleLogger(logger, nameof(MainWindow));

            window = new MainWindow(appSettings, settings, messageBox, id, isMainInstance, numWindows, startUrl, instanceLogger, text);
            window.TerminationRequested += () => TerminationRequested?.Invoke();
            window.IconChanged          += (i) => IconChanged?.Invoke(i);

            Handle = window.Handle;
            Icon   = new BrowserIconResource();

            window.Closing        += Control_Closing;
            window.TitleChanged   += Control_TitleChanged;
            window.PopupRequested += Control_PopupRequested;
        }