private void btnRootFolder_Click_1(object sender, RoutedEventArgs e) { if (IsBusy()) { return; } _navState.Reset(null); NavigateTo(_storage.RootFolder(), null, NavigationDirection.LevelDown, false); }
//for external use only public void LoginAndEnumFiles(StorageType storageType) { if (IsBusy() || storageType == StorageType.Undefined) { return; } progressInfo.Visibility = Visibility.Visible; Entries.Clear(); // need to clear here for the case if authentication throws exception Action worker = () => { try { switch (storageType) { case StorageType.Dropbox: _storage = new DropStorage(webViewCallback); _navState.Reset("Dropbox"); break; case StorageType.GDrive: _storage = new GDriveStorage(webViewCallback); _navState.Reset("Google Drive"); break; default: throw new NotSupportedException(); } NavigateTo(_storage.RootFolder(), null, NavigationDirection.LevelDown, true); } catch (Exception e) { downloadProgress.Visibility = Visibility.Collapsed; MessageDlg.Show("Authentication error. Please try to connect again: \n" + e.ToString(), "Error", MessageBoxButton.OK, MessageBoxImage.Error); } finally { progressInfo.Visibility = Visibility.Collapsed; } }; this.Dispatcher.BeginInvoke(worker, DispatcherPriority.Background); }
//for external use only public void LoginAndEnumFiles(StorageType storageType) { if (IsBusy() || storageType==StorageType.Undefined) return; progressInfo.Visibility = Visibility.Visible; Entries.Clear(); // need to clear here for the case if authentication throws exception Action worker = () => { try { switch (storageType) { case StorageType.Dropbox: _storage = new DropStorage(webViewCallback); _navState.Reset("Dropbox"); break; case StorageType.GDrive: _storage = new GDriveStorage(webViewCallback); _navState.Reset("Google Drive"); break; default: throw new NotSupportedException(); } NavigateTo(_storage.RootFolder(), null, NavigationDirection.LevelDown, true); } catch (Exception e) { downloadProgress.Visibility = Visibility.Collapsed; MessageDlg.Show("Authentication error. Please try to connect again: \n" + e.ToString(), "Error", MessageBoxButton.OK, MessageBoxImage.Error); } finally { progressInfo.Visibility = Visibility.Collapsed; } }; this.Dispatcher.BeginInvoke(worker, DispatcherPriority.Background); }