Exemplo n.º 1
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.º 2
0
 private void PushChannel_ErrorOccurred(object sender, NotificationChannelErrorEventArgs e)
 {
     channelUri = null;
     Mobeelizer.UnregisterForRemoteNotifications((result) => { });
 }