protected override void OnStart() { base.OnStart(); Kp2aLog.Log("FileSelect.OnStart"); //if no database is loaded: load the most recent database if ((Intent.GetBooleanExtra(NoForwardToPasswordActivity, false) == false) && _dbHelper.HasRecentFiles() && !App.Kp2a.OpenDatabases.Any()) { var fileStorage = new LocalFileStorage(App.Kp2a); ICursor filesCursor = _dbHelper.FetchAllFiles(); filesCursor = new FilteredCursor(filesCursor, cursor => !fileStorage.IsLocalBackup(IOConnectionInfo.FromPath(cursor.GetString(1)))); StartManagingCursor(filesCursor); if (filesCursor.Count > 0) { filesCursor.MoveToFirst(); IOConnectionInfo ioc = _dbHelper.CursorToIoc(filesCursor); if (App.Kp2a.GetFileStorage(ioc).RequiresSetup(ioc) == false) { LaunchPasswordActivityForIoc(ioc); } else { App.Kp2a.GetFileStorage(ioc) .PrepareFileUsage(new FileStorageSetupInitiatorActivity(this, OnActivityResult, null), ioc, 0, false); } } } }
private void FillData() { // Get all of the rows from the database and create the item list ICursor filesCursor = _dbHelper.FetchAllFiles(); if (FindViewById <Switch>(Resource.Id.local_backups_switch).Checked == false) { var fileStorage = new LocalFileStorage(App.Kp2a); filesCursor = new FilteredCursor(filesCursor, cursor => !fileStorage.IsLocalBackup(IOConnectionInfo.FromPath(cursor.GetString(1)))); } StartManagingCursor(filesCursor); FragmentManager.FindFragmentById <RecentFilesFragment>(Resource.Id.recent_files).SetAdapter(new MyCursorAdapter(this, filesCursor, App.Kp2a)); }