コード例 #1
0
        private void SubmitBtn_Clicked(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(reviewForm.Name))
            {
                reviewForm.Name = "anonymous";
            }

            // error check before submission

            if (string.IsNullOrEmpty(reviewForm.AddressLine1))
            {
                VisualStateManager.GoToState(AddressLine1, "HasNoText");
            }

            else if (string.IsNullOrEmpty(reviewForm.CityTown))
            {
                VisualStateManager.GoToState(CityTown, "HasNoText");
            }

            else if (string.IsNullOrEmpty(reviewForm.CountyRegionState))
            {
                VisualStateManager.GoToState(CountyRegionState, "HasNoText");
            }

            else if (string.IsNullOrEmpty(reviewForm.Postcode))
            {
                VisualStateManager.GoToState(Postcode, "HasNoText");
            }

            else if (reviewForm.ValidUKPostcode() == false)
            {
                VisualStateManager.GoToState(Postcode, "InvalidPostcode");
            }

            else if (reviewForm.SadClicked == false && reviewForm.SmileyClicked == false)
            {
                VisualStateManager.GoToState(SadOrSmileyButtonClickInformer, "UnclickedAndSumbitted");
            }

            else if (Connectivity.NetworkAccess != NetworkAccess.Internet)
            {
                NoAccessToInternetInformer.IsVisible = true;
            }

            //  submission

            else
            {
                WebAPIHandler.SendToDatabase(reviewForm);
                Navigation.PopAsync();
            }
        }