Exemplo n.º 1
0
 private void ConnectToSession(object arg)
 {
     this.BusyMessage = "Logging in...";
     this.IsBusy      = true;
     App.CurrentUser  = User.A;
     Mobeelizer.Login(SessionCode.ToString(), Resources.Config.c_userALogin, Resources.Config.c_userAPassword, (error) =>
     {
         this.IsBusy = false;
         try
         {
             if (error == null)
             {
                 App.CurrentUser = User.A;
                 PushNotificationService.Instance.PerformUserRegistration();
                 navigationService.Navigate(new Uri(String.Format("/View/ExplorePage.xaml?SessionCode={0}", this.SessionCode), UriKind.Relative));
             }
             else if (error.Code == "missingConnection")
             {
                 this.navigationService.ShowMessage(Resources.Errors.e_title, Resources.Errors.e_missingConnection);
             }
             else
             {
                 this.navigationService.ShowMessage(Resources.Errors.e_title, Resources.Errors.e_cannotConnectToSession);
             }
         }
         catch
         {
             this.navigationService.ShowMessage(Resources.Errors.e_title, Resources.Errors.e_cannotConnectToSession);
         }
     });
 }
Exemplo n.º 2
0
 public void _Init()
 {
     Mobeelizer.OnLaunching();
     UTWebRequest.SyncData = "firstSync.zip";
     Mobeelizer.Login("user", "password", (s) =>
     {
         loginEvent.Set();
     });
     loginEvent.WaitOne();
 }
Exemplo n.º 3
0
        public void Login_02()
        {
            MobeelizerOperationError loginStatus = null;

            Mobeelizer.Login("user", "passsssword", (s) =>
            {
                loginStatus = s;
                login_02Event.Set();
            });
            login_02Event.WaitOne();
            Assert.IsNotNull(loginStatus);
        }
Exemplo n.º 4
0
        public void Login()
        {
            UTWebRequest.SyncData = "firstSync.zip";
            MobeelizerOperationError loginStatus = null;

            Mobeelizer.Login("user", "password", (s) =>
            {
                loginStatus = s;
                loginEvent.Set();
            });
            loginEvent.WaitOne();
            Assert.IsNull(loginStatus);
        }
Exemplo n.º 5
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");
            }
        }
Exemplo n.º 6
0
        public void SyncAll()
        {
            UTWebRequest.SyncData = "firstSync.zip";
            Mobeelizer.Login("user", "password", (s) =>
            {
                syncAllLoginEvent.Set();
            });
            syncAllLoginEvent.WaitOne();
            String justAddEntityGuid = string.Empty;

            using (IMobeelizerTransaction db = Mobeelizer.GetDatabase().BeginTransaction())
            {
                var        departmentTable = db.GetModelSet <Department>();
                Department de = new Department();
                de.InternalNumber = 1;
                de.Name           = "ddd";
                departmentTable.InsertOnSubmit(de);
                db.SubmitChanges();
                justAddEntityGuid = de.Guid;
            }

            MobeelizerOperationError status = null;

            Mobeelizer.SyncAll((s) =>
            {
                status = s;
                this.syncAllEvent.Set();
            });
            syncAllEvent.WaitOne();
            Assert.IsNull(status);
            Department foundObject = null;

            using (IMobeelizerTransaction db = Mobeelizer.GetDatabase().BeginTransaction())
            {
                var departmentTable = db.GetModelSet <Department>();
                var query           = from d in departmentTable where d.Guid == justAddEntityGuid select d;
                try
                {
                    foundObject = query.Single();
                }
                catch { }
                Assert.IsNull(foundObject);
                Assert.AreEqual(1, departmentTable.Count());
            }
        }