Esempio n. 1
0
 public async void OnSuccess(Java.Lang.Object result)
 {
     //MaterialAlertDialogBuilder alert = new MaterialAlertDialogBuilder(context);
     ////Android.App.AlertDialog.Builder alert = new Android.App.AlertDialog.Builder(context);
     //alert.SetTitle("Error");
     //alert.SetMessage(result.ToString());
     //alert.SetNeutralButton("OK", delegate
     //{
     //    alert.Dispose();
     //});
     //alert.Show(); loadingDialog.Dismiss();
     loadingDialog.Dismiss();
 }
        private async void SubmitAwareness_Click(object sender, EventArgs e)
        {
            if (!string.IsNullOrEmpty(AwarenessInput.Text) && !string.IsNullOrWhiteSpace(AwarenessInput.Text))
            {
                Dictionary <string, object> data = new Dictionary <string, object>
                {
                    { "Uid", FirebaseAuth.Instance.CurrentUser.Uid },
                    { "Dates", FieldValue.ServerTimestamp },
                    { "Message", AwarenessInput.Text },
                    { "ImageUrl", null },
                };
                loadingDialog = new IonAlert(context, IonAlert.ProgressType);
                loadingDialog.SetSpinKit("WanderingCubes")
                .SetSpinColor("#008D91")
                .ShowCancelButton(false)
                .Show();
                query = await CrossCloudFirestore.Current
                        .Instance
                        .Collection("AWARENESS")
                        .AddAsync(data);

                //dbRef = FirebaseDatabase.Instance.GetReference("Awareness").Push();
                //dbRef.SetValue(data);
                if (imageArray != null)
                {
                    //storageRef = FirebaseStorage.Instance.GetReference("AWARENESS");
                    //storageRef.PutBytes(imageArray)
                    //    .AddOnSuccessListener(this)
                    //    .AddOnCompleteListener(this)
                    //    .AddOnFailureListener(this);


                    var storage_ref = Plugin.FirebaseStorage.CrossFirebaseStorage
                                      .Current
                                      .Instance
                                      .RootReference
                                      .Child("AWARENESS")
                                      .Child(query.Id);

                    await storage_ref.PutStreamAsync(upload_file);

                    var url = await storage_ref.GetDownloadUrlAsync();

                    //    .PutStreamAsync(file.GetStream());
                    await CrossCloudFirestore
                    .Current
                    .Instance
                    .Collection("AWARENESS")
                    .Document(query.Id)
                    .UpdateAsync("ImageUrl", url.ToString());
                }
                else
                {
                    loadingDialog.Dismiss();
                }
            }
            else
            {
                AwarenessInput.Error = "Type a message";
            }
            AwarenessInput.Text = string.Empty;
            Dismiss();
        }
Esempio n. 3
0
 public void OnComplete(Task task)
 {
     loadingDialog.Dismiss();
     BtnRegister.Enabled = true;
 }
 public void OnComplete(Task task)
 {
     loadingDialog.Dismiss();
 }