Пример #1
0
        public async void FlagTutorial()
        {
            Debug.WriteLine("Flagging tutorial in ViewModel");

            var employee = await client.GetEmployee();

            if (employee != null && employee.Successful)
            {
                Guid employeeUid = employee.Payload.EmployeeUid;

                var result = await client.FlagTutorial(employeeUid, "posting");

                if (result != null && result.Successful)
                {
                    Debug.WriteLine("Tutorial flagged");
                }
            }
        }
Пример #2
0
        private async void PerformSignIn()
        {
            if (EmailValid && PasswordValid)
            {
                InFlight = true;
                try
                {
                    Debug.WriteLine(Email + " " + Password);
                    var result = await client.PerformSignIn(Email, Password);

                    Debug.WriteLine("RESULT");
                    if (result != null && result.Successful)
                    {
                        PerformSignInEvent(true);
                        AccountInfo.Email = Email;
                        var employee = await client.GetEmployee();

                        AccountInfo.UserId = employee.Payload.UserId;
                        settings.Set(TOKEN_KEY, result.Token);

                        AccountInfo.CompanyName = employee.Payload.CompanyName;

                        Debug.WriteLine("SHOW PROFILE TUTORIAL: " + result.Payload.show_profile_tutorial);
                        Debug.WriteLine("SHOW POST TUTORIAL: " + result.Payload.show_posting_tutorial);

                        AccountInfo.show_posting_tutorial = result.Payload.show_posting_tutorial;

                        AccountInfo.show_profile_tutorial = result.Payload.show_profile_tutorial;

                        Debug.WriteLine("COMPANY NAME " + AccountInfo.CompanyName);

                        //ShowViewModel<HomeViewModel>();
                        AccountInfo.goDirectPosting = false;

                        ShowViewModel <HomeViewModel>();
                    }
                    else
                    {
                        Debug.WriteLine("ERROR PERFORMING SIGN IN RESULT " + result.Message);
                        PerformSignInEvent(false, result.Message);
                    }
                }
                catch (HttpRequestException hre)
                {
                    Debug.WriteLine("ERROR PERFORMING SIGN IN HTTPREQUEST");
                    PerformSignInEvent(false, string.IsNullOrEmpty(hre.Message) ? Resource.LoginError : hre.Message);
                }
                catch (Exception ex)
                {
                    Debug.WriteLine("ERROR PERFORMING SIGN IN EXCEPTION " + ex.Message);
                    // ShowViewModel<HomeViewModelAndroid>();
                    //PerformSignInEvent(false, string.IsNullOrEmpty(ex.Message) ? Resource.LoginError : ex.Message);
                }
                InFlight = false;
            }
            else
            {
                RaisePropertyChanged(() => Email);
                RaisePropertyChanged(() => Password);
                Debug.WriteLine("ERROR PERFORMING SIGN IN WRONG EMAIL AND PASSWORD");
                PerformSignInEvent(false, Resource.LoginError);
            }
        }