Ejemplo n.º 1
0
        private void AppearDateDialog()
        {
            DatePickerDialog datePickerDialog = new DatePickerDialog(this);

            Android.Support.V7.App.AlertDialog         datePickerAlertDialog = null;
            Android.Support.V7.App.AlertDialog.Builder builder = new Android.Support.V7.App.AlertDialog.Builder(this)
                                                                 .SetTitle("Invalid Date")
                                                                 .SetMessage("Too early to create an account. Please select an earlier date under 30 days.")
                                                                 .SetPositiveButton("Ok", (object s, Android.Content.DialogClickEventArgs dialogClickEventArgs) =>
            {
                datePickerAlertDialog.Show();
            });

            datePickerAlertDialog = builder.Create();

            datePickerDialog.DateSet += (s, e) =>
            {
                if (e.Date > DateTime.Now.AddDays(30))
                {
                    datePickerAlertDialog.Show();
                }
                else
                {
                    ViewModel.ServiceStartDate = e.Date;
                    DateButton.Text            = e.Date.ToShortDateString();
                }
            };

            datePickerDialog.Show();
        }
Ejemplo n.º 2
0
            void OnActionSheetRequested(Page sender, ActionSheetArguments arguments)
            {
                // Verify that the page making the request is part of this activity
                if (!PageIsInThisContext(sender))
                {
                    return;
                }

                var builder = new AlertDialog.Builder(Activity);

                builder.SetTitle(arguments.Title);
                string[] items = arguments.Buttons.ToArray();
                builder.SetItems(items, (o, args) => arguments.Result.TrySetResult(items[args.Which]));

                if (arguments.Cancel != null)
                {
                    builder.SetPositiveButton(arguments.Cancel, (o, args) => arguments.Result.TrySetResult(arguments.Cancel));
                }

                if (arguments.Destruction != null)
                {
                    builder.SetNegativeButton(arguments.Destruction, (o, args) => arguments.Result.TrySetResult(arguments.Destruction));
                }

                AlertDialog dialog = builder.Create();

                builder.Dispose();
                //to match current functionality of renderer we set cancelable on outside
                //and return null
                dialog.SetCanceledOnTouchOutside(true);
                dialog.CancelEvent += (o, e) => arguments.SetResult(null);
                dialog.Show();
            }
Ejemplo n.º 3
0
        private void ShowModeConfigurationDialog(int joystickId)
        {
            // Build and display the mode configuration dialog
            AlertDialog modeConfigurationDialog = null;

            AlertDialog.Builder builder = new AlertDialog.Builder(Activity, Resource.Style.AlertDialogStyle);

            builder.SetSingleChoiceItems(Resource.Array.JoystickModes,
                                         (int)GetRelatedJoystickConfiguration(joystickId).JoystickMode,
                                         delegate(object sender, DialogClickEventArgs args)
            {
                ConfigureJoystickAxis((JoystickConfiguration.JoystickModes)args.Which, joystickId);

                // ReSharper disable once AccessToModifiedClosure
                modeConfigurationDialog?.Dismiss();
            });

            builder.SetPositiveButton(Resource.String.ControlInterfaceActivity_configureJoystickModeDialogPositive,
                                      delegate
            {
                // ReSharper disable once AccessToModifiedClosure
                modeConfigurationDialog?.Dismiss();
            });


            builder.SetTitle(Resource.String.ControlInterfaceActivity_configureJoystickModeDialogTitle);
            builder.SetCancelable(false);

            modeConfigurationDialog = builder.Create();

            modeConfigurationDialog.Show();
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Open a popup to enter a new recipient
        /// </summary>
        private void AddRecipientFromPopupButton_Click(object sender, EventArgs e)
        {
            Android.Support.V7.App.AlertDialog addRecipientDialog = null;
            var addRecipientBuilder = new Android.Support.V7.App.AlertDialog.Builder(this, Resource.Style.Theme_AppCompat_Light_Dialog);
            var view = LayoutInflater.Inflate(Resource.Drawable.AddRecipient, null);

            addRecipientBuilder.SetTitle(Resource.String.alertSOS_popupTitle);
            addRecipientBuilder.SetPositiveButton(Resource.String.alertSOS_popupPositive, new EventHandler <DialogClickEventArgs>((o, ev) => { }));
            addRecipientBuilder.SetNegativeButton(Resource.String.alertSOS_popupNegative, new EventHandler <DialogClickEventArgs>((o, ev) =>
            {
                addRecipientDialog.Dismiss();
            }));

            addRecipientBuilder.SetView(view);
            addRecipientDialog            = addRecipientBuilder.Create();
            addRecipientDialog.ShowEvent += (ee, oo) =>
            {
                var button = addRecipientDialog.GetButton((int)Android.Content.DialogButtonType.Positive);
                button.Click += (eee, ooo) =>
                {
                    var displayNameEditText = view.FindViewById <EditText>(Resource.Id.addRecipient_contact);
                    var emailEditText       = view.FindViewById <EditText>(Resource.Id.addRecipient_email);

                    // empty display name
                    if (string.IsNullOrEmpty(displayNameEditText.Text))
                    {
                        displayNameEditText.Error = Resources.GetString(Resource.String.alertSOS_popupEmptyField);
                    }
                    // empty email
                    else if (string.IsNullOrEmpty(emailEditText.Text))
                    {
                        emailEditText.Error = Resources.GetString(Resource.String.alertSOS_popupEmptyField);
                    }
                    // invalide email
                    else if (!Android.Util.Patterns.EmailAddress.Matcher(emailEditText.Text).Matches())
                    {
                        emailEditText.Error = Resources.GetString(Resource.String.alertSOS_popupEmail);
                    }
                    // add the contact
                    else
                    {
                        displayNameEditText.Error = null;
                        emailEditText.Error       = null;

                        App.Locator.Alert.LsRecipients.Add(new AlertRecipientDTO
                        {
                            DisplayName = displayNameEditText.Text,
                            Email       = emailEditText.Text
                        });

                        _selectedContact = new Contact {
                            DisplayName = displayNameEditText.Text, Email = emailEditText.Text
                        };
                        AlertRecipientLayout.AddChild(_selectedContact);
                        addRecipientDialog.Dismiss();
                    }
                };
            };
            addRecipientDialog.Show();
        }
Ejemplo n.º 5
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            SetContentView(Resource.Layout.Company);
            ParseAndReturnAsync();
            LayoutInflater layoutInflaterAndroid = LayoutInflater.From(this);
            View           popup = layoutInflaterAndroid.Inflate(Resource.Layout.HistoryWindowU, null);

            Android.Support.V7.App.AlertDialog.Builder alertDialogbuilder = new Android.Support.V7.App.AlertDialog.Builder(this);
            alertDialogbuilder.SetView(popup);

            var userContent = popup.FindViewById <EditText>(Resource.Id.History_description);

            alertDialogbuilder.SetCancelable(false)
            .SetPositiveButton("Dodaj", delegate
            {
                Toast.MakeText(this, "Wysłano", ToastLength.Long).Show();
            }
                               ).SetNegativeButton("Zamknij", delegate
            {
                alertDialogbuilder.Dispose();
            });
            Android.Support.V7.App.AlertDialog alertDialogAndroid = alertDialogbuilder.Create();
            if (this.Intent.GetBooleanExtra("Show", true))
            {
                alertDialogAndroid.Show();
            }
        }
Ejemplo n.º 6
0
        public void activateGodmode()
        {
            LayoutInflater layoutInflater = LayoutInflater.From(this);
            View           view           = layoutInflater.Inflate(Resource.Layout.GiftCode, null);

            Android.Support.V7.App.AlertDialog.Builder alertbuilder = new Android.Support.V7.App.AlertDialog.Builder(this);
            alertbuilder.SetView(view);

            String code = "";

            var input = view.FindViewById <EditText>(Resource.Id.editText);

            alertbuilder.SetCancelable(false)
            .SetPositiveButton("Choose", delegate
            {
                code = input.Text;
                if (code == "godmode")
                {
                    godmode = !godmode;
                }
                Console.WriteLine(code + " " + godmode);
                canvasView.Invalidate();
            })
            .SetNegativeButton("Cancel", delegate
            {
                alertbuilder.Dispose();
            });
            Android.Support.V7.App.AlertDialog dialog = alertbuilder.Create();
            dialog.Show();
        }
Ejemplo n.º 7
0
        /// <summary>
        /// Show Reaction dialog when user long click on react button
        /// </summary>
        public void ClickDialog(CommentReplyClickEventArgs postData)
        {
            try
            {
                PostData = postData;

                //Show Dialog With 6 React
                Android.Support.V7.App.AlertDialog.Builder dialogBuilder = new Android.Support.V7.App.AlertDialog.Builder(MainContext);

                //Irrelevant code for customizing the buttons and title
                LayoutInflater inflater   = (LayoutInflater)MainContext.GetSystemService(Context.LayoutInflaterService);
                View           dialogView = inflater.Inflate(Resource.Layout.XReactDialogLayout, null);

                InitializingReactImages(dialogView);
                ClickImageButtons();

                dialogBuilder.SetView(dialogView);
                MReactAlertDialog = dialogBuilder.Create();
                MReactAlertDialog.Window.SetBackgroundDrawableResource(MReactDialogShape);

                Window window = MReactAlertDialog.Window;
                window.SetLayout(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.WrapContent);

                MReactAlertDialog.Show();
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
Ejemplo n.º 8
0
 public static void ShowAlertDialog(Context context, string alertMessage)
 {
     Android.Support.V7.App.AlertDialog.Builder builder = new Android.Support.V7.App.AlertDialog.Builder(context);
     builder.SetMessage(alertMessage);
     builder.SetNegativeButton("Ok", Cancel_Action);
     Android.Support.V7.App.AlertDialog dialog = builder.Create();
     dialog.Show();
 }
Ejemplo n.º 9
0
 private void TrainingTypeLayout_Click(object sender, EventArgs e)
 {
     TrainingType[] trainingTypes = Enum.GetValues(typeof(TrainingType)) as TrainingType[];
     Android.Support.V7.App.AlertDialog.Builder builder = new Android.Support.V7.App.AlertDialog.Builder(this);
     builder.SetTitle(Resources.GetString(Resource.String.training_type_select_type_name));
     builder.SetItems(
         trainingTypes.Select(type => MapTrainingTypeToNameIdAndImageSourceId(type).Item1).ToArray(),
         new EventHandler <DialogClickEventArgs>((senderr, ee) => ChangeTrainingType(trainingTypes[ee.Which])));
     Android.Support.V7.App.AlertDialog alert = builder.Create();
     alert.Show();
 }
Ejemplo n.º 10
0
        private void AddUser_ClickConfig(View view)
        {
            newUserName = view.FindViewById <EditText>(Resource.Id.userNew);
            acceptBtn   = view.FindViewById <Button>(Resource.Id.acceptButton);

            alertDialogBuilder = new Android.Support.V7.App.AlertDialog.Builder(this.Activity);
            alertDialogBuilder.SetView(view);

            alertDialogAndroid = alertDialogBuilder.Create();
            alertDialogAndroid.Show();
        }
Ejemplo n.º 11
0
        private void ShowMotorConfigurationDialog(int joystickId, int joystickAxis)
        {
            // Build and display the motor configuration dialog
            AlertDialog motorConfigurationDialog = null;

            AlertDialog.Builder builder = new AlertDialog.Builder(Activity, Resource.Style.AlertDialogStyle);

            builder.SetSingleChoiceItems(GetMotorList(),
                                         GetRelatedJoystickConfiguration(joystickId).MotorIndexes[joystickAxis],
                                         delegate(object sender, DialogClickEventArgs args)
            {
                // When one motor was clicked we set it and display the next dialog
                SetMotorIndex(joystickId, args.Which, joystickAxis);

                // ReSharper disable once AccessToModifiedClosure
                motorConfigurationDialog?.Dismiss();


                // If configured the first joystick axis we have to configure the second.
                // This can be done better but it works :)
                if (joystickAxis == 0)
                {
                    ShowMotorConfigurationDialog(joystickId, ++joystickAxis);
                }
            });

            builder.SetPositiveButton(Resource.String.ControlInterfaceActivity_configureJoystickMotor1DialogPositive,
                                      delegate
            {
                // ReSharper disable once AccessToModifiedClosure
                motorConfigurationDialog?.Dismiss();

                // If configured the first joystick axis we have to configure the second.
                if (joystickAxis == 0)
                {
                    ShowMotorConfigurationDialog(joystickId, ++joystickAxis);
                }
            });

            if (joystickAxis == 0)
            {
                builder.SetTitle(Resource.String.ControlInterfaceActivity_configureJoystickMotor1DialogTitle);
            }
            else if (joystickAxis == 1)
            {
                builder.SetTitle(Resource.String.ControlInterfaceActivity_configureJoystickMotor2DialogTitle);
            }

            builder.SetCancelable(false);

            motorConfigurationDialog = builder.Create();

            motorConfigurationDialog.Show();
        }
Ejemplo n.º 12
0
        private void AccBtn_ClickConfig(View vieww)
        {
            AccBtn = vieww.FindViewById <Button>(Resource.Id.AccButton);
            OKBtn  = vieww.FindViewById <Button>(Resource.Id.OkButton);

            alertDialogBuilder = new Android.Support.V7.App.AlertDialog.Builder(this.Activity);
            alertDialogBuilder.SetView(vieww);

            alertDialogAndroid = alertDialogBuilder.Create();
            alertDialogAndroid.Show();
            OKBtn.Enabled = false;
        }
Ejemplo n.º 13
0
        private void UsersList_ItemClickConfig(View view)
        {
            actualUsername = view.FindViewById <TextView>(Resource.Id.actualUserName);
            editBtn        = view.FindViewById <ImageButton>(Resource.Id.editButton);
            microphoneBtn  = view.FindViewById <ImageButton>(Resource.Id.microphoneButton);
            deleteBtn      = view.FindViewById <ImageButton>(Resource.Id.deleteButton);

            alertDialogBuilder = new Android.Support.V7.App.AlertDialog.Builder(this.Activity);
            alertDialogBuilder.SetView(view);

            alertDialogAndroid = alertDialogBuilder.Create();
            alertDialogAndroid.Show();
        }
Ejemplo n.º 14
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
                }
            }
        }
Ejemplo n.º 15
0
        private void Delete_ClickConfig(View view, string txt)
        {
            newUserName = view.FindViewById <EditText>(Resource.Id.userNew);
            AccBtn      = view.FindViewById <Button>(Resource.Id.AccButton);
            OKBtn       = view.FindViewById <Button>(Resource.Id.OkButton);
            TextView text = view.FindViewById <TextView>(Resource.Id.justTextAdd1);

            text.Text = txt;

            alertDialogBuilder = new Android.Support.V7.App.AlertDialog.Builder(this.Activity);
            alertDialogBuilder.SetView(view);

            alertDialogAndroid = alertDialogBuilder.Create();
            alertDialogAndroid.Show();
        }
Ejemplo n.º 16
0
        public void DisplayResponse(string subject, string message)
        {
            //TODO KUNIN MO UNG NASA ADMINPENDINGVIEW.CS
//            AlertDialog.Builder builder = new AlertDialog.Builder(this.Activity);
//            builder.SetCustomTitle(dialogTitleTextView);
//            builder.SetMessage(Resource.String.pending_confirm_msg);

            AlertDialog.Builder builder = new AlertDialog.Builder(this.Context);
            builder.SetTitle(subject);
            builder.SetMessage(message);

            builder.SetPositiveButton("OK", AlertDialogOkClicked);

            alertDialog = builder.Create();
            alertDialog.Show();
            Logger.Log(subject + "\n" + message);
        }
        async void TakePhoto(object sender, System.EventArgs e)
        {
            string dpPath = System.IO.Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal), "ScoutingApp.db3");
            var    db     = new SQLiteConnection(dpPath);

            db.CreateTable <ImageTable>();
            ImageTable tbl = new ImageTable();


            await CrossMedia.Current.Initialize();

            var file = await CrossMedia.Current.TakePhotoAsync(new Plugin.Media.Abstractions.StoreCameraMediaOptions
            {
                PhotoSize          = Plugin.Media.Abstractions.PhotoSize.Small,
                CompressionQuality = 40,
                Name      = "highlanders.jpg",
                Directory = "sample"
            });

            if (file == null)
            {
                return;
            }

            byte[] imageArray = System.IO.File.ReadAllBytes(file.Path);
            tbl.Image = imageArray;
            db.Insert(tbl);

            LayoutInflater layoutInflater = LayoutInflater.From(this);
            View           view           = layoutInflater.Inflate(Resource.Layout.photo_alert, null);

            Android.Support.V7.App.AlertDialog.Builder alertbuilder = new Android.Support.V7.App.AlertDialog.Builder(this);
            alertbuilder.SetView(view);
            var userdata = view.FindViewById <EditText>(Resource.Id.edittextT);

            alertbuilder.SetCancelable(false).SetPositiveButton("Submit", delegate
            {
                int numberT;
                Int32.TryParse(userdata.Text, out numberT);
                tbl.Team = numberT;
                db.Insert(tbl);
            });

            Android.Support.V7.App.AlertDialog dialog = alertbuilder.Create();
            dialog.Show();
        }
Ejemplo n.º 18
0
        public void OnClick(View itemView, int position)
        {
            // Toast.MakeText(itemView.Context,foods[position].name,ToastLength.Long).Show();
            View dialogView = LayoutInflater.From(itemView.Context).Inflate(Resource.Layout.userInputNumberDialog, null);

            Android.Support.V7.App.AlertDialog.Builder alertDialogBuilder = new Android.Support.V7.App.AlertDialog.Builder(itemView.Context);

            TextView dialog_food_name = dialogView.FindViewById <TextView>(Resource.Id.dialog_food_name);

            dialog_food_name.Text = foods[position].name;

            alertDialogBuilder.SetView(dialogView);

            string serve = dialogView.FindViewById <EditText>(Resource.Id.serveNum).Text;

            alertDialogBuilder.SetCancelable(false).SetPositiveButton("Confirm", delegate
            {
                EditText txt_serve_num = dialogView.FindViewById <EditText>(Resource.Id.serveNum);
                Food food = foods[position];
                if (string.IsNullOrEmpty(txt_serve_num.Text))
                {
                    txt_serve_num.Error = "Required";
                }
                else
                {
                    Order order = new Order(food.name, food.price, Int32.Parse(txt_serve_num.Text));
                    orders.Add(order);

                    // save file to local
                    var localOrders = Application.Context.GetSharedPreferences("MyOrders", FileCreationMode.Private);
                    var orderEdit   = localOrders.Edit();

                    var json = JsonConvert.SerializeObject(orders);
                    orderEdit.PutString("orders", json);

                    orderEdit.Commit();

                    Toast.MakeText(itemView.Context, "Food added", ToastLength.Long).Show();
                }
            })
            .SetNegativeButton("Cancel", delegate { alertDialogBuilder.Dispose(); });

            Android.Support.V7.App.AlertDialog alertDialog = alertDialogBuilder.Create();
            alertDialog.Show();
        }
Ejemplo n.º 19
0
        private void UploadBtn_Click(object sender, EventArgs e)
        {
            DatabaseHolder.receiver = "";
            BluetoothHolder.bluetoothManage.Write(DatabaseHolder.GETDB);

            LayoutInflater layoutInflaterr = LayoutInflater.From(this.Activity);
            var            vieww           = layoutInflaterr.Inflate(Resource.Layout.UploadDialog, null);

            uploadBtnOK = vieww.FindViewById <Button>(Resource.Id.UploadButtonOK);

            alertDialogBuilder = new Android.Support.V7.App.AlertDialog.Builder(this.Activity);
            alertDialogBuilder.SetView(vieww);

            alertDialogAndroid = alertDialogBuilder.Create();
            alertDialogAndroid.Show();

            uploadBtnOK.Click += UploadBtnOK_Click;
        }
Ejemplo n.º 20
0
        protected void showCompletedDialog()
        {
            Android.Support.V7.App.AlertDialog.Builder alertDialogBuilder = new Android.Support.V7.App.AlertDialog.Builder(
                this);

            // set title
            alertDialogBuilder.SetTitle("Hooray");
            alertDialogBuilder
            .SetMessage("We've completed the stepper")
            .SetCancelable(true)
            .SetPositiveButton("Yes", delegate { });

            // create alert dialog
            Android.Support.V7.App.AlertDialog alertDialog = alertDialogBuilder.Create();

            // show it
            alertDialog.Show();
        }
Ejemplo n.º 21
0
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            ViewGroup root = (ViewGroup)inflater.Inflate(Resource.Layout.Addemployee, null);
            // Create your application here

            Button Form = root.FindViewById <Button>(Resource.Id.Form);
            // MyButton = (Button)FindViewById(Resource.Id.MyButton);


            Intent i;


            Form.Click += delegate
            {
                i = new Intent(root.Context, typeof(newuser));
                StartActivity(i);
            };

            Button MyButton = root.FindViewById <Button>(Resource.Id.MyButton);

            MyButton.Click += delegate
            {
                LayoutInflater LayoutInflaterAndroid = LayoutInflater.From(this.Context);
                View           mView = LayoutInflaterAndroid.Inflate(Resource.Layout.userinput, null);
                Android.Support.V7.App.AlertDialog.Builder alertdialogbuilder = new Android.Support.V7.App.AlertDialog.Builder(this.Context);
                alertdialogbuilder.SetView(mView);


                alertdialogbuilder.SetCancelable(false)
                .SetPositiveButton("SENT", delegate
                {
                    Toast.MakeText(this.Context, "upload file", ToastLength.Short).Show();
                })


                .SetNegativeButton("cancle", delegate
                {
                    alertdialogbuilder.Dispose();
                });
                Android.Support.V7.App.AlertDialog alertDialogandroid = alertdialogbuilder.Create();
                alertDialogandroid.Show();
            };
            return(root);
        }
        public override bool OnOptionsItemSelected(IMenuItem item)
        {
            switch (item.ItemId)
            {
            case Resource.Id.set_user:

                LayoutInflater layoutInflater = LayoutInflater.From(this);
                View           view           = layoutInflater.Inflate(Resource.Layout.user_form, null);

                Android.Support.V7.App.AlertDialog.Builder alertbuilder = new Android.Support.V7.App.AlertDialog.Builder(this);
                alertbuilder.SetView(view);

                var userid    = view.FindViewById <EditText>(Resource.Id.userIdText);
                var firstName = view.FindViewById <EditText>(Resource.Id.firstNameText);
                var lastName  = view.FindViewById <EditText>(Resource.Id.lastNameText);

                alertbuilder.SetCancelable(false)
                .SetPositiveButton("Submit", delegate
                {
                    System.Diagnostics.Debug.WriteLine("Setting User: "******", " + firstName.Text + " " + lastName.Text);

                    Lighthouse.LHPEUser user = new Lighthouse.LHPEUser();
                    user.Id = userid.Text;
                    Dictionary <string, string> Profile = new Dictionary <string, string>();
                    Profile.Add("first_name", firstName.Text);
                    Profile.Add("last_name", lastName.Text);
                    user.Profile = Profile;

                    Lighthouse.SetUserProfile(user);
                })
                .SetNegativeButton("Cancel", delegate
                {
                    alertbuilder.Dispose();
                });

                Android.Support.V7.App.AlertDialog dialog = alertbuilder.Create();

                dialog.Show();

                return(true);
            }

            return(base.OnOptionsItemSelected(item));
        }
Ejemplo n.º 23
0
        private void PadlockBtn_Click(object sender, EventArgs e)
        {
            DatabaseHolder.receiver = "";
            BluetoothHolder.bluetoothManage.Write(DatabaseHolder.LOCKD);

            LayoutInflater layoutInflaterr = LayoutInflater.From(this.Activity);
            var            vieww           = layoutInflaterr.Inflate(Resource.Layout.CloseDoorDialog, null);

            doorClosedBtnOK = vieww.FindViewById <Button>(Resource.Id.DoorClosedButtonOK);

            alertDialogBuilder = new Android.Support.V7.App.AlertDialog.Builder(this.Activity);
            alertDialogBuilder.SetView(vieww);

            alertDialogAndroid = alertDialogBuilder.Create();
            alertDialogAndroid.Show();

            if (!doorClosedBtnOK.HasOnClickListeners)
            {
                doorClosedBtnOK.Click += DoorClosedBtnOK_Click;
            }
        }
Ejemplo n.º 24
0
        private void AddPlaylistClicked(object sender, EventArgs eventArgs)
        {
            LayoutInflater layoutInflater = LayoutInflater.From(this.Context);
            View           view           = layoutInflater.Inflate(Resource.Layout.newPlaylistDialog, null);

            Android.Support.V7.App.AlertDialog.Builder alertbuilder = new Android.Support.V7.App.AlertDialog.Builder(this.Context);
            alertbuilder.SetView(view);
            var userdata = view.FindViewById <EditText>(Resource.Id.editText);

            alertbuilder.SetCancelable(false)
            .SetPositiveButton("Submit", delegate
            {
                _playlistViewModel.AddPlaylist(userdata.Text);
            })
            .SetNegativeButton("Cancel", delegate
            {
                alertbuilder.Dispose();
            });
            Android.Support.V7.App.AlertDialog dialog = alertbuilder.Create();
            dialog.Show();
        }
        private void ShowIntervalDialog()
        {
            var builder    = new Android.Support.V7.App.AlertDialog.Builder(Activity);
            var dialogView = Activity.LayoutInflater.Inflate(Resource.Layout.interval_selection, null);

            spinnerDay   = dialogView.FindViewById <Spinner>(Resource.Id.spinner_day);
            spinnerMonth = dialogView.FindViewById <Spinner>(Resource.Id.spinner_month);
            spinnerYear  = dialogView.FindViewById <Spinner>(Resource.Id.spinner_year);

            adapterDay   = new ArrayAdapter <string>(Activity, Android.Resource.Layout.SimpleSpinnerDropDownItem, listOfDays);
            adapterMonth = new ArrayAdapter <string>(Activity, Android.Resource.Layout.SimpleSpinnerDropDownItem, listOfMonths);
            adapterYear  = new ArrayAdapter <int>(Activity, Android.Resource.Layout.SimpleSpinnerDropDownItem, listOfYears);

            adapterDay.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem);
            adapterMonth.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem);
            adapterYear.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem);

            spinnerDay.Adapter   = adapterDay;
            spinnerMonth.Adapter = adapterMonth;
            spinnerYear.Adapter  = adapterYear;

            spinnerDay.SetSelection(DateTime.Now.Day);
            spinnerMonth.SetSelection(DateTime.Now.Month);
            spinnerYear.SetSelection(listOfYears.IndexOf(DateTime.Now.Year));

            builder.SetView(dialogView);
            builder.SetCancelable(false);
            builder.SetTitle(Utils.Constants.IntervalTitle);
            builder.SetView(dialogView);
            builder.SetPositiveButton("OK", (EventHandler <DialogClickEventArgs>)null);
            builder.SetNegativeButton("Cancel", (sender, args) => { });
            showIntervalDialog = builder.Create();
            showIntervalDialog.Show();
            Button button = showIntervalDialog.GetButton((int)DialogButtonType.Positive);

            button.Click += (sender, args) =>
            {
                FilterTransactions();
            };
        }
Ejemplo n.º 26
0
        public void DisplayAlert(PriceDTO item, Context context)
        {
            PriceDTO price = new PriceDTO();

            using (var client = new HttpClient())
            {
                Task <string> result = client.GetStringAsync(Utils.baseUrl + "Price/GetBestPrice?name=" + item.product.Name);
                price = JsonConvert.DeserializeObject <PriceDTO>(result.Result);
            }

            Android.Support.V7.App.AlertDialog.Builder alertdialogbuilder = new Android.Support.V7.App.AlertDialog.Builder(context);
            alertdialogbuilder.SetCancelable(false)
            .SetPositiveButton("OK", delegate
            {
                alertdialogbuilder.Dispose();
            });

            Android.Support.V7.App.AlertDialog alertDialogAndroid = alertdialogbuilder.Create();
            alertDialogAndroid.SetTitle(price.ExchangedValue + " " + price.ToCurrency);
            alertDialogAndroid.SetMessage(price.Shop);
            alertDialogAndroid.Show();
        }
Ejemplo n.º 27
0
        private void ShowNewUserDialog(Activity ctx)
        {
            LayoutInflater layoutInflater = LayoutInflater.From(ctx);
            View           view           = layoutInflater.Inflate(Resource.Layout.popupinput, null);

            Android.Support.V7.App.AlertDialog.Builder alertbuilder = new Android.Support.V7.App.AlertDialog.Builder(ctx);
            alertbuilder.SetView(view);
            var userdata = view.FindViewById <EditText>(Resource.Id.stendname);

            alertbuilder.SetCancelable(false)
            .SetPositiveButton("Submit", delegate
            {
                Toast.MakeText(ctx, $"Welkom, {userdata.Text}!", ToastLength.Short).Show();
                UserProfile.Current.Username = userdata.Text;
            })
            .SetNegativeButton("Cancel", delegate
            {
                Toast.MakeText(ctx, $"Welkom, Gebruiker!", ToastLength.Short).Show();
                UserProfile.Current.Username = "******";
            });
            Android.Support.V7.App.AlertDialog dialog = alertbuilder.Create();
            dialog.Show();
        }
Ejemplo n.º 28
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.activity_register);

            xamarinAPI = RestService.For <XamarinAPI>("http://localhost:5000");

            alertDialog = new EDMTDialogBuilder().SetContext(this).Build();

            etPassword  = FindViewById <EditText>(Resource.Id.etPassword);
            etUsername  = FindViewById <EditText>(Resource.Id.etUsername);
            btnRegister = FindViewById <Button>(Resource.Id.btnRegister);


            btnRegister.Click += async delegate
            {
                alertDialog.Show();

                TbUser user = new TbUser();
                user.Username = etUsername.Text;
                user.Password = etPassword.Text;

                var result = await xamarinAPI.RegisterUser(user);

                if (result.Contains("successfully"))
                {
                    Finish();
                }

                Toast.MakeText(this, result, ToastLength.Short).Show();

                alertDialog.Dismiss();
            };

            // Create your application here
        }
Ejemplo n.º 29
0
        public override void OnActivityResult(int requestCode, int resultCode, Intent data)
        {
            base.OnActivityResult(requestCode, resultCode, data);

            Bitmap bitmap = (Bitmap)data.Extras.Get("data");

            imageView.SetImageBitmap(bitmap);

            LayoutInflater layoutInflaterAndroid = LayoutInflater.From(context);
            View           mView = layoutInflaterAndroid.Inflate(Resource.Layout.AdditionalProps, null);

            Android.Support.V7.App.AlertDialog.Builder alertdialogbuilder = new Android.Support.V7.App.AlertDialog.Builder(context);
            alertdialogbuilder.SetView(mView);

            MemoryStream memstream = new MemoryStream();

            bitmap.Compress(Bitmap.CompressFormat.Jpeg, 100, memstream);
            byte[] picData = memstream.ToArray();

            var shopField        = mView.FindViewById <EditText>(Resource.Id.ShopTextField);
            var descriptionField = mView.FindViewById <EditText>(Resource.Id.DescriptionTextField);

            alertdialogbuilder.SetCancelable(false)
            .SetPositiveButton("Send", async delegate
            {
                //using (var client = new HttpClient())
                //{
                //    try
                //    {
                //    // Create a new post
                //    var product = new Product()
                //    {
                //        Product_Id = 1,
                //        Shop = shopField.Text,
                //        Description = descriptionField.Text,
                //        Picture = picData
                //    };

                //    // create the request content and define Json
                //    var json = JsonConvert.SerializeObject(product);
                //    var content = new MultipartFormDataContent();
                //    content.Add(new StringContent(json, Encoding.UTF8, "application/json"));
                //    //  send a POST request
                //    var uri = "http://192.168.0.110/SmartPrice/api/Product/Submit";
                //    var result = await client.PostAsync(uri, content);
                //        //var result = await client.GetAsync(uri);
                //    result.EnsureSuccessStatusCode();

                //    Toast.MakeText(context, "Sent successfully! ", ToastLength.Short).Show();
                //    }catch
                //(Exception e)
                //    {
                //        Console.Write(e.ToString());
                //    }
                //}
            })
            .SetNegativeButton("Cancel", delegate
            {
                alertdialogbuilder.Dispose();
            });
            Android.Support.V7.App.AlertDialog alertDialogAndroid = alertdialogbuilder.Create();
            alertDialogAndroid.Show();
        }
Ejemplo n.º 30
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            // Create your application here
            SetContentView(Resource.Layout.photo_options);

            //Iskanje teh zadeu k jih lah prtisnes
            var intervalChangeButton     = FindViewById <Button>(Resource.Id.interval_change_button);
            var shootingTimeChangeButton = FindViewById <Button>(Resource.Id.shooting_time_change_button);
            var resolutionChangeButton   = FindViewById <Button>(Resource.Id.resolution_change_button);

            intervalChangeButton.Text     = (intervalTime).ToString();
            shootingTimeChangeButton.Text = (shootingTime).ToString();


            intervalChangeButton.Click += delegate
            {
                LayoutInflater layoutInflaterAndroid = LayoutInflater.From(this);
                View           mView = layoutInflaterAndroid.Inflate(Resource.Layout.user_input_dialog_box, null);
                Android.Support.V7.App.AlertDialog.Builder alerDialogBuilder = new Android.Support.V7.App.AlertDialog.Builder(this);
                alerDialogBuilder.SetView(mView);

                var userIntervalTime = mView.FindViewById <EditText>(Resource.Id.dialog_edit_text);

                alerDialogBuilder.SetCancelable(false)
                .SetPositiveButton("Ok", delegate
                {
                    intervalTime = Convert.ToInt32(userIntervalTime.Text);
                    Toast.MakeText(this, "Interval time set to " + intervalTime + " seconds", ToastLength.Short).Show();
                    intervalChangeButton.Text = (intervalTime).ToString();
                })
                .SetNegativeButton("Cancel", delegate
                {
                    alerDialogBuilder.Dispose();
                });

                Android.Support.V7.App.AlertDialog alertDialogAndroid = alerDialogBuilder.Create();
                alertDialogAndroid.Show();
            };

            shootingTimeChangeButton.Click += delegate
            {
                LayoutInflater layoutInflaterAndroid = LayoutInflater.From(this);
                View           mView = layoutInflaterAndroid.Inflate(Resource.Layout.user_input_dialog_box, null);
                Android.Support.V7.App.AlertDialog.Builder alerDialogBuilder = new Android.Support.V7.App.AlertDialog.Builder(this);
                alerDialogBuilder.SetView(mView);

                var userShootingTime = mView.FindViewById <EditText>(Resource.Id.dialog_edit_text);

                alerDialogBuilder.SetCancelable(false)
                .SetPositiveButton("Ok", delegate
                {
                    shootingTime = Convert.ToInt32(userShootingTime.Text);
                    Toast.MakeText(this, "Shooting time set to " + shootingTime + " minutes", ToastLength.Short).Show();
                    intervalChangeButton.Text = (shootingTime).ToString();
                })
                .SetNegativeButton("Cancel", delegate
                {
                    alerDialogBuilder.Dispose();
                });

                Android.Support.V7.App.AlertDialog alertDialogAndroid = alerDialogBuilder.Create();
                alertDialogAndroid.Show();
            };
        }