Exemple #1
0
        private bool ReturnToMainScreen()
        {
            if (changed)
            {
                var alert = new AlertDialog.Builder(this).Create();

                var alertView = LayoutInflater.Inflate(Resource.Layout.confirmationPopup, null);
                alertView.FindViewById <TextView>(Resource.Id.textView2).Text = _vacationsViewModel.Localaizer.Localize("confirmationChange");
                alertView.FindViewById <Button>(Resource.Id.confirmation_popup_cancel_button).Text = _vacationsViewModel.Localaizer.Localize("cancel_button");
                alertView.FindViewById <Button>(Resource.Id.confirmation_popup_ok_button).Text     = _vacationsViewModel.Localaizer.Localize("ok_button");
                alertView.FindViewById <TextView>(Resource.Id.textView2).Typeface = FontLoader.GetFontBold(this);
                alertView.FindViewById <Button>(Resource.Id.confirmation_popup_cancel_button).Typeface = FontLoader.GetFontNormal(this);
                alertView.FindViewById <Button>(Resource.Id.confirmation_popup_ok_button).Typeface     = FontLoader.GetFontNormal(this);
                alertView.FindViewById <Button>(Resource.Id.confirmation_popup_cancel_button).Click   += (s, e) =>
                {
                    alert.Hide();
                    alert.Cancel();
                    Exit();
                };
                alertView.FindViewById <Button>(Resource.Id.confirmation_popup_ok_button).Click += async(s, e) =>
                {
                    alert.Hide();
                    alert.Cancel();
                    await Save();
                };

                alert.SetView(alertView);
                alert.Show();
                return(false);
            }
            ViewDispose();
            return(true);
        }
Exemple #2
0
        private void ShowConfirmation(VTSModel vts)
        {
            var alert = new AlertDialog.Builder(this).Create();

            var alertView = LayoutInflater.Inflate(Resource.Layout.confirmationPopup, null);

            alertView.FindViewById <TextView>(Resource.Id.textView2).Text = _vacationsViewModel.Localaizer.Localize("confirmDelete");
            alertView.FindViewById <Button>(Resource.Id.confirmation_popup_cancel_button).Text = _vacationsViewModel.Localaizer.Localize("cancel_button");
            alertView.FindViewById <Button>(Resource.Id.confirmation_popup_ok_button).Text     = _vacationsViewModel.Localaizer.Localize("delButton");
            alertView.FindViewById <TextView>(Resource.Id.textView2).Typeface = FontLoader.GetFontBold(this);
            alertView.FindViewById <Button>(Resource.Id.confirmation_popup_cancel_button).Typeface = FontLoader.GetFontNormal(this);
            alertView.FindViewById <Button>(Resource.Id.confirmation_popup_ok_button).Typeface     = FontLoader.GetFontNormal(this);
            alertView.FindViewById <Button>(Resource.Id.confirmation_popup_cancel_button).Click   += (s, e) =>
            {
                alert.Hide();
                alert.Cancel();
            };
            alertView.FindViewById <Button>(Resource.Id.confirmation_popup_ok_button).Click += async(s, e) =>
            {
                alert.Hide();
                alert.Cancel();
                await Delete(vts);
            };

            alert.SetView(alertView);
            alert.Show();
        }
Exemple #3
0
        public override void OnBackPressed()
        {
            AlertDialog CancelDialog = new AlertDialog.Builder(this).Create();

            CancelDialog.SetTitle("Are you sure you want to quit");
            CancelDialog.SetButton("return", (s, ev) =>
            {
                CancelDialog.Cancel();
            }

                                   );

            CancelDialog.SetButton2("main menu", (s, ev) =>
            {
                Finish();
            }

                                    );

            if (CancelDialog != null)
            {
                if (CancelDialog.IsShowing)
                {
                    CancelDialog.Cancel();
                }
                else
                {
                    CancelDialog.Show();
                }
            }
            else
            {
                CancelDialog.Show();
            }
        }
        private void ShowValidationError(string message)
        {
            var alert = new AlertDialog.Builder(this).Create();

            alert.SetButton(GetString(Resource.String.Close), (sender, e) => alert.Cancel());
            alert.SetMessage(message);

            alert.Show();
        }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            SetContentView(Resource.Layout.activity_tracks);

            AlertDialog alertDialog = new AlertDialog.Builder(this).Create();

            alertDialog.SetMessage(GetString(Resource.String.gpx_license_notification_text));
            alertDialog.SetCancelable(true);
            alertDialog.SetButton(GetString(Resource.String.ok_text), (s, e) => alertDialog.Cancel());

            alertDialog.Show();
        }
        protected virtual void OnDateTimeViewClick()
        {
            var dialogView = this.BindingInflate(Resource.Layout.app_basket_full_order_item_deliveryTime_dialog, null);

            var headerSubtitle = dialogView.FindViewById <TextView>(Resource.Id.app_basket_full_order_item_deliveryTime_dialog_headerLayout_subtitle);
            var headerTitle    = dialogView.FindViewById <TextView>(Resource.Id.app_basket_full_order_item_deliveryTime_dialog_headerLayout_title);

            var dateListView = dialogView.FindViewById <ARNumberPicker>(Resource.Id.app_basket_full_order_item_deliveryTime_dialog_bodyLayout_listViewLeft);

            dateListView.WrapSelectorWheel      = false;
            dateListView.DescendantFocusability = Android.Views.DescendantFocusability.BlockDescendants;

            var timeListView = dialogView.FindViewById <ARNumberPicker>(Resource.Id.app_basket_full_order_item_deliveryTime_dialog_bodyLayout_listViewRight);

            timeListView.WrapSelectorWheel      = false;
            timeListView.DescendantFocusability = Android.Views.DescendantFocusability.BlockDescendants;

            var positiveButton = dialogView.FindViewById <Button>(Resource.Id.app_basket_full_order_item_deliveryTime_dialog_positiveButton);
            var negativeButton = dialogView.FindViewById <Button>(Resource.Id.app_basket_full_order_item_deliveryTime_dialog_negativeButton);

            var set = this.CreateBindingSet <FullOrderFragment, IFullOrderViewModel>();

            set.Bind(headerSubtitle).To(vm => vm.DeliveryViewModel.SelectedDeliveryTime.Name);
            set.Bind(headerTitle).To(vm => vm.DeliveryViewModel.SelectedDeliveryDay.Name);

            set.Bind(dateListView).For("SelectedItem").To(vm => vm.DeliveryViewModel.SelectedDeliveryDay);
            set.Bind(dateListView).For(v => v.ItemsSource).To(vm => vm.DeliveryViewModel.DaysItems);

            set.Bind(timeListView).For("SelectedItem").To(vm => vm.DeliveryViewModel.SelectedDeliveryTime);
            set.Bind(timeListView).For(v => v.ItemsSource).To(vm => vm.DeliveryViewModel.TimeItems);

            set.Apply();

            var dialog = new AlertDialog.Builder(Context)
                         .SetCancelable(true)
                         .SetView(dialogView)
                         .Show();

            positiveButton.Text   = LocalizationService.GetLocalizableString(BasketConstants.RESX_NAME, "Order_TimeDone");
            positiveButton.Click += (s, args) =>
            {
                ViewModel.DeliveryViewModel.ApplyDeliveryTimeCommand.Execute(timeListView.SelectedItem);
                dialog.Dismiss();
            };

            negativeButton.Text   = LocalizationService.GetLocalizableString(BasketConstants.RESX_NAME, "Order_TimeCancel");
            negativeButton.Click += (s, args) => dialog.Cancel();
        }
        private void DeleteSelectedExpensePeriod()
        {
            var listView = View.FindViewById <ListView>(Resource.Id.ExpensePeriodsListView);
            var adapter  = listView.Adapter as ExpensePeriodsAdapter;

            if (listView.CheckedItemCount > 0 && adapter != null)
            {
                ExpensePeriod selectedExpensePeriod = adapter[listView.CheckedItemPosition];

                var alert = new AlertDialog.Builder(Context).Create();
                alert.SetMessage(string.Format(GetString(Resource.String.DeleteExpensePeriodConfirmation), selectedExpensePeriod.StartDate.ToString("D")));
                alert.SetButton(
                    GetString(Resource.String.DeleteExpensePeriodCommand),
                    async(sender, e) => { await ExecuteDeleteExpensePeriodAsync(selectedExpensePeriod); });
                alert.SetButton2(
                    GetString(Android.Resource.String.Cancel),
                    (sender, e) => { alert.Cancel(); });

                alert.Show();
            }
        }
Exemple #8
0
        public void AlertCameraGallery()
        {
            AlertDialog alertDialog  = new AlertDialog.Builder(context, AlertDialog.ThemeHoloLight).Create();
            var         dialougeView = activity.LayoutInflater.Inflate(Resource.Layout.custom_image_picker_layout, null);

            alertDialog.SetTitle("Complete action using");
            alertDialog.SetView(dialougeView);
            TextView cameraTextView  = dialougeView.FindViewById <TextView>(Resource.Id.camera_txt);
            TextView galleryTextView = dialougeView.FindViewById <TextView>(Resource.Id.gallery_txt);
            Button   cancelBtn       = dialougeView.FindViewById <Button>(Resource.Id.cancel);

            galleryTextView.Text = "Photo";
            cameraTextView.Text  = "Video";

            if (!((Activity)context).IsFinishing)
            {
                //show dialog
                alertDialog.Show();
            }

            // cancel the alert
            cancelBtn.Click += delegate
            {
                alertDialog.Dismiss();
                alertDialog.Cancel();
            };

            // open the gallery for image
            galleryTextView.Click += delegate
            {// select the Photo
                if (CAMERA)
                {
                    Intent intent = new Intent(MediaStore.ActionImageCapture);
                    fileUri = CameraGalleryClass.GetInstance(context).GetTempFile();
                    intent.PutExtra(MediaStore.ExtraOutput, fileUri);
                    // start the image capture Intent
                    activity.StartActivityForResult(intent, CameraCaptureImageRequestCode);
                }
                else
                {
                    Intent intent = new Intent(Intent.ActionPick, MediaStore.Images.Media.ExternalContentUri);
                    activity.StartActivityForResult(intent, PicFromGallery);
                }

                alertDialog.Dismiss();
            };

            // open the gallery for video
            cameraTextView.Click += delegate
            {
                // select the VIDEO
                showMessageObject.ShowMessage(Resources.GetString(Resource.String.coming_soon));
                //if (CAMERA)
                //{

                //    Random randomNumber = new Random();
                //    Java.IO.File videoFile = new Java.IO.File(Android.OS.Environment.ExternalStorageDirectory + "/com.Xamarin.Asem/Videos/");
                //    if (!videoFile.Exists())
                //    {
                //        videoFile.Mkdirs();
                //    }


                //    Intent intent = new Intent(MediaStore.ActionVideoCapture);
                //    Android.Net.Uri videoFileUri = Android.Net.Uri.FromFile(new Java.IO.File(videoFile, "vid_" + randomNumber.Next() + ".mp4"));
                //    intent.PutExtra(MediaStore.ExtraOutput, fileUri);
                //    activity.StartActivityForResult(intent, CameraCaptureVideoRequestCode);
                //}
                //else
                //{
                //    Intent intent = new Intent();
                //    intent.SetType("video/*");
                //    intent.SetAction(Intent.ActionGetContent);
                //    StartActivityForResult(Intent.CreateChooser(intent, "Select Video"), REQUEST_TAKE_GALLERY_VIDEO);
                //}
                alertDialog.Dismiss();
            };
        }