private void Synchronize() { var filestorage = App.Kp2a.GetFileStorage(App.Kp2a.GetDb().Ioc); RunnableOnFinish task; OnFinish onFinish = new ActionOnFinish((success, message) => { if (!String.IsNullOrEmpty(message)) { Toast.MakeText(this, message, ToastLength.Long).Show(); } // Tell the adapter to refresh it's list BaseAdapter adapter = (BaseAdapter)ListAdapter; adapter.NotifyDataSetChanged(); if (App.Kp2a.GetDb().OtpAuxFileIoc != null) { var task2 = new SyncOtpAuxFile(App.Kp2a.GetDb().OtpAuxFileIoc); new ProgressTask(App.Kp2a, this, task2).Run(); } }); if (filestorage is CachingFileStorage) { task = new SynchronizeCachedDatabase(this, App.Kp2a, onFinish); } else { task = new CheckDatabaseForChanges(this, App.Kp2a, onFinish); } var progressTask = new ProgressTask(App.Kp2a, this, task); progressTask.Run(); }
private void Synchronize() { var filestorage = App.Kp2a.GetFileStorage(App.Kp2a.GetDb().Ioc); RunnableOnFinish task; OnFinish onFinish = new ActionOnFinish((success, message) => { if (!String.IsNullOrEmpty(message)) Toast.MakeText(this, message, ToastLength.Long).Show(); // Tell the adapter to refresh it's list BaseAdapter adapter = (BaseAdapter)ListAdapter; adapter.NotifyDataSetChanged(); if (App.Kp2a.GetDb().OtpAuxFileIoc != null) { var task2 = new SyncOtpAuxFile(App.Kp2a.GetDb().OtpAuxFileIoc); new ProgressTask(App.Kp2a, this, task2).Run(); } }); if (filestorage is CachingFileStorage) { task = new SynchronizeCachedDatabase(this, App.Kp2a, onFinish); } else { task = new CheckDatabaseForChanges(this, App.Kp2a, onFinish); } var progressTask = new ProgressTask(App.Kp2a, this, task); progressTask.Run(); }