Пример #1
0
        /// <summary>
        /// finishes the token exchange process
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void webBrowser_DocumentTitleChanged(object sender, EventArgs e)
        {
            if (_GeneratedToken == null && wcAuthenticate.Source.ToString().StartsWith(_UsedConfig.AuthorizationCallBack.ToString()))
            {
                // 5. try to get the real token
                _GeneratedToken = DropBoxStorageProviderTools.ExchangeDropBoxRequestTokenIntoAccessToken(_UsedConfig, appKey, appSecret, _CurrentRequestToken);

                // 6. store the real token to file
                var cs = new CloudStorage();
                if(!Directory.Exists("auth"))
                {
                    Directory.CreateDirectory("auth");
                }
                cs.SerializeSecurityTokenEx(_GeneratedToken, _UsedConfig.GetType(), null, "auth/token.xml");

                // 7. show message box
                Console.WriteLine(@"ConnectWindow>>> Authentication token stored.");

                //Show main window
                var mainWindow = new MainWindowSimple();
                mainWindow.Show();

                Close();
                //System.Windows.Forms.MessageBox.Show(@"Stored token into " + @"auth/token.xml");
            }
        }