protected void Logout(object arg) { if (Mobeelizer.CheckSyncStatus().IsRunning()) { this.navigationService.ShowMessage(Resources.Errors.e_title, Resources.Errors.e_cannotLogout); } else { Mobeelizer.Logout(); SessionSettings.RemoveSessionCode(); this.navigationService.GoBackToRoot(); } }
private void SwitchUser(object arg) { User value = (App.CurrentUser == User.A) ? User.B : User.A; if (!Mobeelizer.CheckSyncStatus().IsRunning()) { this.SwitchingUserCommand.Execute(null); String user = String.Empty; String password = String.Empty; switch (value) { case User.A: user = Resources.Config.c_userALogin; password = Resources.Config.c_userAPassword; break; case User.B: user = Resources.Config.c_userBLogin; password = Resources.Config.c_userBPassword; break; } Mobeelizer.UnregisterForRemoteNotifications(e => { Mobeelizer.Login(SessionCode.ToString(), user, password, (error) => { if (error == null) { App.CurrentUser = value; PushNotificationService.Instance.PerformUserRegistration(); Deployment.Current.Dispatcher.BeginInvoke(new Action(() => { this.RaisePropertyChanged("UserAEnabled"); this.RaisePropertyChanged("UserBEnabled"); })); } this.UserSwitchedCommand.Execute(error); }); }); } else { this.RaisePropertyChanged("UserAEnabled"); this.RaisePropertyChanged("UserBEnabled"); } }
private void OnRemoveRelation(object param) { if (Mobeelizer.CheckSyncStatus().IsRunning()) { navigationService.ShowMessage(Resources.Errors.e_title, Resources.Errors.e_waitUntilSyncFinish); } else { graphsConflictsItemEntity item = param as graphsConflictsItemEntity; using (var transaction = Mobeelizer.GetDatabase().BeginTransaction()) { transaction.GetModelSet <graphsConflictsItemEntity>().DeleteOnSubmit(item); transaction.SubmitChanges(); } RefreshEntitiesList(); } }
private void StatusSelected(object arg) { int value = (int)arg; if (Mobeelizer.CheckSyncStatus().IsRunning()) { navigationService.ShowMessage(Resources.Errors.e_title, Resources.Errors.e_waitUntilSyncFinish); } else { using (var transaction = Mobeelizer.GetDatabase().BeginTransaction()) { var query = from graphsConflictsOrderEntity e in transaction.GetModelSet <graphsConflictsOrderEntity>() where e.Guid == modelGuid select e; graphsConflictsOrderEntity entity = query.Single(); entity.Status = value; transaction.SubmitChanges(); } this.navigationService.GoBack(); } }