Exemplo n.º 1
0
        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();
        }
Exemplo n.º 2
0
        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();
        }