Beispiel #1
0
        public BrowserSelector(IBrowserProvider[] browsers, ISettingsManager settings)
        {
            browsers          = browsers.Where(x => x.IsSupported).ToArray();
            AvailableBrowsers = browsers.Select(x => x.Id).ToBindable();

            BrowserEngine = settings.Register <string>("browser_engine");
            DefaultUrl    = settings.Register("browser.game_url", "http://www.dmm.com/netgame_s/kancolle/");

            string engine = BrowserEngine.InitialValue;

            SelectedBrowser = browsers.FirstOrDefault(x => x.Id == engine)
                              ?? browsers.FirstOrDefault()
                              ?? throw new InvalidOperationException("It must have at least one browser provider.");
            SelectedBrowser.Initialize();
        }
Beispiel #2
0
        public BrowserSelector(IBrowserProvider[] browsers, BrowserSetting settings, IShellContextService shell)
        {
            browsers          = browsers.Where(x => x.IsSupported).ToArray();
            AvailableBrowsers = browsers.Select(x => x.Id).ToBindable();

            Settings = settings;
            if (settings.Debug.Value)
            {
                Current = new DebugHttpProvider(shell);
            }
            else
            {
                string engine = settings.BrowserEngine.InitialValue;
                SelectedBrowser = browsers.FirstOrDefault(x => x.Id == engine)
                                  ?? browsers.FirstOrDefault()
                                  ?? throw new InvalidOperationException("It must have at least one browser provider.");
                SelectedBrowser.Initialize();
                Current = SelectedBrowser.HttpProvider;
            }
        }
Beispiel #3
0
 public static string GetSelectedBrowser()
 {
     return(SelectedBrowser.ToLower());
 }