async Task ExecuteSyncCommandAsync() { if (IsBusy) { return; } if (!CrossConnectivity.Current.IsConnected) { MessagingUtils.SendOfflineMessage(); return; } Logger.Track(EvolveLoggerKeys.ManualSync); SyncText = "Syncing..."; IsBusy = true; try { #if DEBUG await Task.Delay(1000); #endif Settings.HasSyncedData = true; Settings.LastSync = DateTime.UtcNow; OnPropertyChanged("LastSyncDisplay"); await StoreManager.SyncAllAsync(Settings.Current.IsLoggedIn); if (!Settings.Current.IsLoggedIn) { MessagingService.Current.SendMessage <MessagingServiceAlert>(MessageKeys.Message, new MessagingServiceAlert { Title = "CWITC Data Synced", Message = "You now have the latest conference data, however to sync your favorites and feedback you must sign in.", Cancel = "OK" }); } } catch (Exception ex) { ex.Data["method"] = "ExecuteSyncCommandAsync"; MessagingUtils.SendAlert("Unable to sync", "Uh oh, something went wrong with the sync, please try again. \n\n Debug:" + ex.Message); Logger.Report(ex); } finally { SyncText = "Sync Now"; IsBusy = false; } }
async Task ExecuteSyncCommandAsync() { if (IsBusy) { return; } if (!CrossConnectivity.Current.IsConnected) { MessagingUtils.SendOfflineMessage(); return; } Logger.Track(EvolveLoggerKeys.ManualSync); SyncText = "Syncing..."; IsBusy = true; try { #if DEBUG await Task.Delay(1000); #endif Settings.HasSyncedData = true; Settings.LastSync = DateTime.UtcNow; OnPropertyChanged("LastSyncDisplay"); await StoreManager.SyncAllAsync(Settings.Current.IsLoggedIn); } catch (Exception ex) { ex.Data["method"] = "ExecuteSyncCommandAsync"; MessagingUtils.SendAlert("Unable to sync", "Uh oh, something went wrong with the sync, please try again. \n\n Debug:" + ex.Message); Logger.Report(ex); } finally { SyncText = "Sync Now"; IsBusy = false; } }