private void _modelAuth_LoadUserComplete(object sender, LoadUserOperationEventArgs e)
 {
     try
     {
         if (e.HasError)
         {
             MessageCustomize.Show("Main: " + e.Error.Message + "-" + e.Error.StackTrace);
             ErrorProcess();
         }
         else
         {
             if (e.LoginOp.User.Identity.Name == string.Empty)
             {
                 CallDialog.Show(this, ViewTypes.LoginView, c =>
                 {
                     if (c == MessageBoxResult.OK)
                     {
                         _modelAuth.LoadUserAsync();
                     }
                 });
             }
             else
             {
                 _itemLogin = e.LoginOp.User as LoginUser;
                 ReloadData();
             }
         }
     }
     catch (Exception ex)
     {
         MessageCustomize.Show(ex.Message);
         ErrorProcess();
     }
 }
Exemple #2
0
        private void _modelAuth_LoadUserComplete(object sender, LoadUserOperationEventArgs e)
        {
            try
            {
                if (e.HasError)
                {
                    MessageCustomize.Show("Main: " + e.Error.Message + "-" + e.Error.StackTrace);
                    ErrorProcess();
                }
                else
                {
                    if (e.LoginOp.User.Identity.Name == string.Empty)
                    {
                        CallDialog.Show(this, ViewTypes.LoginView, c =>
                        {
                            if (c == MessageBoxResult.OK)
                            {
                                _modelAuth.LoadUserAsync();
                            }
                        });
                    }
                    else
                    {
                        LoginUser ItemLogin = e.LoginOp.User as LoginUser;

                        SystemConfig.UserID      = ItemLogin.UserID;
                        SystemConfig.UserName    = ItemLogin.Name;
                        SystemConfig.DisplayName = ItemLogin.LastName + " " + ItemLogin.FirstName;
                        SystemConfig.UserType    = ItemLogin.UserType;
                        SystemConfig.CurrentDate = DateTime.Now;
                        if (ItemLogin.Settings.ContainsKey(KeySetting.Theme))
                        {
                            SystemConfig.Theme = ItemLogin.Settings[KeySetting.Theme];
                        }
                        if (ItemLogin.Settings.ContainsKey(KeySetting.PagingSize))
                        {
                            SystemConfig.PagingSize = Convert.ToInt32(ItemLogin.Settings[KeySetting.PagingSize]);
                        }
                        ListAuth = null;

                        if (SetFocus != null)
                        {
                            SetFocus(2, null);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                MessageCustomize.Show(ex.Message);
                ErrorProcess();
            }
        }