Exemplo n.º 1
0
        private async void OnProfileChangeClicked(object sender, EventArgs e)
        {
            if (!_internetConnectionChecker.CheckConnection())
            {
                await DisplayAlert(Properties.Resources.NoNetworkMsgTitle, Properties.Resources.NoNetworkMsgContent, Properties.Resources.NoNetworkMsgConfirm);

                return;
            }

            await _settingsViewModel.PickProfilePhoto();
        }
Exemplo n.º 2
0
        protected async override void OnAppearing()
        {
            base.OnAppearing();
            if (!_internetConnectionChecker.CheckConnection())
            {
                await DisplayAlert(Properties.Resources.NoNetworkMsgTitle, Properties.Resources.NoNetworkMsgContent, Properties.Resources.NoNetworkMsgConfirm);

                return;
            }

            _postsViewModel.LoadBookPosts();
        }
Exemplo n.º 3
0
        protected async override void OnDisappearing()
        {
            if (!_internetConnectionChecker.CheckConnection())
            {
                await DisplayAlert(Properties.Resources.NoNetworkMsgTitle, Properties.Resources.NoNetworkMsgContent, Properties.Resources.NoNetworkMsgConfirm);

                return;
            }

            base.OnDisappearing();
            await _model.DeleteConversationIfEmpty();
        }
        protected async override void OnAppearing()
        {
            base.OnAppearing();
            _popped = true;
            if (!_internetConnectionChecker.CheckConnection())
            {
                await DisplayAlert(Properties.Resources.NoNetworkMsgTitle, Properties.Resources.NoNetworkMsgContent, Properties.Resources.NoNetworkMsgConfirm);

                return;
            }

            await _model.GetUserConversations();

            _model.RemoveEmtpyConversations();
        }
Exemplo n.º 5
0
        private async void Login()
        {
            if (!_internetConnectionChecker.CheckConnection())
            {
                await DisplayAlert(Properties.Resources.NoNetworkMsgTitle, Properties.Resources.NoNetworkMsgContent, Properties.Resources.NoNetworkMsgConfirm);

                return;
            }

            using (UserDialogs.Instance.Loading("Logging in..."))
            {
                var loginResult = await _loginViewModel.LoginAsync(PasswordEntry.Text);

                if (loginResult.Successful)
                {
                    await Navigation.PushAsync(App.Container.Resolve <PostsPage>());

                    _loginViewModel.Username = string.Empty;
                    PasswordEntry.Text       = string.Empty;
                }
                else
                {
                    await DisplayAlert("Error", "Bad credentials!", "OK");
                }
            }
        }
        private async void OnAddUserClicked(object sender, EventArgs e)
        {
            if (!_internetConnectionChecker.CheckConnection())
            {
                await DisplayAlert(Properties.Resources.NoNetworkMsgTitle, Properties.Resources.NoNetworkMsgContent, Properties.Resources.NoNetworkMsgConfirm);

                return;
            }

            bool added = await _createGroupViewModel.AddUser();

            if (!added)
            {
                await DisplayAlert("Error", "The provided user does not exist or was already added.", "OK");
            }
        }
Exemplo n.º 7
0
        private async void OnSignUpClicked(object sender, EventArgs e)
        {
            if (!_internetConnectionChecker.CheckConnection())
            {
                await DisplayAlert(Properties.Resources.NoNetworkMsgTitle, Properties.Resources.NoNetworkMsgContent, Properties.Resources.NoNetworkMsgConfirm);

                return;
            }

            var signupResult = await _signupViewModel.SignupAsync(PasswordEntry.Text, RePasswordEntry.Text);

            if (signupResult == SignupResult.BadCredentials)
            {
                await DisplayAlert("Error", "Bad credentials!", "OK");
            }
            else if (signupResult == SignupResult.UserAlreadyRegistered)
            {
                await DisplayAlert("Error", "User already registered", "OK");
            }
            else
            {
                await DisplayAlert("Success", "Your account has been created", "OK");

                await Navigation.PopAsync();
            }
        }
Exemplo n.º 8
0
        private async void OnFilterClicked(object sender, EventArgs e)
        {
            if (!_internetConnectionChecker.CheckConnection())
            {
                await DisplayAlert(Properties.Resources.NoNetworkMsgTitle, Properties.Resources.NoNetworkMsgContent, Properties.Resources.NoNetworkMsgConfirm);

                return;
            }

            _model.CreateSpecification();
            await Navigation.PopAsync();
        }
Exemplo n.º 9
0
        private async void OnChatClicked(object sender, EventArgs e)
        {
            if (!_internetConnectionChecker.CheckConnection())
            {
                await DisplayAlert(Properties.Resources.NoNetworkMsgTitle, Properties.Resources.NoNetworkMsgContent, Properties.Resources.NoNetworkMsgConfirm);

                return;
            }

            using (UserDialogs.Instance.Loading("Loading conversation..."))
            {
                await _model.StartConversationAsync();

                await Navigation.PushAsync(App.Container.Resolve <ConversationPage>());
            }
        }
Exemplo n.º 10
0
        private async void OnPostClicked(object sender, EventArgs e)
        {
            if (!_internetConnectionChecker.CheckConnection())
            {
                await DisplayAlert(Properties.Resources.NoNetworkMsgTitle, Properties.Resources.NoNetworkMsgContent, Properties.Resources.NoNetworkMsgConfirm);

                return;
            }

            var posted = await _model.MakePostAsync();

            if (posted)
            {
                await DisplayAlert("Success", "Your post has been created!", "OK");

                await Navigation.PopAsync();
            }
            else
            {
                await DisplayAlert("Failed", "We could not create your post. Please try again.", "OK");
            }
        }