Пример #1
0
 private async void ProcessAuthAsync()
 {
     if (_qbConfiguration != null)
     {
         Task <QbResponse> task = StartOAuthHandshake(_qbConfiguration);
         _qbResponse = await task;
         if (_qbConfiguration.SelectedMode == QbConfig.AppMode.Console)
         {
             Console.WriteLine("Access Token: " + _qbResponse.AccessToken);
         }
     }
 }
Пример #2
0
        private async Task <QbResponse> WinApiAsync(string url, QbConfig qbConfig)
        {
            try
            {
                _qbResponse      = new QbResponse();
                _qbConfiguration = qbConfig;



                var    IE  = new SHDocVw.InternetExplorer();
                object URL = url;
                IE.ToolBar   = 0;
                IE.StatusBar = false;
                IE.MenuBar   = false;
                IE.Width     = 1022;
                IE.Height    = 782;
                IE.Visible   = true;
                IE.Navigate2(url, null, null, null, null);
                if (_qbConfiguration.SelectedMode == QbConfig.AppMode.Console)
                {
                    Console.WriteLine("Begin Loading...");
                }
                while (IE.ReadyState != SHDocVw.tagREADYSTATE.READYSTATE_COMPLETE)
                {
                    if (_qbConfiguration.SelectedMode == QbConfig.AppMode.Console)
                    {
                        Console.WriteLine("Loading the web page...");
                    }
                    if (IE.ReadyState == SHDocVw.tagREADYSTATE.READYSTATE_COMPLETE)
                    {
                        IE.NavigateComplete2 += IE_NavigateComplete2;
                        if (_qbConfiguration.SelectedMode == QbConfig.AppMode.Console)
                        {
                            Console.WriteLine("Loaded!");
                        }
                        _internetExplorer = IE;
                    }
                }
            }
            catch (Exception)
            {
                throw;
            }
            while (true)
            {
                if (_isReadytoExit)
                {
                    return(_qbResponse);
                }
            }
            ;
        }
Пример #3
0
 public void Connect(QbConfig qbConfiguration, out QbResponse qbResponse)
 {
     try
     {
         _qbConfiguration = qbConfiguration;
         Task task = new Task(ProcessAuthAsync);
         task.Start();
         task.Wait();
     }
     catch (Exception)
     {
         throw;
     }
     qbResponse = _qbResponse;
 }