예제 #1
0
 private static void SetAcceptLanguageAndDnt(CefSettings cefSettings, Settings appSettings)
 {
     if (appSettings.UserSettings.ChromeLanguage == EChromeLanguage.Ru)
     {
         cefSettings.Locale                   = "ru-Ru";
         cefSettings.AcceptLanguageList       = "ru-RU,ru;q=0.9,en-US;q=0.8,en;q=0.7";
         RequestHandler.DefaultAcceptLanguage = "ru-RU,ru;q=0.9,en-US;q=0.8,en;q=0.7";
     }
     else
     {
         ChromeLanguageInfo fullInfo = EChromeLanguageHelper.GetFullInfo(appSettings.UserSettings.ChromeLanguage);
         cefSettings.Locale             = fullInfo.Locale;
         cefSettings.AcceptLanguageList = fullInfo.AcceptLanguageList;
     }
     RequestHandler.Accept    = "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3";
     RequestHandler.IsSendDnt = false;
 }
예제 #2
0
 public SettingsViewModel([CanBeNull] ServerClient client)
 {
     this._appEncoding                = ClientConfig.AppEncoding;
     this._client                     = client;
     this.RemoveBkFromListCommand     = new ReallyCommand <Bookmaker>(new Action <Bookmaker>(this.RemoveBkFromList));
     this.CopyLoginPasswordCommand    = new ReallyCommand <Bookmaker>(new Action <Bookmaker>(this.CopyLoginPassword));
     this.SaveCommand                 = new ReallyCommand(new Action(this.Save));
     this.ResetBrowserCommand         = new ReallyCommand(new Action(this.ResetBrowser));
     this.ClearCacheCommand           = new ReallyCommand(new Action(this.ClearCache));
     this.ShowDemoCommand             = new ReallyCommand(new Action <object>(this.ShowDemo));
     this.DeleteSettingsCommand       = new ReallyCommand(new Action(this.DeleteSettings));
     this.PlaySoundCommand            = new ReallyCommand(new Action(this.PlaySound));
     this.DeleteInitDataCommand       = new ReallyCommand(new Action(this.DeleteInitData));
     this.CopyCurrentUserAgentCommand = new ReallyCommand((Action)(async() =>
     {
         SettingsViewModel settingsViewModel = this;
         Clipboard.SetText(settingsViewModel.CurrentUserAgent);
         await settingsViewModel.ShowSuccessDialogAsync("UserAgent скопирован в буфер обмена");
     }));
     this.OpenUrlCommand = new ReallyCommand <string>((Action <string>)(url =>
     {
         if (string.IsNullOrWhiteSpace(url))
         {
             return;
         }
         Process.Start(url);
     }));
     this.CurrentSettings = this._settigs.Clone();
     if (this.CurrentSettings.UserSettings.UserHotKeys == null)
     {
         this.CurrentSettings.UserSettings.UserHotKeys = UserHotKeys.Default;
     }
     this.Bookmakers             = new ObservableCollection <Bookmaker>(this.CurrentSettings.UserSettings.BookmakersList);
     this.SelectedBookmaker      = this.Bookmakers.FirstOrDefault <Bookmaker>();
     this.CurrentUserAgent       = this.CurrentSettings.UserSettings.FakeProfile.UserAgent;
     this.AllCurrencies          = Enum.GetValues(typeof(ECurrency)).Cast <ECurrency>().ToList <ECurrency>();
     this.FakeProfiles           = this.LoadUserAgents();
     this.UserCurrenciesSettings = this.CurrentSettings.UserSettings.CurrencyItems;
     this.RoundRules             = Enum.GetValues(typeof(ERoundRule)).Cast <ERoundRule>().ToList <ERoundRule>();
     this.SearchSoundFiles();
     this.CurrentLanguageInfo    = EChromeLanguageHelper.GetFullInfo(this.CurrentSettings.UserSettings.ChromeLanguage);
     this.ENewListForksFilter    = this._settigs.UserSettings.NewListForksFilterType;
     this.IsHighlightingNewForks = this._settigs.UserSettings.IsHighlightingNewForks;
     this.IsAllowMultiProxy      = this._settigs.IsAllowMultiProxy;
     this.DisabledIndProxy       = new ReallyCommand <Bookmaker>((Action <Bookmaker>)(bookmaker => bookmaker.Proxy.IsCustomProxy = false));
     this._downloader            = new CurrenciesDownloader();
     this._currencyItemManager   = new CurrencyItemManager(this.CurrentSettings.UserSettings.CurrencyItems, this._downloader);
     this.UpdateCurseCommand     = new ReallyCommand <CurrencyItem>((Action <CurrencyItem>)(async curse =>
     {
         SettingsViewModel settingsViewModel = this;
         settingsViewModel.IsLoadCursesNow   = true;
         if (curse != null)
         {
             try
             {
                 CurrencyItem currencyItem = await settingsViewModel._currencyItemManager.UpdateCurse(curse);
             }
             catch (Exception ex)
             {
                 await settingsViewModel.ShowErrorDialogAsync("Ошибка", ex);
             }
         }
         settingsViewModel.IsLoadCursesNow = false;
     }));
     this.SetCustomUserAgentCommand = new ReallyCommand(new Action(this.SetCustomUserAgent));
 }