Esempio n. 1
0
        private void OnWebBrowserNavigated(object sender, System.Windows.Navigation.NavigationEventArgs e)
        {
            var    dict = HttpUtility.ParseQueryString(e.Uri.Query);
            string code = dict.Get("code");

            if (code != null)
            {
                try
                {
                    var newAccount            = new OneDriveAccount(OneDriveClient.AcquireClientByCode(code));
                    var userId                = newAccount.Client.UserData.Id;
                    var existingConnectedUser = AppSettings.Instance.Accounts.FirstOrDefault(a => a.Client.UserData.Id == userId);
                    if (existingConnectedUser == null)
                    {
                        AppSettings.Instance.Accounts.Add(newAccount);
                    }
                    else
                    {
                        existingConnectedUser.Client.CredentialData = newAccount.Client.CredentialData;
                    }

                    BrowserHolder.Visibility = Visibility.Collapsed;
                    ClearIECache();
                }
                catch (System.Exception ex)
                {
                    ErrorMessageBox.ShowDialog();
                }
            }
            if (dict.Get("error") != null)
            {
                BrowserHolder.Visibility = Visibility.Collapsed;
                ErrorMessageBox.ShowDialog();
            }
        }
Esempio n. 2
0
 private void ConfigFolderForAccout(OneDriveAccount account)
 {
     if (account != null)
     {
         FolderSyncConfigurator window = new FolderSyncConfigurator(account);
         if (window.ShowDialog() == true)
         {
             account.StartSyncActiveFolders();
         }
     }
 }
Esempio n. 3
0
 public FolderSyncConfigurator(OneDriveAccount account)
 {
     InitializeComponent();
     this.Loaded += OnWindowsLoaded;
     this.account = account;
 }