public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            var view = inflater.Inflate(Resource.Layout.category_dialog, null);

            Dialog.SetTitle("Выберите категории");
            var mainLayout = view.FindViewById <LinearLayout>(Resource.Id.category_dialog_main);

            _checkBoxList = new List <CheckBox>();

            for (var index = 0; index < ServicesCategory.ServicesCategoryList.Count; index++)
            {
                var check    = ServicesCategory.ServicesCategoryList[index];
                var checkbox = new CheckBox(Context)
                {
                    Text             = check,
                    Checked          = _firstMasterViewModel.SelectedCategories.Exists(s => s.ToLower().Equals(check.ToLower())),
                    LayoutParameters = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent,
                                                                     ViewGroup.LayoutParams.WrapContent)
                };
                _checkBoxList.Add(checkbox);
                mainLayout.AddView(checkbox);
            }

            _closeButton        = view.FindViewById <Button>(Resource.Id.category_dialog_closeButton);
            _closeButton.Click += CloseButtonOnClick;

            var builder = new AlertDialog.Builder(Activity);

            builder.SetView(view);

            _createdDialog = builder.Create();
            return(view); // base.OnCreateView(inflater, container, savedInstanceState);
        }
        private void LoadPrintWebVIew()
        {
            // PrescriptionView is the design view
            var printView = LayoutInflater.Inflate(Resource.Layout.print_view, null);

            CreatePrintWebView(printView);
            Android.App.AlertDialog dialog = null;
            AlertDialog.Builder     alert  = new AlertDialog.Builder(this);

            alert.SetView(printView);

            alert.SetPositiveButton("Print", (senderAlert, args) =>
            {
                var webView     = printView.FindViewById <WebView>(Resource.Id.printWebView);
                string fileName = "MyPrintFile_" + Guid.NewGuid().ToString() + ".pdf";
                var printMgr    = (PrintManager)GetSystemService(MainActivity.PrintService);
                printMgr.Print("MyPrintJob", webView.CreatePrintDocumentAdapter(fileName), new PrintAttributes.Builder().Build());
            });

            alert.SetNegativeButton("Close", (senderAlert, args) =>
            {
                dialog.Dismiss();
            });

            dialog = alert.Create();
            dialog.Show();
            // dialogPrescription.Window.SetLayout(LinearLayout.LayoutParams.FillParent, LinearLayout.LayoutParams.FillParent);
        }
Example #3
0
        private void Propinabtn_Click(object sender, EventArgs e)
        {
            LayoutInflater layoutInflater = LayoutInflater.From(this);
            View           view           = layoutInflater.Inflate(Resource.Layout.propinapopup, null);

            AlertDialog.Builder builder = new AlertDialog.Builder(this);
            builder.SetView(view);
            builder.SetTitle("¿Caunto deseas agregar de propina?");
            var propinaa = view.FindViewById <EditText>(Resource.Id.lineapropina);

            builder.SetCancelable(false)
            .SetPositiveButton("Donar", (c, ev) =>
            {
                string lo            = propinaa.Text;
                propina.Text         = "$" + lo + ".00";
                propinaagregada.Text = "$" + lo + ".00";
                float gamesa         = float.Parse(lo);
                AddData(gamesa);
            })
            .SetNegativeButton("Cancelar", (c, ev) =>
            {
                propina.Text         = "$0.00";
                propinaagregada.Text = "$0.00";
            });
            AlertDialog lala = builder.Create();

            lala.Show();
        }
Example #4
0
        private void ShowLoginDialog()
        {
            var alert = new AlertDialog.Builder(this);

            alert.SetTitle("请登录");
            var view = View.Inflate(this, Resource.Layout.login_dialog, null);

            alert.SetView(view);
            alert.SetPositiveButton("登录", (EventHandler <DialogClickEventArgs>)null);
            var dialog = alert.Show();

            dialog.GetButton((int)DialogButtonType.Positive).Click += async(sender, args) =>
            {
                var username = view.FindViewById <EditText>(Resource.Id.et_name).Text;
                var password = view.FindViewById <EditText>(Resource.Id.et_pwd).Text;
                var token    = await API.Login(username, password);

                if (token != null)
                {
                    Toast.MakeText(this, "登录成功!", ToastLength.Short).Show();
                    refresh();
                    this.token = token;
                    GetSharedPreferences("config", FileCreationMode.Private)
                    .Edit().PutString("token", token).Apply();
                    dialog.Dismiss();
                }

                Toast.MakeText(this, "登录失败!", ToastLength.Short).Show();
            };
        }
        private void NewListAlertMethod(object sender, System.EventArgs e)
        {
            AlertDialog.Builder newListAlert = new AlertDialog.Builder(this);
            newListAlert.SetTitle("New List");
            newListAlert.SetMessage("Please enter the name of your new list");
            EditText input = new EditText(this)
            {
                TextSize = 22,
                Gravity  = GravityFlags.Center,
                Hint     = "List Name",
            };

            input.SetSingleLine(true);

            newListAlert.SetView(input);
            newListAlert.SetPositiveButton("OK", (senderAlert, arg) =>
            {
                NewListSave(input.Text);
            });

            newListAlert.SetNegativeButton("Cancel", (senderAlert, arg) => { });

            Dialog dialog = newListAlert.Create();

            dialog.Show();
        }
Example #6
0
        private void OnSelectButtonClick(string playlistId)
        {
            if (_state.Value != State.Waiting && _state.Value != State.Failed)
            {
                return;
            }

            AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(this, Resource.Style.DialogTheme);
            LayoutInflater      inflater      = (LayoutInflater)GetSystemService(LayoutInflaterService);
            View popupView = inflater.Inflate(Resource.Layout.popup, null);

            dialogBuilder.SetView(popupView);
            AlertDialog dialog = dialogBuilder.Create();

            dialog.Show();

            popupView.FindViewById <Button>(Resource.Id.shuffle_button).Click += (sender, e) =>
            {
                dialog.Dismiss();
                OnShuffleButtonClick(playlistId, ShuffleMode.Shuffle, popupView);
            };
            popupView.FindViewById <Button>(Resource.Id.restrict_button).Click += (sender, e) =>
            {
                dialog.Dismiss();
                OnShuffleButtonClick(playlistId, ShuffleMode.Restrict, popupView);
            };
            popupView.FindViewById <EditText>(Resource.Id.restrict_value).Text =
                GetSharedPreferences("SPOTIFY", 0).GetString("RESTRICT_VALUE", "10");
        }
Example #7
0
        public override bool OnOptionsItemSelected(IMenuItem item)
        {
            // Handle presses on the action bar items
            try
            {
                switch (item.ItemId)
                {
                case Resource.Id.action_settings:
                    Intent i = new Intent(this, typeof(SettingsActivity));
                    StartActivityForResult(i, SETTINGS_ACTIVITY_CODE);
                    return(true);

                case Resource.Id.action_goto:
                    AlertDialog.Builder builder = new AlertDialog.Builder(this);
                    builder.SetTitle("Go To ... %");
                    EditText inputGoTo = new EditText(this);
                    inputGoTo.InputType = InputTypes.ClassNumber;
                    IInputFilter[] fa = new IInputFilter[1];
                    fa[0] = new InputFilterLengthFilter(2);
                    inputGoTo.SetFilters(fa);
                    inputGoTo.Text    = Convert.ToString((int)(Math.Min(linesRecyclerView.progress * 100, 99)));
                    inputGoTo.Gravity = GravityFlags.Center;
                    inputGoTo.SetSelection(inputGoTo.Text.Length);
                    builder.SetView(inputGoTo);
                    builder.SetPositiveButton("Go", (sender, e) =>
                    {
                        int newPercent = 0;

                        try
                        {
                            newPercent = Math.Max(0, Math.Min(int.Parse(inputGoTo.Text.ToString()), 100));
                            int newPos = (int)Math.Round((double)textLen * newPercent / 100);
                            Annotate(newPos);
                            ((AlertDialog)sender).Dismiss();
                        }
                        catch (System.FormatException)
                        {
                            Toast.MakeText(this, "Invalid percent number", ToastLength.Long).Show();
                        }
                    });
                    builder.SetNegativeButton("Cancel", (sender, e) =>
                    {
                        ((AlertDialog)sender).Cancel();
                    });

                    AlertDialog dialog = builder.Create();
                    dialog.Window.SetSoftInputMode(SoftInput.StateVisible);

                    dialog.Show();
                    break;
                }
            }
            catch (Exception e)
            {
                Toast.MakeText(this, "Error: " + e.Message, ToastLength.Long).Show();
            }

            return(false);
        }
Example #8
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            // Set our view from the "main" layout resource
            SetContentView(Resource.Layout.activity_main);

            AlertDialog.Builder builder = new AlertDialog.Builder(this);
            builder.SetTitle("顏色");
            View view = LayoutInflater.From(this).Inflate(Resource.Layout.color, null);

            builder.SetView(view);
            adColor = builder.Create();

            bColor        = FindViewById <Button>(Resource.Id.b_color);
            etText        = FindViewById <EditText>(Resource.Id.et_text);
            fontMetrics   = paint.GetFontMetrics();
            ivCanvas      = FindViewById <ImageView>(Resource.Id.iv_canvas);
            llPaint       = FindViewById <LinearLayout>(Resource.Id.ll_paint);
            rbEraser      = FindViewById <RadioButton>(Resource.Id.rb_eraser);
            rbFill        = FindViewById <RadioButton>(Resource.Id.rb_fill);
            rbHandwriting = FindViewById <RadioButton>(Resource.Id.rb_handwriting);
            rbPencil      = FindViewById <RadioButton>(Resource.Id.rb_pencil);
            rbText        = FindViewById <RadioButton>(Resource.Id.rb_text);
            sbAlpha       = view.FindViewById <SeekBar>(Resource.Id.sb_alpha);
            sbBlue        = view.FindViewById <SeekBar>(Resource.Id.sb_blue);
            sbGreen       = view.FindViewById <SeekBar>(Resource.Id.sb_green);
            sbRed         = view.FindViewById <SeekBar>(Resource.Id.sb_red);
            sbSize        = FindViewById <SeekBar>(Resource.Id.sb_size);
            sbWidth       = FindViewById <SeekBar>(Resource.Id.sb_width);

            adColor.DismissEvent += AdColor_DismissEvent;
            FindViewById <Button>(Resource.Id.b_clear).Click += BClear_Click;
            bColor.Click += BSolidColor_Click;
            FindViewById <Button>(Resource.Id.b_red).Click     += BMaterialDesignColor_Click;
            FindViewById <Button>(Resource.Id.b_green).Click   += BMaterialDesignColor_Click;
            FindViewById <Button>(Resource.Id.b_blue).Click    += BMaterialDesignColor_Click;
            FindViewById <Button>(Resource.Id.b_yellow).Click  += BMaterialDesignColor_Click;
            FindViewById <Button>(Resource.Id.b_cyan).Click    += BMaterialDesignColor_Click;
            FindViewById <Button>(Resource.Id.b_magenta).Click += BMaterialDesignColor_Click;
            FindViewById <Button>(Resource.Id.b_black).Click   += BMaterialDesignColor_Click;
            FindViewById <Button>(Resource.Id.b_white).Click   += BMaterialDesignColor_Click;
            ivCanvas.Touch += IvCanvas_Touch;
            FindViewById <RadioGroup>(Resource.Id.rg_tool).CheckedChange += RgTool_CheckedChange;
            sbAlpha.ProgressChanged += SbColor_ProgressChanged;
            sbBlue.ProgressChanged  += SbColor_ProgressChanged;
            sbGreen.ProgressChanged += SbColor_ProgressChanged;
            sbRed.ProgressChanged   += SbColor_ProgressChanged;
            sbSize.ProgressChanged  += SbSize_ProgressChanged;
            sbWidth.ProgressChanged += SbWidth_ProgressChanged;

            Handwriting.blackBrush = BitmapFactory.DecodeResource(Resources, Resource.Mipmap.brush);
            Handwriting.brush      = Handwriting.blackBrush.Copy(Bitmap.Config.Argb8888, true);
        }
        private void OnAddItemClicked(object sender, EventArgs eventArgs)
        {
            var builder      = new AlertDialog.Builder(this);
            var dialogLayout = LayoutInflater.Inflate(Resource.Layout.dialog_new_item, null);
            var control      = dialogLayout.FindViewById <EditText>(Resource.Id.new_item_text);

            builder.SetTitle(GetString(Resource.String.new_item_title));
            builder.SetView(dialogLayout);
            builder.SetPositiveButton("OK", async(sender, eventArgs) => await CreateItemFromDialogAsync(control));
            var dialog = builder.Create();

            dialog.Show();
        }
Example #10
0
        private void ShowPauseDialog()
        {
            View dialogView = LayoutInflater.Inflate(Resource.Layout.spinner_dialog, null);

            AlertDialog.Builder builder = new AlertDialog.Builder(this);
            builder.SetView(dialogView);
            builder.SetCancelable(false);
            builder.SetTitle(INFECTION_STATUS_PAUSE_DIALOG_TITLE);
            builder.SetMessage(INFECTION_STATUS_PAUSE_DIALOG_MESSAGE);
            _picker          = dialogView.FindViewById(Resource.Id.picker) as NumberPicker;
            _picker.MinValue = 0;
            _picker.MaxValue = 4;
            _picker.DescendantFocusability = DescendantFocusability.BlockDescendants;
            _picker.SetDisplayedValues(
                new[]
            {
                INFECTION_STATUS_PAUSE_DIALOG_OPTION_NO_REMINDER,
                INFECTION_STATUS_PAUSE_DIALOG_OPTION_ONE_HOUR,
                INFECTION_STATUS_PAUSE_DIALOG_OPTION_TWO_HOURS,
                INFECTION_STATUS_PAUSE_DIALOG_OPTION_FOUR_HOURS,
                INFECTION_STATUS_PAUSE_DIALOG_OPTION_EIGHT_HOURS,
            });

            builder.SetPositiveButton(INFECTION_STATUS_PAUSE_DIALOG_OK_BUTTON, (sender, args) =>
            {
                switch (_picker.Value)
                {
                case 1:
                case 2:
                case 3:
                case 4:
                    StartReminderService((int)Math.Pow(2, _picker.Value - 1));
                    break;
                }
                StopGoogleAPI();
                (sender as AlertDialog)?.Dismiss();
            });

            if (Android.OS.Build.VERSION.SdkInt > Android.OS.BuildVersionCodes.M)
            {
                AlertDialog alertDialog = builder.Create();
                alertDialog.Window.DecorView.LayoutDirection = LayoutUtils.GetLayoutDirection();
                alertDialog.Show();
            }
            else
            {
                builder.Create();
                builder.Show();
            }
        }
Example #11
0
        private void Promocionbtn_Click(object sender, EventArgs e)
        {
            LayoutInflater inflater = LayoutInflater.From(this);
            View           vv       = inflater.Inflate(Resource.Layout.propinapopup, null);

            AlertDialog.Builder kola = new AlertDialog.Builder(this);
            kola.SetView(vv);
            kola.SetTitle("Por favor agrega tu promocion");
            var promo = vv.FindViewById <EditText>(Resource.Id.lineapropina);

            kola.SetCancelable(false)
            .SetPositiveButton("Agregar", (c, ev) =>
            {
                string sql = string.Format("Select * from TapFood.Promociones where(IdPromociones = '{0}')", promo.ToString());
                MySqlCommand loginverid = new MySqlCommand(sql, conn);
                MySqlDataReader usr;
                usr = loginverid.ExecuteReader();
                if (usr.HasRows)
                {
                    promocion.Text = (string)usr["IdPromocion"];
                    string x       = (string)usr["Descuento"];
                    float cosumel  = float.Parse(x);
                    AddData(cosumel);
                    Toast.MakeText(this, "Hemos agregado la promocion correctamente", ToastLength.Long).Show();
                    usr.Close();
                }
                else
                {
                    AddData(0);
                    Toast.MakeText(this, "No hemos encontrado el codigo que introduciste, intenta de nuevo por favor", ToastLength.Long).Show();
                    usr.Close();
                    promocionagregada.Text = "$0.00";
                }
            })
            .SetNegativeButton("Cancelar", (c, ev) =>
            {
                AddData(0);
                promocionagregada.Text = "0.00";
                Finish();
            });
            AlertDialog cma = kola.Create();

            cma.Show();
        }
Example #12
0
        public void ShowInputDialog(string title, string message, string defaultInput, Android.Text.InputTypes inputTypes, Action <string> acceptAction)
        {
            AlertDialog.Builder builder = new AlertDialog.Builder(this);
            builder.SetTitle(title);
            builder.SetMessage(message);

            var inputText = new EditText(this);

            inputText.SetRawInputType(inputTypes);
            inputText.Text          = defaultInput;
            inputText.TextAlignment = TextAlignment.Center;
            builder.SetView(inputText);

            builder.SetPositiveButton("OK", delegate { acceptAction(inputText.Text); });
            builder.SetNegativeButton("Cancel", delegate { });
            Dialog dialog = builder.Create();

            dialog.Show();
        }
Example #13
0
        public void SaveToFile()
        {
            AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(this);
            dialogBuilder.SetTitle("Save to file");

            View     views = LayoutInflater.Inflate(Resource.Layout.AlertDialog_Save, null);
            EditText input = (EditText)views.FindViewById(Resource.Id.edit);

            int counter = 0;

            Java.Lang.StringBuilder tempName = new Java.Lang.StringBuilder(curSaveName);
            while (true)
            {
                File file = new File(global::Android.OS.Environment.ExternalStorageDirectory + "/ChineseReader/", tempName.ToString() + ".txt");
                if (file.Exists())
                {
                    counter++;
                    tempName.SetLength(0);
                    tempName.Append(curSaveName).Append('(').Append(Convert.ToChar(counter)).Append(')');
                }
                else
                {
                    input.SetText(tempName, TextView.BufferType.Spannable);
                    break;
                }
            }

            dialogBuilder.SetView(views);
            dialogBuilder.SetPositiveButton("Save", delegate { });
            dialogBuilder.SetNegativeButton("Cancel", delegate { });

            AlertDialog alert = dialogBuilder.Show();

            dumpStartButton        = alert.GetButton((int)DialogButtonType.Positive);
            dumpStartButton.Click += (sender, e) =>
            {
                try
                {
                    View view = (View)sender;

                    File dir = new File(global::Android.OS.Environment.ExternalStorageDirectory + "/ChineseReader/");
                    if (!dir.Exists())
                    {
                        dir.Mkdirs();
                    }

                    if (((RadioButton)views.FindViewById(Resource.Id.radio_text)).Checked)
                    {
                        string path = dir.AbsolutePath + "/" + input.Text.ToString() + ".txt";

                        if (annoMode == ANNOTATE_FILE)
                        {
                            System.IO.FileStream fis = new System.IO.FileStream(curFilePath, System.IO.FileMode.Open, System.IO.FileAccess.Read);
                            System.IO.FileStream fos = new System.IO.FileStream(path, System.IO.FileMode.Create, System.IO.FileAccess.Write);
                            CopyFile(fis, fos);
                            fis.Close();
                            fos.Close();
                        }
                        else
                        {
                            System.IO.StreamWriter fw = new System.IO.StreamWriter(path);
                            fw.Write(pastedText.Substring(0, pastedText.Length));
                            fw.Flush();
                            fw.Close();
                        }

                        Toast.MakeText(Application, "Saved to " + path, ToastLength.Long).Show();
                    }
                    else if (((RadioButton)views.FindViewById(Resource.Id.radio_pinyin)).Checked)
                    {
                        string path = dir.AbsolutePath + "/" + input.Text.ToString() + ".txt";

                        view.Enabled                = false;
                        dumpFilePath                = path;
                        dumpFileWriter              = new System.IO.StreamWriter(path);
                        dumpProgress                = (ProgressBar)views.FindViewById(Resource.Id.progress);
                        dumpProgressText            = (TextView)views.FindViewById(Resource.Id.progress_text);
                        dumpProgress.Visibility     = ViewStates.Visible;
                        dumpProgressText.Visibility = ViewStates.Visible;
                        dumpCancelled               = false;
                        DumpPinyin(0, 0);
                    }
                    else if (((RadioButton)views.FindViewById(Resource.Id.radio_both)).Checked)
                    {
                        string path = dir.AbsolutePath + "/" + input.Text.ToString() + ".tsv";

                        view.Enabled                = false;
                        dumpFilePath                = path;
                        dumpFileWriter              = new System.IO.StreamWriter(path);
                        dumpProgress                = (ProgressBar)views.FindViewById(Resource.Id.progress);
                        dumpProgressText            = (TextView)views.FindViewById(Resource.Id.progress_text);
                        dumpProgress.Visibility     = ViewStates.Visible;
                        dumpProgressText.Visibility = ViewStates.Visible;
                        dumpCancelled               = false;
                        DumpBoth(0, 0);
                    }
                }
                catch (Exception ex)
                {
                    Toast.MakeText(Application, ex.Message, ToastLength.Long).Show();
                }
            };

            Button dumpCancelButton = alert.GetButton((int)DialogButtonType.Negative);

            dumpCancelButton.Click += (sender, e) =>
            {
                dumpCancelled = true;

                alert.Dismiss();
            };
        }
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            var view = inflater.Inflate(Resource.Layout.shedule_dialog, null);

            Dialog.SetTitle("Создайте расписание");
            var mainLayout = view.FindViewById <LinearLayout>(Resource.Id.category_dialog_main);
            var st         = view.FindViewById <CheckBox>(Resource.Id.checkbox_pn);

            _checkBoxList = new List <CheckBox>();
            _checkBoxList.Add(view.FindViewById <CheckBox>(Resource.Id.checkbox_pn));
            _checkBoxList.Add(view.FindViewById <CheckBox>(Resource.Id.checkbox_vt));
            _checkBoxList.Add(view.FindViewById <CheckBox>(Resource.Id.checkbox_sr));
            _checkBoxList.Add(view.FindViewById <CheckBox>(Resource.Id.checkbox_che));
            _checkBoxList.Add(view.FindViewById <CheckBox>(Resource.Id.checkbox_pt));
            _checkBoxList.Add(view.FindViewById <CheckBox>(Resource.Id.checkbox_sb));
            _checkBoxList.Add(view.FindViewById <CheckBox>(Resource.Id.checkbox_vs));
            ///knopki C
            _pn_c_btn         = view.FindViewById <Button>(Resource.Id.checkbox_pn_s);
            _pn_c_btn.Click  += CBtnOnClick;
            _vt_c_btn         = view.FindViewById <Button>(Resource.Id.checkbox_vt_s);
            _vt_c_btn.Click  += CBtnOnClick;
            _sr_c_btn         = view.FindViewById <Button>(Resource.Id.checkbox_sr_s);
            _sr_c_btn.Click  += CBtnOnClick;
            _che_c_btn        = view.FindViewById <Button>(Resource.Id.checkbox_che_s);
            _che_c_btn.Click += CBtnOnClick;
            _pt_c_btn         = view.FindViewById <Button>(Resource.Id.checkbox_pt_s);
            _pt_c_btn.Click  += CBtnOnClick;
            _sb_c_btn         = view.FindViewById <Button>(Resource.Id.checkbox_sb_s);
            _sb_c_btn.Click  += CBtnOnClick;
            _vs_c_btn         = view.FindViewById <Button>(Resource.Id.checkbox_vs_s);
            _vs_c_btn.Click  += CBtnOnClick;


            _pn_po_btn         = view.FindViewById <Button>(Resource.Id.checkbox_pn_po);
            _pn_po_btn.Click  += PoBtnOnClick;
            _vt_po_btn         = view.FindViewById <Button>(Resource.Id.checkbox_vt_po);
            _vt_po_btn.Click  += PoBtnOnClick;
            _sr_po_btn         = view.FindViewById <Button>(Resource.Id.checkbox_sr_po);
            _sr_po_btn.Click  += PoBtnOnClick;
            _che_po_btn        = view.FindViewById <Button>(Resource.Id.checkbox_che_po);
            _che_po_btn.Click += PoBtnOnClick;
            _pt_po_btn         = view.FindViewById <Button>(Resource.Id.checkbox_pt_po);
            _pt_po_btn.Click  += PoBtnOnClick;
            _sb_po_btn         = view.FindViewById <Button>(Resource.Id.checkbox_sb_po);
            _sb_po_btn.Click  += PoBtnOnClick;
            _vs_po_btn         = view.FindViewById <Button>(Resource.Id.checkbox_vs_po);
            _vs_po_btn.Click  += PoBtnOnClick;


            //_checkBoxList = new List<CheckBox>();

            //for (var index = 0; index < ServicesCategory.DayOfWeekList.Count; index++)
            //{
            //    var lianerLayout = new LinearLayout(Context)
            //    {
            //        LayoutParameters = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent,
            //            ViewGroup.LayoutParams.WrapContent)
            //    };
            //    var check = ServicesCategory.DayOfWeekList[index];
            //    var checkbox = new CheckBox(Context)
            //    {
            //        Text = check,
            //        Checked = _firstMasterViewModel.SelectedCategories.Exists(s => s.ToLower().Equals(check.ToLower())),
            //        LayoutParameters = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent,
            //            ViewGroup.LayoutParams.WrapContent)
            //    };
            //    _checkBoxList.Add(checkbox);
            //    lianerLayout.AddView(checkbox);

            //    mainLayout.AddView(lianerLayout);
            //}

            _closeButton        = view.FindViewById <Button>(Resource.Id.category_dialog_closeButton);
            _closeButton.Click += CloseButtonOnClick;

            var builder = new AlertDialog.Builder(Activity);

            builder.SetView(view);

            _createdDialog = builder.Create();
            return(view); // base.OnCreateView(inflater, container, savedInstanceState);
        }
        public override Dialog OnCreateDialog(Bundle savedInstanceState)
        {
            var alertDialogBuilder = new AlertDialog.Builder(Activity);
            var cancelConfig       = Config.CancelButton;

            if (cancelConfig != null)
            {
                var cancelTitle = cancelConfig.Title ?? InteractiveAlertConfig.DefaultCancelText;
                alertDialogBuilder.SetNegativeButton(cancelTitle, (sender, e) =>
                {
                    var handler = cancelConfig.Action;
                    if (handler != null)
                    {
                        handler();
                    }
                    else
                    {
                        Dismiss();
                    }
                });
            }

            var okConfig = Config.OkButton;

            if (okConfig != null)
            {
                var okTitle = okConfig.Title ?? InteractiveAlertConfig.DefaultOkText;
                alertDialogBuilder.SetPositiveButton(okTitle, (sender, e) =>
                {
                    var handler = okConfig.Action;
                    if (handler != null)
                    {
                        handler();
                    }
                    else
                    {
                        Dismiss();
                    }
                });
            }

            var contentView = (LinearLayout)LayoutInflater.From(Context).Inflate(Resource.Layout.alert_dialog, null);
            var bottomView  = contentView.FindViewById <LinearLayout>(Resource.Id.alert_dialog_bottom);

            OnSetContentView(contentView);

            // try set bottom view
            bottomView.Visibility = OnSetBottomView(bottomView) ? ViewStates.Visible : ViewStates.Gone;

            var topContentView = contentView.FindViewById <FrameLayout>(Resource.Id.alert_dialog_top);

            _topViewHolder = TopContentFactory.CreateTopViewHolder(Context, topContentView, Config.Style);
            _topViewHolder.ContentView.RequestLayout();

            // set text
            SetContentText(contentView, Resource.Id.alert_dialog_title, Config.Title);
            SetContentText(contentView, Resource.Id.alert_dialog_content, Config.Message);
            alertDialogBuilder.SetView(contentView);

            return(alertDialogBuilder.Create());
        }
Example #16
0
        public override bool OnOptionsItemSelected(IMenuItem item)
        {
            switch (item.ItemId)
            {
            case Resource.Id.menuItem1:
            {
                // add your code
                return(true);
            }

            case Resource.Id.menuItem2:
            {
                // Create a Popup that will allow the user to choose a new color for there Location Dot.
                AlertDialog.Builder alert = new AlertDialog.Builder(this);
                alert.SetTitle("Change Icon Color");
                View view = LayoutInflater.Inflate(Resource.Layout.ColorLayout, null);
                ColorAdapter = new ArrayAdapter <string>(this, Android.Resource.Layout.SimpleListItemSingleChoice, mainsave.ColorsAvailable);


                ColorList            = (ListView)view.FindViewById(Resource.Id.ColorListView);
                ColorList.Adapter    = ColorAdapter;
                ColorList.ItemClick += colorSelected;

                ColorList.SetItemChecked(mainsave.IndexColors(), true); // Get the currently selected color and have it selected
                alert.SetPositiveButton("OK", OkColorAction);           // Assign what happens when the user clicks ok.
                alert.SetCancelable(false);
                alert.SetView(view);
                alert.Show();           // Show Popup
                return(true);
            }

            case Resource.Id.menuItem3:
            {
                // Create popup for if the user wants the units in MPH/Feet or KPH/Meters
                AlertDialog.Builder alert = new AlertDialog.Builder(this);
                alert.SetTitle("Change Measurement System");
                View          view = LayoutInflater.Inflate(Resource.Layout.ColorLayout, null);
                List <string> temp = new List <string> {
                    "Imperial", "Metric"
                };
                MeasurementAdapter = new ArrayAdapter <string>(this, Android.Resource.Layout.SimpleListItemSingleChoice, temp);

                // Determine currently selected unit system
                ColorList         = (ListView)view.FindViewById(Resource.Id.ColorListView);
                ColorList.Adapter = MeasurementAdapter;
                if (mainsave.Measurement == MySettings.MeasurementSystem.Imperial)
                {
                    ColorList.SetItemChecked(0, true);
                }
                else
                {
                    ColorList.SetItemChecked(1, true);
                }


                ColorList.ItemClick += colorSelected;
                alert.SetPositiveButton("OK", OkMeasurementAction);
                alert.SetCancelable(false);
                alert.SetView(view);
                alert.Show();
                return(true);
            }
            }

            return(base.OnOptionsItemSelected(item));
        }