Exemplo n.º 1
0
        private void OnLoginStateChange(object sender, UserEventArgs e)
        {
            // Here you get login state change event arguments.
            switch(e.State)
            {
                case LoginState.LoginCompleted:

                    if(e.IsUserPasswordRequired)
                        this.Client.NotifyUser("You must update your password!", "Notification", true);

                    if (e.IsUserInfoRequired)
                        this.Client.NotifyUser("You must update your personal information!", "Notification", true);

                    break;
                default:
                    break;
            }

            // You can observe the user information by looking at event aruments UserProfile property.
            // One important thing to notice is that LoginState is a flag and in case of LoginCompleted the value is combined with LoggedIn.
            // The correct approach checking the specific login state would be by using HasFlag enum extension.
            if(e.State.HasFlag(LoginState.LoginCompleted))
            {
                this.Client.NotifyUser(string.Format("Welcome back : {0}", e.UserProfile.UserName), "Welcome", true);
            }
        }
Exemplo n.º 2
0
 private void OnClientLoginStateChange(object sender, UserEventArgs args)
 {
     if (this.IsOverlayShown)
         this.ClearOverlay();
 }
Exemplo n.º 3
0
        private void AnimateStateChnage(object sender, UserEventArgs args)
        {
            try
            {
                #region LoggingIn
                if (args.State == LoginState.LoggingIn)
                {
                    this.ShowActivity();
                    Storyboard inBoard = ((Storyboard)this.FindResource("InAnimation")).Clone();
                    Storyboard outBoard = ((Storyboard)this.FindResource("OutAnimation")).Clone();
                    inBoard.SetValue(Storyboard.TargetProperty, this.logging_in);
                    outBoard.SetValue(Storyboard.TargetProperty, this.login);
                    inBoard.BeginTime = TimeSpan.FromMilliseconds(500);
                    outBoard.Begin();
                    inBoard.Begin();
                }
                #endregion

                #region LoggedIn
                else if (args.State == LoginState.LoggedIn)
                {
                    this.HideActivity();
                    Storyboard inBoard = ((Storyboard)this.FindResource("InAnimation")).Clone();
                    Storyboard outBoard = ((Storyboard)this.FindResource("OutAnimation")).Clone();
                    inBoard.SetValue(Storyboard.TargetProperty, this.logged_in);
                    outBoard.SetValue(Storyboard.TargetProperty, this.logging_in);
                    inBoard.BeginTime = TimeSpan.FromMilliseconds(500);
                    outBoard.Begin();
                    inBoard.Begin();
                }
                #endregion

                #region LoginFailed
                else if (args.State == LoginState.LoginFailed)
                {
                    this.HideActivity();
                    this.fail_reason.Text = args.FailReason.ToString();
                    Storyboard inBoard = ((Storyboard)this.FindResource("InAnimation")).Clone();
                    Storyboard outBoard = ((Storyboard)this.FindResource("OutAnimation")).Clone();
                    inBoard.SetValue(Storyboard.TargetProperty, this.login_failed);
                    outBoard.SetValue(Storyboard.TargetProperty, this.logging_in);
                    inBoard.BeginTime = TimeSpan.FromMilliseconds(500);
                    outBoard.Begin();
                    inBoard.Completed += new EventHandler(OnAnimationCompleted);
                    inBoard.Begin();
                }
                #endregion

                #region LoggingOut
                else if (args.State == LoginState.LoggingOut)
                {
                    this.ShowActivity();
                    Storyboard inBoard = ((Storyboard)this.FindResource("InAnimation")).Clone();
                    Storyboard outBoard = ((Storyboard)this.FindResource("OutAnimation")).Clone();
                    inBoard.SetValue(Storyboard.TargetProperty, this.logging_out);
                    outBoard.SetValue(Storyboard.TargetProperty, this.logged_in);
                    inBoard.BeginTime = TimeSpan.FromMilliseconds(500);
                    outBoard.Begin();
                    inBoard.Begin();
                }
                #endregion

                #region LoggedOut
                else if (args.State == LoginState.LoggedOut)
                {
                    this.HideActivity();
                    Storyboard inBoard = ((Storyboard)this.FindResource("InAnimation")).Clone();
                    Storyboard outBoard = ((Storyboard)this.FindResource("OutAnimation")).Clone();
                    inBoard.SetValue(Storyboard.TargetProperty, this.login);
                    if (args.OldState == LoginState.LoggingOut)
                    {
                        outBoard.SetValue(Storyboard.TargetProperty, this.logging_out);
                    }
                    if (args.OldState == LoginState.LoggedIn)
                    {
                        outBoard.SetValue(Storyboard.TargetProperty, this.logged_in);
                    }
                    inBoard.BeginTime = TimeSpan.FromMilliseconds(500);
                    outBoard.Begin();
                    inBoard.Begin();
                }
                #endregion
            }
            catch (Exception ex)
            {
                Trace.WriteLine(String.Format("LoginBox:AnimateStateChnage:{0}", ex));
            }
        }
Exemplo n.º 4
0
 private void LoginStateChange(object sender, UserEventArgs args)
 {
     this.Dispatcher.BeginInvoke(new LoginStateChanagedDelegate(AnimateStateChnage), sender, args);
 }
Exemplo n.º 5
0
        public void RefreshEvents(IEnumerable <EventCountDTO> eventCountList)
        {
            UserEventArgs userArgs = new UserEventArgs(UserEvent.RefreshEvents, eventCountList);

            OnUserEvent(userArgs);
        }
Exemplo n.º 6
0
        public void update(List <ConcertDTO> L)
        {
            UserEventArgs args = new UserEventArgs(UserEvent.TicketSold, L);

            OnUserEvent(args);
        }