private void OAuth_CompleteAuthorizationClick(string code)
        {
            try
            {
                if (!string.IsNullOrEmpty(code) && DropboxUploader.Config.DropboxOAuth2Info != null)
                {
                    DropboxUploader dropbox = new DropboxUploader(DropboxUploader.Config.DropboxOAuth2Info);
                    bool            result  = dropbox.GetAccessToken(code);

                    if (result)
                    {
                        DropboxUploader.Config.DropboxAccountInfo = dropbox.GetAccountInfo();
                        UpdateDropboxStatus();

                        oauth.Status = OAuthLoginStatus.LoginSuccessful;

                        if (DropboxUploader.Config.DropboxAccountInfo != null)
                        {
                            MessageBox.Show("Login was successful.", "ShareX", MessageBoxButton.OK, MessageBoxImage.Information);
                        }
                        else
                        {
                            MessageBox.Show("Login was successful but failed to get account information", "ShareX",
                                            MessageBoxButton.OK, MessageBoxImage.Error);
                        }

                        return;
                    }
                    else
                    {
                        oauth.Status = OAuthLoginStatus.LoginFailed;
                        MessageBox.Show("Login failed", "ShareX", MessageBoxButton.OK, MessageBoxImage.Error);
                    }
                }

                DropboxUploader.Config.DropboxAccountInfo = null;
                UpdateDropboxStatus();
            }
            catch (Exception ex)
            {
                DebugHelper.WriteException(ex);
                MessageBox.Show(ex.ToString(), "ShareX - Error", MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }
        private void OAuth_OpenAuthorizePageClick(object sender, RoutedEventArgs e)
        {
            try
            {
                OAuth2Info oauth = new OAuth2Info(APIKeys.DropboxConsumerKey, APIKeys.DropboxConsumerSecret);

                string url = new DropboxUploader(oauth).GetAuthorizationURL();

                if (!string.IsNullOrEmpty(url))
                {
                    DropboxUploader.Config.DropboxOAuth2Info = oauth;
                    URLHelper.OpenURL(url);
                    DebugHelper.WriteLine("DropboxAuthOpen - Authorization URL is opened: " + url);
                }
                else
                {
                    DebugHelper.WriteLine("DropboxAuthOpen - Authorization URL is empty.");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString(), "Error", MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }