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(); } }
private void ConfigFolderForAccout(OneDriveAccount account) { if (account != null) { FolderSyncConfigurator window = new FolderSyncConfigurator(account); if (window.ShowDialog() == true) { account.StartSyncActiveFolders(); } } }
public FolderSyncConfigurator(OneDriveAccount account) { InitializeComponent(); this.Loaded += OnWindowsLoaded; this.account = account; }