private async Task AddComplaint() { this.Activity.RunOnUiThread(() => progressBar.Visibility = ViewStates.Visible); List <string> photos = new List <string>(); foreach (Bitmap b in images) { photos.Add(ImageToBase64String(b)); } Complaint complaint = new Complaint() { furnitureId = furniture.id, description = problemDesc.Text, photo = photos, senderName = GlobalVars.login, madeBy = furniture.madeBy }; if (complaint.Correct() && photoDefault != photoPreview.Drawable) { FireBaseConnector connector = new FireBaseConnector(); var res = connector.dataInsert(complaint); if (res == 0) { if (photos.Count != 0) { Android.Support.V7.App.AlertDialog.Builder alertDialog = new Android.Support.V7.App.AlertDialog.Builder(this.Activity); alertDialog.SetTitle(GetString(Resource.String.dataError)); alertDialog.SetIcon(Resource.Drawable.ic4c_192x192); alertDialog.SetMessage(GetString(Resource.String.addCorrect)); alertDialog.SetNeutralButton(GetString(Resource.String.OKbutton), delegate { alertDialog.Dispose(); }); alertDialog.Show(); } else { Android.Support.V7.App.AlertDialog.Builder alertDialog = new Android.Support.V7.App.AlertDialog.Builder(this.Activity); alertDialog.SetTitle(GetString(Resource.String.photoError)); alertDialog.SetIcon(Resource.Drawable.ic4c_192x192); alertDialog.SetMessage(GetString(Resource.String.photoErrorMsg)); alertDialog.SetNeutralButton(GetString(Resource.String.OKbutton), delegate { alertDialog.Dispose(); }); alertDialog.Show(); } } if (res == -1) { Android.Support.V7.App.AlertDialog.Builder alertDialog = new Android.Support.V7.App.AlertDialog.Builder(this.Activity); alertDialog.SetTitle(GetString(Resource.String.noInternetConnection)); alertDialog.SetIcon(Resource.Drawable.ic5c_192x192); alertDialog.SetMessage(GetString(Resource.String.checkConnection)); alertDialog.SetNeutralButton(GetString(Resource.String.OKbutton), delegate { alertDialog.Dispose(); }); alertDialog.Show(); } if (res == 1) { Android.Support.V7.App.AlertDialog.Builder alertDialog = new Android.Support.V7.App.AlertDialog.Builder(this.Activity); alertDialog.SetTitle(GetString(Resource.String.complaintCorrect)); alertDialog.SetIcon(Resource.Drawable.ok2a_192x192); alertDialog.SetMessage(GetString(Resource.String.complaintMessage)); alertDialog.SetNeutralButton(GetString(Resource.String.OKbutton), delegate { alertDialog.Dispose(); this.OnComplaintCreated(); this.Dismiss(); }); alertDialog.Show(); } } else { Android.Support.V7.App.AlertDialog.Builder alertDialog = new Android.Support.V7.App.AlertDialog.Builder(this.Activity); alertDialog.SetTitle(GetString(Resource.String.dataError)); alertDialog.SetIcon(Resource.Drawable.ic4c_192x192); alertDialog.SetMessage(GetString(Resource.String.addCorrect)); alertDialog.SetNeutralButton(GetString(Resource.String.OKbutton), delegate { alertDialog.Dispose(); }); alertDialog.Show(); } this.Activity.RunOnUiThread(() => btn2Complaint.Enabled = true); this.Activity.RunOnUiThread(() => progressBar.Visibility = ViewStates.Invisible); }
private void ActionHooker() { signUpCancel.Click += delegate { Dialog.Cancel(); }; signUpAccept.Click += delegate { UserLogins login = new UserLogins() { login = signUpLogin.Text, userPassword = signUpPassword.Text, admin = false }; FireBaseConnector connector = new FireBaseConnector(); if (login.login.Length > 0 && login.userPassword.Length > 0) { if (connector.checkLoginPossibility(login) == 0) { Android.Support.V7.App.AlertDialog.Builder alertDialog = new Android.Support.V7.App.AlertDialog.Builder(this.Activity); alertDialog.SetTitle(GetString(Resource.String.loginInUse)); alertDialog.SetIcon(Resource.Drawable.ic4b_192x192); alertDialog.SetMessage(GetString(Resource.String.loginOther)); alertDialog.SetNeutralButton(GetString(Resource.String.OKbutton), delegate { alertDialog.Dispose(); }); alertDialog.Show(); } if (connector.checkLoginPossibility(login) == 1) { connector.dataInsert(login); Android.Support.V7.App.AlertDialog.Builder alertDialog = new Android.Support.V7.App.AlertDialog.Builder(this.Activity); alertDialog.SetTitle(GetString(Resource.String.accountCreated)); alertDialog.SetIcon(Resource.Drawable.ok2a_192x192); alertDialog.SetMessage(GetString(Resource.String.accountCreatedMessage) + " " + login.login); alertDialog.SetNeutralButton(GetString(Resource.String.OKbutton), delegate { alertDialog.Dispose(); }); alertDialog.Show(); } if (connector.checkLoginPossibility(login) == -1) { Android.Support.V7.App.AlertDialog.Builder alertDialog = new Android.Support.V7.App.AlertDialog.Builder(this.Activity); alertDialog.SetTitle(GetString(Resource.String.noInternetConnection)); alertDialog.SetIcon(Resource.Drawable.ic5c_192x192); alertDialog.SetMessage(GetString(Resource.String.checkConnection)); alertDialog.SetNeutralButton(GetString(Resource.String.OKbutton), delegate { alertDialog.Dispose(); }); alertDialog.Show(); } } else { Android.Support.V7.App.AlertDialog.Builder alertDialog = new Android.Support.V7.App.AlertDialog.Builder(this.Activity); alertDialog.SetTitle(GetString(Resource.String.registerError)); alertDialog.SetIcon(Resource.Drawable.ic4c_192x192); alertDialog.SetMessage(GetString(Resource.String.registerErrorMessage)); alertDialog.SetNeutralButton(GetString(Resource.String.OKbutton), delegate { alertDialog.Dispose(); }); alertDialog.Show(); } }; }