예제 #1
0
        // Token: 0x060003AD RID: 941 RVA: 0x0003FF88 File Offset: 0x0003E188
        private async void YandexMoney_LoadAsync(object sender, EventArgs e)
        {
            this.labelProxy.Text   = YandexMoney._proxyStatus;
            this.ClientId          = Settings.Default.YansexClientId;
            this.RedirectUri       = Settings.Default.YandexRedirectUri;
            YandexMoney.auth.Token = Settings.Default.YandexToken;
            bool flag = string.IsNullOrEmpty(this.ClientId) || string.IsNullOrEmpty(this.RedirectUri);

            if (flag)
            {
                this.label1.Text = "Заполните настройки.";
            }
            else
            {
                try
                {
                    this.webBrowser1.Visible = false;
                    this.label1.Text         = "Проверка подключения.";
                    Label  label = this.label1;
                    double?num   = await YandexMoney.GetYandexBalanceAsync();

                    label.Text = "Подключено. Баланс = " + num;
                    label      = null;
                    num        = null;
                    string text = await YandexMoney.GetYandexOrderHistoryAsync();

                    string hist = text;
                    text = null;
                    this.labelHist.Text = hist;
                    return;
                }
                catch (Exception ex)
                {
                    this.label1.Text         = "Не подключено: " + ex.Message;
                    this.webBrowser1.Visible = true;
                }
                this.webBrowser1.Refresh();
                YandexMoney.Wrapper             wrapper = new YandexMoney.Wrapper(this.webBrowser1);
                YandexMoney.AuthorizationBroker ab      = new YandexMoney.AuthorizationBroker();
                string text2 = await ab.AuthorizeAsync(YandexMoney.Connection, wrapper, YandexMoney.hp.AuthorizationdUri.ToString(), new AuthorizationRequestParams
                {
                    ClientId    = this.ClientId,
                    RedirectUri = this.RedirectUri,
                    Scope       = Scopes.Compose(new string[]
                    {
                        Scopes.AccountInfo,
                        Scopes.OperationHistory,
                        Scopes.OperationDetails
                    })
                });

                string token = text2;
                text2 = null;
                YandexMoney.auth.Token       = token;
                Settings.Default.YandexToken = token;
                Settings.Default.Save();
                AccountInfoRequest <AccountInfoResult> accountInfoRequest = new AccountInfoRequest <AccountInfoResult>(YandexMoney.Connection, new JsonSerializer <AccountInfoResult>());
                AccountInfoResult accountInfoResult2 = await accountInfoRequest.Perform();

                AccountInfoResult accountInfoResult = accountInfoResult2;
                accountInfoResult2 = null;
                this.label1.Text   = "Подключено. Баланс = " + accountInfoResult.Balance;
            }
        }