private async void Save()
        {
            ProxyPanelViewModel proxyPanelViewModel = this;
            Settings            settings            = proxyPanelViewModel._settigs.Clone();

            if (!proxyPanelViewModel.IsUsedProxyInProgram && proxyPanelViewModel._settigs.ProxyConfig.IsUsedProxyInProgram)
            {
                if (await proxyPanelViewModel.ShowYesOrNoDialogAsync((BaseViewModel)proxyPanelViewModel._mainVm, "Запрос", "Вы точно хотите полностью отключить прокси в программе?") == MessageDialogResult.Negative)
                {
                    proxyPanelViewModel.IsUsedProxyInProgram = true;
                    return;
                }
                proxyPanelViewModel.IsUsedProxyInProgram           = false;
                proxyPanelViewModel.IsUsedProxyUser                = false;
                proxyPanelViewModel.IsUsedCustomProxyForBookmakers = false;
                proxyPanelViewModel.DisableAllProxyInBookmakers(settings.UserSettings.BookmakersList);
            }
            if (proxyPanelViewModel.IsUsedProxyUser)
            {
                if (string.IsNullOrWhiteSpace(proxyPanelViewModel.UserProxyAddress))
                {
                    await proxyPanelViewModel.ShowErrorDialogAsync((BaseViewModel)proxyPanelViewModel._mainVm, "Укажите адрес пользовательского прокси!");

                    return;
                }
                if (proxyPanelViewModel.UserProxyPort == 0)
                {
                    await proxyPanelViewModel.ShowErrorDialogAsync((BaseViewModel)proxyPanelViewModel._mainVm, "Укажите порт прокси!");

                    return;
                }
                if (proxyPanelViewModel.UserIsProxyAuth)
                {
                    if (string.IsNullOrWhiteSpace(proxyPanelViewModel.UserProxyLogin))
                    {
                        await proxyPanelViewModel.ShowErrorDialogAsync((BaseViewModel)proxyPanelViewModel._mainVm, "Укажите логин от прокси!");

                        return;
                    }
                    if (string.IsNullOrWhiteSpace(proxyPanelViewModel.UserProxyPassword))
                    {
                        await proxyPanelViewModel.ShowErrorDialogAsync((BaseViewModel)proxyPanelViewModel._mainVm, "Укажите пароль от прокси!");

                        return;
                    }
                }
            }
            proxyPanelViewModel.ConFigureProxyConfig(settings.ProxyConfig);
            Settings.Save(settings);
            proxyPanelViewModel.ShowThisView();
        }
        protected override async void Settings_SettingsChanged(Settings newSettings)
        {
            ProxyPanelViewModel proxyPanelViewModel = this;
            bool flag = SettingsValidator.IsHaveChangeForProxy(proxyPanelViewModel._settigs, newSettings);

            // ISSUE: reference to a compiler-generated method
            //proxyPanelViewModel.\U+003C\U+003En__0(newSettings);
            if (flag)
            {
                if (proxyPanelViewModel.StatusVisibility == Visibility.Visible)
                {
                    proxyPanelViewModel.ShowThisView();
                }
                await proxyPanelViewModel.UpdateProxyInProgram(newSettings, true);

                proxyPanelViewModel.RestoreSettingsFromProxyConfigAll(newSettings);
            }
            proxyPanelViewModel.CalcVisibleProxyList();
        }
        public async Task UpdateProxyInProgram(Settings settings, bool loadTestPage = true)
        {
            ProxyPanelViewModel proxyPanelViewModel  = this;
            ProxyForChrome      proxyFromProxyConfig = proxyPanelViewModel.ExtractMainProxyFromProxyConfig(settings.ProxyConfig);
            CredentialsForHostInIRequestContext credentialsFromProxyConfig      = proxyPanelViewModel.ExtractMainProxyCredentialsFromProxyConfig(settings.ProxyConfig);
            List <ProxyPanelViewModel.ProxyForBookmakerData> proxyForBookmakers = proxyPanelViewModel.ExtractProxyForBookmakers(settings.UserSettings.BookmakersList);

            foreach (Api allApi in Api.AllApis)
            {
                RequestHandler innerHandler = allApi.Request.GetInnerHandler();
                innerHandler?.AddProxyDataCredentials(credentialsFromProxyConfig);
                if (settings.ProxyConfig.CurrentProxy.HeaderAuth != null && innerHandler != null)
                {
                    innerHandler.AddCutomRequestHeader(settings.ProxyConfig.CurrentProxy.HeaderAuth);
                }
            }
            ProxyForChrome proxy;

            if (proxyForBookmakers.Count > 0)
            {
                PacScript pacScript = new PacScript(proxyFromProxyConfig);
                foreach (ProxyPanelViewModel.ProxyForBookmakerData forBookmakerData in proxyForBookmakers)
                {
                    pacScript.AddNewProxyForHost(forBookmakerData.Host, forBookmakerData.Proxy);
                    if (forBookmakerData.IsNeedCredentials)
                    {
                        foreach (Api allApi in Api.AllApis)
                        {
                            allApi.Request.StopLoadingOnce();
                            allApi.Request.GetInnerHandler()?.AddProxyDataCredentials(forBookmakerData.Credentials);
                        }
                    }
                }
                proxy = (ProxyForChrome)pacScript;
            }
            else
            {
                proxy = proxyFromProxyConfig;
            }
            SetPreferenceRezult preferenceRezult = await Cef.GetGlobalRequestContext().SetProxy(proxy);

            if (!preferenceRezult.IsSuccess)
            {
                await proxyPanelViewModel.ShowErrorDialogAsync((BaseViewModel)proxyPanelViewModel._mainVm, "Прокси НЕ УСТАНОВЛЕН! " + preferenceRezult.ErrorMessage);
            }
            else
            {
                bool isClosed;
                try
                {
                    isClosed = await proxyPanelViewModel.CloseAllConnection(Cef.GetGlobalRequestContext());

                    int num = await proxyPanelViewModel.ClearAllConnectionErrors(Cef.GetGlobalRequestContext()) ? 1 : 0;
                }
                catch (Exception ex)
                {
                    isClosed = false;
                }
                if (!isClosed)
                {
                    await proxyPanelViewModel.ShowMessageDialogAsync((BaseViewModel)proxyPanelViewModel._mainVm, "Предупреждение", "Перезапустите программу, что бы корректно закрыть все соединения или попробуйте еще раз сохранить!");
                }
                if (!loadTestPage)
                {
                    return;
                }
                await Task.Delay(TimeSpan.FromMilliseconds(500.0));

                proxyPanelViewModel._workerOne?.LoadPage("https://2ip.ru");
                proxyPanelViewModel._workerTwo?.LoadPage("https://yandex.ru/internet");
            }
        }