Example #1
0
        private void SetCommands()
        {
            this.SignInCommand = new Command(async() =>
            {
                try
                {
                    if (this._findieWebApiService.IsUserExists(this._loginModel.Username, this._loginModel.Password))
                    {
                        using (var controller = new SQLiteController())
                        {
                            controller.AddLoginData(this._loginModel.Username, this._loginModel.Password);
                            Application.Current.MainPage = new MainPage();
                        }
                    }
                    else
                    {
                        await this._showDialogService.ShowDialog(AppResources.Error, AppResources.LoginErrorMessage);
                    }
                }
                catch (Exception ex)
                {
                    await this._showDialogService.ShowDialog(AppResources.Error, AppResources.ConnectionErrorMessage);
                }
            });

            this.SignUpCommand = new Command(async() =>
            {
                await this._navigation.PushModalAsync(new RegisterPage());
            });
        }