예제 #1
0
 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();
     }
 }
예제 #2
0
        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");
            }
        }
예제 #3
0
        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();
            }
        }
예제 #4
0
        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();
            }
        }