예제 #1
0
        public async void Login()
        {
            //UserName = "******";
            //Password = "******";
            try
            {
                if (string.IsNullOrEmpty(UserName) || string.IsNullOrEmpty(Password))
                {
                    throw new Exception("Chưa nhập username hoặc mật khẩu");
                }
                IsNotWorking = false;
                //await Task.Delay(500);
                await dataProvider.FindUser(UserName, Password);

                if (dataProvider.User != null)
                {
                    DisplayUserName = dataProvider.User.HOTEN;
                    IsDialogOpen    = false;
                    IsLogin         = true;
                    navigationService.NavigateToViewModel <RecommentBookViewModel>();
                }
                else
                {
                    throw new Exception("Username hoặc mật khẩu sai");
                }
            }
            catch (Exception e)
            {
                await ShowMessage1("Lỗi đăng nhập", e.Message);

                return;
            }
            finally
            {
                IsNotWorking = true;
            }
        }
예제 #2
0
        public void NavigateToView(string modelName)
        {
            switch (modelName)
            {
            case "BookInfoView":
                IsMenuEnable = false;
                navigationService.NavigateToViewModel <BookInfoViewModel>();
                IsMenuEnable = true;
                break;

            case "BillView":
                IsMenuEnable = false;
                navigationService.NavigateToViewModel <BillViewModel>();
                IsMenuEnable = true;
                break;

            case "StaffAccountView":
                IsMenuEnable = false;
                navigationService.NavigateToViewModel <StaffAccountViewModel>();
                IsMenuEnable = true;
                break;

            case "CustomerAccountView":
                IsMenuEnable = false;
                navigationService.NavigateToViewModel <CustomerAccountViewModel>();
                IsMenuEnable = true;
                break;

            case "StaffAccountInfoView":
                IsMenuEnable = false;
                navigationService.NavigateToViewModel <StaffAccountInfoViewModel>();
                IsMenuEnable = true;
                break;

            case "CustomerAccountInfoView":
                IsMenuEnable = false;
                navigationService.NavigateToViewModel <CustomerAccountInfoViewModel>();
                IsMenuEnable = true;
                break;

            case "FindBook":
                IsMenuEnable = false;
                navigationService.NavigateToViewModel <FindBookViewModel>();
                IsMenuEnable = true;
                break;

            case "About":
                IsMenuEnable = false;
                navigationService.NavigateToViewModel <AboutViewModel>();
                IsMenuEnable = true;
                break;

            case "Settings":
                IsMenuEnable = false;
                navigationService.NavigateToViewModel <SettingsViewModel>();
                IsMenuEnable = true;
                break;

            default:
                IsMenuEnable = false;
                navigationService.NavigateToViewModel <ErrorViewModel>();
                IsMenuEnable = true;
                break;
            }
        }