예제 #1
0
        public static void HideProgress()
        {
            CrossCurrentActivity.Current.Activity.RunOnUiThread(() =>
            {
                if (progressDialog != null)
                {
                    progressDialog.Hide();

                    progressDialog = null;
                }
            });
        }
예제 #2
0
        private void CreateAccount()
        {
            var results = AccountValidator.Validate(ViewModel);

            if (!results.IsValid)
            {
                Android.Support.V7.App.AlertDialog         alertDialog = null;
                Android.Support.V7.App.AlertDialog.Builder builder     = new Android.Support.V7.App.AlertDialog.Builder(this)
                                                                         .SetTitle("Invalid Model")
                                                                         .SetMessage("- " + string.Join(" \n -", results.Errors.Select(x => x.ErrorMessage).ToList()))
                                                                         .SetPositiveButton("Ok", (object s, Android.Content.DialogClickEventArgs dialogClickEventArgs) =>
                {
                    alertDialog.Hide();
                });

                alertDialog = builder.Create();
                alertDialog.Show();
            }
            else
            {
                try
                {
                    var db = new SQLiteConnection(DBPath);

                    var insert = db.Insert(new Account()
                    {
                        Password    = ViewModel.Password,
                        UserName    = ViewModel.UserName,
                        FirstName   = ViewModel.FirstName,
                        LastName    = ViewModel.LastName,
                        PhoneNumber = ViewModel.PhoneNumber,
                        ServiceDate = ViewModel.ServiceStartDate.Value
                    });

                    if (insert == 1)
                    {
                        var intent = new Intent(this, typeof(ConfirmationActivity));
                        StartActivity(intent);
                    }
                    else
                    {
                        //TODO: Let the user know the database wasn't updated
                    }
                }
                catch (Exception ex)
                {
                    //TODO: Let the user know something went wrong
                }
            }
        }
예제 #3
0
        public static void ShowDialogMessage(string title, string message, Action action = null, Action okAction = null)
        {
            CrossCurrentActivity.Current.Activity.RunOnUiThread(() =>
            {
                if (MessageDialogBuild != null)
                {
                    MessageDialogBuild.Hide();
                    MessageDialogBuild = null;
                }

                var builder     = new Android.Support.V7.App.AlertDialog.Builder(CrossCurrentActivity.Current.Activity);
                View dialogView = CrossCurrentActivity.Current.Activity.LayoutInflater.Inflate(Resource.Layout.messageDialog, null);

                builder.SetView(dialogView);
                MessageDialogBuild = BuilMessageDialog(builder);

                var dialogImageView = dialogView.FindViewById <ImageView>(Resource.Id.dialogImageView);
                dialogImageView.SetImageResource(Resource.Drawable.ic_notification);

                var titleMessageTextView  = dialogView.FindViewById <TextView>(Resource.Id.titleMessageTextView);
                titleMessageTextView.Text = title;

                var messageTextView  = dialogView.FindViewById <TextView>(Resource.Id.messageTextView);
                messageTextView.Text = message;

                acceptButton.Click += (sender, e) =>
                {
                    MessageDialogBuild.Cancel();
                    okAction?.Invoke();
                };

                secondaryAcceptButton.Click += (sender, e) =>
                {
                    MessageDialogBuild.Cancel();
                    action?.Invoke();
                };
            });
        }
예제 #4
0
 private void AlertDialogOkClicked(object sender, DialogClickEventArgs e)
 {
     alertDialog.Hide();
 }