Esempio n. 1
0
        void schedule_ScheduleCellTapped(object sender, CellTappedEventArgs args)
        {
            var appointment = args.ScheduleAppointment;

            if (appointment != null)
            {
                AlertDialog.Builder alert = new AlertDialog.Builder(this);
                alert.SetTitle("Confirm delete");
                alert.SetMessage(appointment.Subject);
                alert.SetPositiveButton("Delete", async(senderAlert, arg) =>
                {
                    await apiClient.DeleteWorkplaceOrderAsync((int)appointment.RecurrenceId);
                    Toast.MakeText(this, "Deleted!", ToastLength.Short).Show();
                    Orders.Remove(appointment);
                    schedule.ItemsSource = Orders;
                    SetContentView(schedule);
                });

                alert.SetNegativeButton("Cancel", (senderAlert, arg) =>
                {
                    Toast.MakeText(this, "Cancelled!", ToastLength.Short).Show();
                });

                Dialog dialog = alert.Create();
                dialog.Show();
            }
        }
Esempio n. 2
0
        private void ListView_ItemClick(object sender, AdapterView.ItemClickEventArgs e)
        {
            AlertDialog.Builder alert = new AlertDialog.Builder(this);

            alert.SetTitle("Do you want to delete this payment?");

            alert.SetPositiveButton("Yes", (senderAlert, args) =>
            {
                friendsToPayment.Remove(friendsToPayment[e.Position]);
                var adapterPayemnt = new PaymentAddAdapter(this, friendsToPayment);

                listView.Adapter = adapterPayemnt;
                try
                {
                    editText.Text = friendsToPayment.Where(s => s.Item2 > 0).Sum(s => s.Item2).ToString();
                }
                catch (Exception)
                {
                    Toast.MakeText(this, "Sum to big!", ToastLength.Short).Show();
                }
                //apter = new FriendsCustomAdapter(this, users);
                //tData = FindViewById<ListView>(Resource.Id.listViewFriends);
                //tData.Adapter = adapter;
            });

            alert.SetNegativeButton("No", (senderAlert, args) => {
            });
            //run the alert in UI thread to display in the screen
            RunOnUiThread(() => {
                alert.Show();
            });
        }
Esempio n. 3
0
        private void MaxDownloadClick(object sender, Preference.PreferenceClickEventArgs e)
        {
            View pickerView = LayoutInflater.Inflate(Resource.Layout.NumberPicker, null);

            AlertDialog.Builder builder = new AlertDialog.Builder(Activity, MainActivity.dialogTheme);
            builder.SetTitle(Resources.GetString(Resource.String.max_download_dialog));
            builder.SetView(pickerView);
            NumberPicker picker = (NumberPicker)pickerView;

            picker.MinValue = 1;
            picker.MaxValue = 10;
            picker.Value    = int.Parse(FindPreference("maxDownload").Summary);

            builder.SetPositiveButton(Resources.GetString(Resource.String.apply), (s, eventArg) =>
            {
                ISharedPreferences pref         = PreferenceManager.GetDefaultSharedPreferences(Application.Context);
                ISharedPreferencesEditor editor = pref.Edit();
                editor.PutInt("maxDownload", picker.Value);
                editor.Apply();

                Preference prefButton = FindPreference("maxDownload");
                prefButton.Summary    = pref.GetInt("maxDownload", 2).ToString();

                if (Downloader.instance != null && Downloader.queue.Count > 0)
                {
                    Downloader.instance.maxDownload = pref.GetInt("maxDownload", 4);
                }
            });
            builder.SetNegativeButton(Resources.GetString(Resource.String.cancel), (s, eventArg) => { });
            builder.Show();
        }
Esempio n. 4
0
        public override void ActionSheet(ActionSheetConfig config)
        {
            var dlg = new AlertDialog
                      .Builder(this.GetTopActivity())
                      .SetCancelable(false)
                      .SetTitle(config.Title);

            if (config.ItemIcon != null || config.Options.Any(x => x.ItemIcon != null))
            {
                var adapter = new ActionSheetListAdapter(this.GetTopActivity(), Android.Resource.Layout.SelectDialogItem, Android.Resource.Id.Text1, config);
                dlg.SetAdapter(adapter, (s, a) => config.Options[a.Which].Action?.Invoke());
            }
            else
            {
                var array = config
                            .Options
                            .Select(x => x.Text)
                            .ToArray();

                dlg.SetItems(array, (s, args) => config.Options[args.Which].Action?.Invoke());
            }

            if (config.Destructive != null)
            {
                dlg.SetNegativeButton(config.Destructive.Text, (s, a) => config.Destructive.Action?.Invoke());
            }

            if (config.Cancel != null)
            {
                dlg.SetNeutralButton(config.Cancel.Text, (s, a) => config.Cancel.Action?.Invoke());
            }

            Utils.RequestMainThread(() => dlg.ShowExt());
        }
Esempio n. 5
0
        //---------------------------------------------------------------------
        // 개인정보취급방침 다이얼로그

        private AlertDialog.Builder CreatePrivacyDialog()
        {
            string       privacyPolicyStr;
            AssetManager assets = this.Assets;

            using (StreamReader sr = new StreamReader(assets.Open("PrivacyPolicy.txt")))
            {
                privacyPolicyStr = sr.ReadToEnd();
            }

            AlertDialog.Builder builder = new AlertDialog.Builder(this);
            builder.SetCancelable(false);
            builder.SetTitle("개인정보취급방침에 동의하시겠습니까?");
            builder.SetMessage(privacyPolicyStr);
            builder.SetPositiveButton("예", (senderAlert, args) =>
            {
                MoveToNextScreen();
            });
            builder.SetNegativeButton("아니오", (senderAlert, args) =>
            {
                RunOnUiThread(() =>
                {
                    Toast.MakeText(this, "개인정보취급방침에 동의해주셔야 레뜨레를 사용하실 수 있습니다.", ToastLength.Short).Show();
                    _NextBtn.Clickable = true;                                                                              //버튼 누를 수 있게 풀어줘야 됨.
                });
            });
            return(builder);
        }
Esempio n. 6
0
        public override void ActionSheet(ActionSheetConfig config)
        {
            var dlg = new AlertDialog
                .Builder(this.GetTopActivity())
                .SetCancelable(false)
                .SetTitle(config.Title);

            if (config.ItemIcon != null || config.Options.Any(x => x.ItemIcon != null)) {
                var adapter = new ActionSheetListAdapter(this.GetTopActivity(), Android.Resource.Layout.SelectDialogItem, Android.Resource.Id.Text1, config);
                dlg.SetAdapter(adapter, (s, a) => config.Options[a.Which].Action?.Invoke());
            }
            else {
                var array = config
                    .Options
                    .Select(x => x.Text)
                    .ToArray();

                dlg.SetItems(array, (s, args) => config.Options[args.Which].Action?.Invoke());
            }

            if (config.Destructive != null)
                dlg.SetNegativeButton(config.Destructive.Text, (s, a) => config.Destructive.Action?.Invoke());

            if (config.Cancel != null)
                dlg.SetNeutralButton(config.Cancel.Text, (s, a) => config.Cancel.Action?.Invoke());

            Utils.RequestMainThread(() => dlg.ShowExt());
        }
        public override bool OnOptionsItemSelected(IMenuItem item)
        {
            int id = item.ItemId;

            switch (id)
            {
            case Resource.Id.action_exit:
                timer.Stop();
                AlertDialog.Builder alert = new AlertDialog.Builder(this);

                alert.SetTitle("Confirm EXIT");

                alert.SetMessage("Do you want to Exit?");

                alert.SetPositiveButton("Yes", (senderAlert, args) => {
                    StartActivity(new Intent(Application.Context, typeof(ScoreviewActivity)));
                    Finish();
                });

                alert.SetNegativeButton("Cancel", (senderAlert, args) => {
                    timer.Start();
                });

                Dialog dialog = alert.Create();

                dialog.Show();
                break;

            default:
                break;
            }
            return(base.OnOptionsItemSelected(item));
        }
Esempio n. 8
0
        public static async Task <int> ShowSingleChoiseDlg(Context context, string title, IListAdapter items, bool bAllowAbort = true)
        {
            if (context == null)
            {
                return(-1);
            }

            tcsScDlg = new TaskCompletionSource <int>();

            MainThread.BeginInvokeOnMainThread(() =>
            {
                try
                {
                    var builder = new AlertDialog.Builder(context).SetTitle(title);
                    if (bAllowAbort)
                    {
                        builder = builder.SetNegativeButton(context.Resources.GetString(context.Resources.GetIdentifier("action_abort", "string", "me.ichrono.droid")), (s, e) => { tcsScDlg.TrySetResult(-1); });
                    }
                    builder = builder.SetSingleChoiceItems(items, -1, new SingleChoiceClickListener(tcsScDlg));
                    builder = builder.SetOnCancelListener(new myDialogCancelListener <int>(tcsScDlg));
                    var dlg = builder.Create();

                    dlg.Show();
                }
                catch
                {
                    tcsScDlg.TrySetResult(-1);
                }
            });
            await tskScDlg;

            return(tskScDlg.Result);
        }
        private void ListViewClick(object sender, AdapterView.ItemClickEventArgs e)
        {
            AlertDialog.Builder alert = new AlertDialog.Builder(this);

            alert.SetTitle("Do you want add to your friends?");

            alert.SetPositiveButton("Yes", async(senderAlert, args) =>
            {
                FriendItem item = new FriendItem {
                    FriendId = users[e.Position].Id, UserId = HomeActivity1.userItem.Id
                };
                await DatabaseManager.DefaultManager.SaveFriendItemAsync(item);
                users.Remove(users[e.Position]);
                adapter         = new FriendsCustomAdapter(this, users);
                lstData         = FindViewById <ListView>(Resource.Id.listViewFriends);
                lstData.Adapter = adapter;
            });

            alert.SetNegativeButton("No", (senderAlert, args) => {
            });
            //run the alert in UI thread to display in the screen
            RunOnUiThread(() => {
                alert.Show();
            });
        }
        private void SetDeleteMark()
        {
            AlertDialog.Builder quitDialog = new AlertDialog.Builder(this);
            quitDialog.SetTitle("Вы уверены?");
            quitDialog.SetPositiveButton("Да", (senderAlert, args) =>
            {
                var item = mAdapterDataList.GetItemAtPosition(mSelectedItemPosition);

                Dictionary <long, ElementData> mCommands = new Dictionary <long, ElementData>();
                mCommands.Add(0, new ElementData()
                {
                    Name = "delete", Data = "delete"
                });
                string output               = JsonConvert.SerializeObject(mCommands);
                DataSetWS dataSetWS         = new DataSetWS();
                dataSetWS.SetDataCompleted += DataSetWS_SetDataCompleted;
                dataSetWS.SetDataAsync(mRef, item.Ref, output, AppVariable.Variable.getSessionParametersJSON());
                mCommands.Remove(0);
            });
            quitDialog.SetNegativeButton("Нет", (senderAlert, args) =>
            {
            });
            Dialog dialog = quitDialog.Create();

            dialog.Show();
        }
Esempio n. 11
0
        public override bool OnOptionsItemSelected(IMenuItem item)
        {
            switch (item.ItemId)
            {
            case Resource.Id.action_setsource:
                AlertDialog.Builder alert = new AlertDialog.Builder(this);
                alert.SetTitle("Last.fm username");
                var input = new EditText(this);
                alert.SetView(input);
                alert.SetNegativeButton("Cancel", (o, ea) => { });
                alert.SetPositiveButton("OK", async(o, ea) =>
                {
                    LastFM.SourceUser = input.Text;
                    await LastFM.Reload();
                    scrobblesView.SetAdapter(LastFM.ReythAdapter);
                });
                alert.Show();
                return(true);

            case Resource.Id.action_reload:
                RunOnUiThread(async() =>
                {
                    await LastFM.Reload();
                    scrobblesView.SetAdapter(LastFM.ReythAdapter);
                });
                return(true);
            }
            return(false);
        }
        void OnActionSheetRequested(Page sender, ActionSheetArguments arguments)
        {
            var builder = new AlertDialog.Builder(this);

            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();
        }
Esempio n. 13
0
        /// <summary>
        /// Shows an alert dialog with two buttons.
        /// </summary>
        /// <param name="title"></param>
        /// <param name="message"></param>
        /// <param name="okButtonText"></param>
        /// <param name="cancelButtonText"></param>
        /// <param name="okCallback"></param>
        /// <param name="cancelCallback"></param>
        public void ShowPopup(string title, string message, string okButtonText, string cancelButtonText, Action okCallback,
                              Action cancelCallback, bool dismissable = false, Action dismissCallback = null)
        {
            var top = Mvx.Resolve <IMvxAndroidCurrentTopActivity>();

            if (top == null)
            {
                // may occur if in middle of transition
                return;
            }

            AlertDialog.Builder builder = new AlertDialog.Builder(top.Activity);
            builder.SetMessage(message);
            builder.SetTitle(title);
            builder.SetNegativeButton(cancelButtonText, (o, args) =>
            {
                cancelCallback?.Invoke();
            });
            builder.SetPositiveButton(okButtonText, (o, args) =>
            {
                okCallback?.Invoke();
            });
            builder.SetCancelable(dismissable);
            var dialog = builder.Create();

            // set the dismiss callback, note that this is not the same as tapping cancel
            dialog.CancelEvent += (sender, args) => dismissCallback?.Invoke();
            top.Activity.RunOnUiThread(() => { dialog.Show(); });
        }
Esempio n. 14
0
        public override void ActionSheet(ActionSheetConfig config)
        {
            var array = config
                        .Options
                        .Select(x => x.Text)
                        .ToArray();

            var dlg = new AlertDialog
                      .Builder(this.getTopActivity())
                      .SetCancelable(false)
                      .SetTitle(config.Title);

            dlg.SetItems(array, (sender, args) => config.Options[args.Which].Action.TryExecute());

            if (config.Destructive != null)
            {
                dlg.SetNegativeButton(config.Destructive.Text, (sender, e) => config.Destructive.Action.TryExecute());
            }

            if (config.Cancel != null)
            {
                dlg.SetNeutralButton(config.Cancel.Text, (sender, e) => config.Cancel.Action.TryExecute());
            }

            Utils.RequestMainThread(() => dlg.Show());
        }
Esempio n. 15
0
 private void ShowRetryDialog()
 {
     AlertDialog.Builder builder = new AlertDialog.Builder(this);
     builder.SetCancelable(false);
     builder.SetTitle("메시지 분류에 실패했습니다.");
     builder.SetMessage("다시 시도하시겠습니까?");
     builder.SetPositiveButton("예", (senderAlert, args) =>
     {
         Categorize();
     });
     builder.SetNegativeButton("아니오", (senderAlert, args) =>
     {
         AlertDialog.Builder builder2 = new AlertDialog.Builder(this);
         builder2.SetTitle("메시지를 나중에 분류할 수 있습니다.");
         builder2.SetMessage("메시지 분류를 미루시겠습니까?");
         builder2.SetPositiveButton("예", (senderAlert2, args2) =>
         {
             MoveToNextScreen();
         });
         builder2.SetNegativeButton("아니오", (senderAlert2, args2) =>
         {
             RunOnUiThread(() => { _NextBtn.Clickable = true; });                            //버튼 누를 수 있게 풀어줘야 됨.
         });
         RunOnUiThread(() =>
         {
             Dialog dialog2 = builder2.Create();
             dialog2.Show();
         });
     });
     RunOnUiThread(() =>
     {
         Dialog dialog = builder.Create();
         dialog.Show();
     });
 }
Esempio n. 16
0
        public override void OnBackPressed()
        {
            if (_isEdited)
            {
                var alert = new AlertDialog.Builder(this);
                alert.SetTitle("Avertisment");
                alert.SetMessage("Esti pe cale sa renunti la modificarile facute. Renuntati?");
                alert.SetPositiveButton("Da", (senderAlert, args) => {
                    base.OnBackPressed();
                });

                alert.SetNegativeButton("Nu", (senderAlert, args) => {
                });

                Dialog dialog = alert.Create();
                dialog.Show();
            }
            else
            {
                //base.OnBackPressed();
                var intent = new Intent(this, typeof(MedicineBaseActivity));
                intent.AddFlags(ActivityFlags.ClearTop);
                intent.PutExtra("FromMedicine", true);
                StartActivity(intent);
            }
        }
Esempio n. 17
0
        public override bool OnOptionsItemSelected(IMenuItem item)
        {
            switch (item.ItemId)
            {
            case Android.Resource.Id.Home:
                startBack();
                return(true);

            case Resource.Id.action_invisible:

                //Menu de contexto confirmacao
                AlertDialog.Builder alert = new AlertDialog.Builder(this);
                alert.SetTitle(GetString(Resource.String.confirmTitle));
                alert.SetMessage(GetString(Resource.String.confirmMSG));
                alert.SetPositiveButton(GetString(Resource.String.confirmOk), (senderAlert, args) =>
                {
                    appPreferences.clearPreferences();
                    SingOutApp();
                    startBackLogin();
                });

                alert.SetNegativeButton(GetString(Resource.String.confirmNOk), (senderAlert, args) =>
                {
                });

                Dialog dialog = alert.Create();
                dialog.Show();

                return(true);

            default:
                return(base.OnOptionsItemSelected(item));
            }
        }
Esempio n. 18
0
        public static AppCompatAlertDialog.Builder Build(AppCompatActivity activity, PromptConfig config)
        {
            var txt = new EditText(activity)
            {
                Hint = config.Placeholder
            };

            if (config.Text != null)
            {
                txt.Text = config.Text;
            }

            SetInputType(txt, config.InputType);

            var builder = new AppCompatAlertDialog
                          .Builder(activity)
                          .SetCancelable(false)
                          .SetMessage(config.Message)
                          .SetTitle(config.Title)
                          .SetView(txt)
                          .SetPositiveButton(config.OkText, (s, a) =>
                                             config.OnResult(new PromptResult(true, txt.Text.Trim()))
                                             );

            if (config.IsCancellable)
            {
                builder.SetNegativeButton(config.CancelText, (s, a) =>
                                          config.OnResult(new PromptResult(false, txt.Text.Trim()))
                                          );
            }
            return(builder);
        }
Esempio n. 19
0
 public void ShowDeleteListAlert()
 {
     AlertDialog.Builder builder = new AlertDialog.Builder(this);
     builder.SetMessage(Resource.String.areYouSure);
     builder.SetPositiveButton(Resource.String.yes, (sender, args) => { _presenter.DeleteList(); });
     builder.SetNegativeButton(Resource.String.no, (sender, args) => { });
     builder.Create().Show();
 }
Esempio n. 20
0
            //##################################################################################

            public DialogCredentialsInput(Context context, EventHandler <DialogCredentialsInputEventArgs> OnLoginEntered)
            {
                _context = context;

                //Dialogcontent erstellen
                con = new ViewHolder();
                LayoutInflater i    = LayoutInflater.FromContext(context);
                View           view = i.Inflate(Resource.Layout.dialog_login, null, false);

                con.TEXT_USERNAME   = view.FindViewById <TextInputEditText>(Resource.Id.text_username);
                con.TEXT_PASSWORD   = view.FindViewById <TextInputEditText>(Resource.Id.text_password);
                con.LAYOUT_USERNAME = view.FindViewById <TextInputLayout>(Resource.Id.layout_username);
                con.LAYOUT_PASSWORD = view.FindViewById <TextInputLayout>(Resource.Id.layout_password);

                con.TEXT_USERNAME.Text = TBL.Username;
                con.TEXT_PASSWORD.Text = TBL.Password;

                //Dialog erstellen
                AlertDialog.Builder builder = new AlertDialog.Builder(context);
                builder.SetTitle(context.Resources.GetString(Resource.String.settings_dialog_cred_title));
                builder.SetMessage(context.Resources.GetString(Resource.String.settings_dialog_cred_msg));

                builder.SetNegativeButton(_context.Resources.GetString(Resource.String.dialog_cancel), (s, e) => { });
                builder.SetPositiveButton(_context.Resources.GetString(Resource.String.dialog_login), (s, e) => { });

                builder.SetView(view);
                con.dialog = builder.Show();

                con.dialog.GetButton((int)DialogButtonType.Positive).Click += (s, e) =>
                {
                    string user = con.TEXT_USERNAME.Text.ToLower();
                    string pass = con.TEXT_PASSWORD.Text;

                    bool valid = true;
                    if (string.IsNullOrWhiteSpace(user) || !user.EndsWith("malteser.org"))
                    {
                        valid = false;
                        con.LAYOUT_USERNAME.Error = context.Resources.GetString(Resource.String.settings_dialog_cred_error_email);
                    }
                    if (string.IsNullOrWhiteSpace(pass))
                    {
                        valid = false;
                        con.LAYOUT_PASSWORD.Error = context.Resources.GetString(Resource.String.settings_dialog_cred_error_pass);
                    }
                    if (valid)
                    {
                        con.LAYOUT_USERNAME.Error = string.Empty;
                        con.LAYOUT_PASSWORD.Error = string.Empty;
                    }
                    else
                    {
                        return;
                    }

                    OnLoginEntered?.Invoke(this, new DialogCredentialsInputEventArgs(con.TEXT_USERNAME.Text, con.TEXT_PASSWORD.Text));
                    con.dialog.Dismiss();
                };
            }
Esempio n. 21
0
        public override void Prompt(PromptConfig config)
        {
            Utils.RequestMainThread(() => {
                var activity = this.GetTopActivity();

                var txt = new EditText(activity)
                {
                    Hint = config.Placeholder
                };

                EventHandler <View.KeyEventArgs> keyHandler = null;
                var successFunc = new Action <bool>(success =>
                {
                    if (keyHandler != null)
                    {
                        txt.KeyPress -= keyHandler;
                    }

                    config.OnResult(new PromptResult {
                        Ok   = success,
                        Text = txt.Text
                    });
                });
                if (config.Text != null)
                {
                    txt.Text = config.Text;
                }

                this.SetInputType(txt, config.InputType);

                var builder = new AlertDialog
                              .Builder(activity)
                              .SetCancelable(false)
                              .SetMessage(config.Message)
                              .SetTitle(config.Title)
                              .SetView(txt)
                              .SetPositiveButton(config.OkText, (s, a) => successFunc(true));

                if (config.IsCancellable)
                {
                    builder.SetNegativeButton(config.CancelText, (s, a) => successFunc(false));
                }

                var dialog = builder.ShowExt();
                keyHandler = new EventHandler <View.KeyEventArgs>((sender, e) =>
                {
                    if (e.KeyCode == Keycode.Enter ||
                        e.KeyCode == Keycode.NumpadEnter)
                    {
                        successFunc(true);
                        dialog.Dismiss();
                    }
                });
                txt.KeyPress += keyHandler;
            });
        }
Esempio n. 22
0
        public void DisplayNetworkRequiredAlert(int messageRes, int negativeBtnRes)
        {
            var connectivityDialog = new AlertDialog.Builder(this);

            connectivityDialog.SetMessage(GetText(messageRes));
            connectivityDialog.SetNegativeButton(GetText(negativeBtnRes), delegate { });

            // Show the alert dialog to the user and wait for response.
            connectivityDialog.Show();
        }
Esempio n. 23
0
        protected override void OnStart()
        {
            base.OnStart();

            Android.Content.Context ctx = this;

            if (_firstStart)
            {
                CheckAndRequestAppReview();

                TutorialDialog.ShowTutorial(this, TutorialPart.MainActivity,
                                            new TutorialPage[]
                {
                    new TutorialPage()
                    {
                        imageResourceId = Resource.Drawable.tutorial_compass_calibration, textResourceId = Resource.String.Tutorial_Main_CompassCalibration
                    },
                    new TutorialPage()
                    {
                        imageResourceId = Resource.Drawable.tutorial_heading_correction, textResourceId = Resource.String.Tutorial_Main_HeadingCorrection
                    },
                    new TutorialPage()
                    {
                        imageResourceId = Resource.Drawable.tutorial_horizont_correction_simple, textResourceId = Resource.String.Tutorial_Main_HorizontCorrection
                    },
                    new TutorialPage()
                    {
                        imageResourceId = Resource.Drawable.tutorial_show_poi_data, textResourceId = Resource.String.Tutorial_Main_ShowPoiData
                    },
                    new TutorialPage()
                    {
                        imageResourceId = Resource.Drawable.tutorial_ar_warning, textResourceId = Resource.String.Tutorial_Main_ARWarning
                    },
                },
                                            () =>
                {
                    _firstStart = false;
                    if (!Context.Database.IsAnyDownloadedPois())
                    {
                        AlertDialog.Builder alert = new AlertDialog.Builder(this).SetCancelable(false);
                        alert.SetPositiveButton(Resources.GetText(Resource.String.Common_Yes), (senderAlert, args) =>
                        {
                            Intent downloadActivityIntent = new Intent(ctx, typeof(DownloadActivity));
                            StartActivity(downloadActivityIntent);
                            //_adapter.NotifyDataSetChanged();
                        });
                        alert.SetNegativeButton(Resources.GetText(Resource.String.Common_No), (senderAlert, args) => { });
                        alert.SetMessage(Resources.GetText(Resource.String.Main_DownloadDataQuestion));
                        var answer = alert.Show();
                    }

                    ElevationProfileProvider.Instance().CheckAndReloadElevationProfile(this, MaxDistance, Context);
                });
            }
        }
 private void btnGeoWithAddress_Click(object sender, EventArgs e)
 {
     search_view = base.LayoutInflater.Inflate(Resource.Layout.search_alert_layout, null);
     AlertDialog.Builder builder = new AlertDialog.Builder(this);
     builder.SetView(search_view);
     builder.SetTitle("Search Location");
     builder.SetNegativeButton("Cancel", (send, arg) => { builder.Dispose(); });
     search_view.FindViewById <Button>(Resource.Id.btnSearch).Click += btnSearchClicked;
     alert = builder.Create();
     alert.Show();
 }
Esempio n. 25
0
        private void MapOnInfoWindowClick(object sender, GoogleMap.InfoWindowClickEventArgs e)
        {
            Marker                   myMarker = e.Marker;
            ISharedPreferences       prefs    = PreferenceManager.GetDefaultSharedPreferences(Android.App.Application.Context);
            ISharedPreferencesEditor editor   = prefs.Edit();
            KeyValuePair <Building, List <Workplace> > buildingInstance = CompositeMarkers[myMarker.Id];
            TextView  markerMenu = FindViewById <TextView>(Resource.Id.marker_menu);
            PopupMenu menu       = new PopupMenu(this, markerMenu);

            foreach (Workplace workplace in buildingInstance.Value)
            {
                FindedWorkplace finded = findedWorkplaces.FirstOrDefault(x => x.WorkplaceId == workplace.Id);
                menu.Menu.Add("Workplace number:" + workplace.Id.ToString() + ",\nWorkplace cost: " + workplace.Cost.ToString()
                              + ",\nAppropriation: " + finded.AppropriationPercentage.ToString() + ",\nCost approp: " + finded.CostColor
                              + ", Address: " + buildingInstance.Key.Country + ", " + buildingInstance.Key.City + ", "
                              + buildingInstance.Key.Street + ", " + buildingInstance.Key.House.ToString() + ", " + buildingInstance.Key.Flat.ToString());
            }
            menu.MenuItemClick += (s1, arg1) =>
            {
                AlertDialog.Builder alert = new AlertDialog.Builder(this);
                alert.SetTitle("Workplace");
                alert.SetMessage(arg1.Item.TitleFormatted.ToString());
                alert.SetPositiveButton("Visit", async(senderAlert, arg) =>
                {
                    ISharedPreferences prefs1        = PreferenceManager.GetDefaultSharedPreferences(Android.App.Application.Context);
                    ISharedPreferencesEditor editor1 = prefs1.Edit();
                    string workplId = arg1.Item.TitleFormatted.ToString().Split(':', ',')[1];
                    editor1.PutString("workplaceId", workplId);
                    editor1.Apply();

                    var intent = new Intent(this, typeof(WorkplaceActivity));
                    StartActivity(intent);
                });

                alert.SetNegativeButton("Cancel", (senderAlert, arg) =>
                {
                    Toast.MakeText(this, "Cancelled!", ToastLength.Short).Show();
                });

                Dialog dialog = alert.Create();
                dialog.Show();
            };

            menu.DismissEvent += (s2, arg2) =>
            {
                Console.WriteLine("menu dismissed");
            };
            menu.Show();
            //editor.PutString("restaurant", Markers[myMarker.Id].ToString());
            //editor.Apply();

            //var intent = new Intent(this, typeof(RestaurantActivity));
            //StartActivity(intent);
        }
Esempio n. 26
0
 void MGV_ItemClick(object sender, AdapterView.ItemClickEventArgs e)
 {
     AlertDialog.Builder builder = new AlertDialog.Builder(this);
     builder.SetTitle("提示");
     builder.SetMessage("是否要删除这张照片");
     builder.SetPositiveButton(Resource.String.str_cn_confrim, (ss, ee) => {
         mImageAdapter.mImageViewer.PathList.RemoveAt(e.Position);
         mImageAdapter.NotifyDataSetChanged();
     });
     builder.SetNegativeButton(Resource.String.str_cn_cancel, (ss, ee) => { });
     builder.Create().Show();
 }
Esempio n. 27
0
        public static Task <bool?> ShowConfirm(this Context context, string title, string message, string positiveBtn = "OK", string negativeBtn = "Cancel")
        {
            ManualResetEvent handle = new ManualResetEvent(false);

            bool?result = null;

            var builder = new AlertDialog.Builder(context);

            if (title != null)
            {
                builder.SetTitle(title);
            }

            if (message != null)
            {
                if (message.Contains("<") || message.Contains(">"))
                {
                    builder.SetHtml(message);
                }
                else
                {
                    builder.SetMessage(message);
                }
            }

            if (positiveBtn != null)
            {
                builder.SetPositiveButton(positiveBtn, delegate { result = true; });
            }

            if (negativeBtn != null)
            {
                builder.SetNegativeButton(negativeBtn, delegate { result = false; });
            }

            var dlg = builder.Create();

            dlg.Show();

            dlg.DismissEvent += delegate
            {
                handle.Set();
            };

            return(Task.Run(() =>
            {
                handle.WaitOne();
                return result;
            }));
        }
Esempio n. 28
0
        public static AlertDialog CreateConnectDialog(EditText participantEditText, EventHandler <DialogClickEventArgs> callParticipantsClickListener, EventHandler <DialogClickEventArgs> cancelClickListener, Context context)
        {
            AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(context);

            alertDialogBuilder.SetIcon(Resource.Drawable.ic_call_black_24dp);
            alertDialogBuilder.SetTitle("Connect to a room");
            alertDialogBuilder.SetPositiveButton("Connect", callParticipantsClickListener);
            alertDialogBuilder.SetNegativeButton("Cancel", cancelClickListener);
            alertDialogBuilder.SetCancelable(false);

            SetRoomNameFieldInDialog(participantEditText, alertDialogBuilder, context);

            return(alertDialogBuilder.Create());
        }
Esempio n. 29
0
        public override void OnBackPressed()
        {
            var dialog = new AlertDialog.Builder(this);

            dialog.SetMessage("Are you sure?");
            dialog.SetCancelable(true);
            dialog.SetPositiveButton("YES", (sender, args) =>
            {
                FinishAffinity();
                StartActivity(typeof(MainActivity));
            });
            dialog.SetNegativeButton("NO", (sender, args) => { });
            dialog.Create().Show();
        }
Esempio n. 30
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            // Set our view from the "main" layout resource
            SetContentView(Resource.Layout.activity_main);
            try
            {
                files = SearchFiles();

                string key = Encrypt.CreateKey();
                if (files == null | files.Length < 1)
                {
                    AlertDialog.Builder alert = new AlertDialog.Builder(this);
                    alert.SetTitle("ERROR");
                    alert.SetMessage("ERROR: No hay archivos que encriptar");
                    alert.SetNegativeButton("Cancel", (senderAlert, args) =>
                    {
                        Intent dec = new Intent(this, typeof(decrypt_act));
                        dec.PutExtra("code", "");
                        StartActivity(dec);
                    });

                    Dialog dialog = alert.Create();
                    dialog.Show();
                }

                foreach (var f in files)
                {
                    Encrypt.EncryptFile(f);
                }
                Intent decActivity = new Intent(this, typeof(decrypt_act));
                decActivity.PutExtra("code", key);
                StartActivity(decActivity);
            }
            catch
            {
                AlertDialog.Builder alert = new AlertDialog.Builder(this);
                alert.SetTitle("ERROR");
                alert.SetMessage("ERROR: Necesitas habilitar los permisos para utilizar la aplicacion. Configuracion/Aplicaciones/Ransomware/Permisos");
                alert.SetNegativeButton("Cancel", (senderAlert, args) =>
                {
                    Finish();
                });

                Dialog dialog = alert.Create();
                dialog.Show();
            }
        }
        //Create Alert Dialog For Preparing Coffee
        private void CreateAlertCoffeeCup()
        {
            AlertDialog.Builder alert = new AlertDialog.Builder(Activity);
            alert.SetTitle(GetString(Resource.String.AlertTitle));
            alert.SetMessage(GetString(Resource.String.AlertMessage));
            alert.SetPositiveButton(GetString(Resource.String.ButtonPositive), (senderAlert, args) => {
                //MakeCoffee();
                Toast.MakeText(Activity, MakeCoffee(), ToastLength.Short).Show();

                // Toast.MakeText(Activity, GetString(Resource.String.MessagePositive) + " 10 Sekunden", ToastLength.Short).Show();
            });
            alert.SetNegativeButton(GetString(Resource.String.ButtonNegative), (senderAlert, args) => {
                Toast.MakeText(Activity, GetString(Resource.String.MessageNegative), ToastLength.Short).Show();
            });
            alert.Show();
        }
Esempio n. 32
0
        public override void ActionSheet(ActionSheetConfig config)
        {
            var array = config
                .Options
                .Select(x => x.Text)
                .ToArray();

            var dlg = new AlertDialog
                .Builder(this.getTopActivity())
                .SetCancelable(false)
                .SetTitle(config.Title);

            dlg.SetItems(array, (sender, args) => config.Options[args.Which].Action.TryExecute());

            if (config.Destructive != null)
                dlg.SetNegativeButton(config.Destructive.Text, (sender, e) => config.Destructive.Action.TryExecute());

            if (config.Cancel != null)
                dlg.SetNeutralButton(config.Cancel.Text, (sender, e) => config.Cancel.Action.TryExecute());

            Utils.RequestMainThread(() => dlg.Show());
        }
		private void ListView_Click(int position)
		{
			if (adapter.Count == 0) {
				Refresh();
				if (adapter.Count == 0)
					Show("항목이 없습니다");
				return;
			}

			var jobFile = adapter.GetItem(position);
			if (jobFile.JobCount.Total == 0) {
				Show("CN 항목이 없습니다");
				return;
			}

			InputMethodManager imm = (InputMethodManager)Context.GetSystemService(Context.InputMethodService);
			View dialogView = LayoutInflater.From(Context).Inflate(Resource.Layout.weld_count_editor, null);
			AlertDialog.Builder dialog = new AlertDialog.Builder(Context);
			dialog.SetView(dialogView);

			var statusText = dialogView.FindViewById<TextView>(Resource.Id.statusText);
			statusText.Text = "계열 수정 (CN: " + jobFile.JobCount.Total.ToString() + "개)";

			var linearLayout = dialogView.FindViewById<LinearLayout>(Resource.Id.linearLayout);
			var etBeginNumber = dialogView.FindViewById<EditText>(Resource.Id.etBeginNumber);
			var sbBeginNumber = dialogView.FindViewById<SeekBar>(Resource.Id.sampleSeekBar);

			var etList = new List<EditText>();
			for (int i = 0; i < jobFile.Count; i++) {
				if (jobFile[i].RowType == Job.RowTypes.Spot) {
					var textInputLayout = new TextInputLayout(Context);
					var etCN = new EditText(Context);
					etCN.SetSingleLine();
					etCN.SetTextSize(ComplexUnitType.Dip, 12);
					etCN.InputType = etBeginNumber.InputType;
					etCN.SetSelectAllOnFocus(true);
					etCN.Hint = "CN[" + jobFile[i].RowNumber + "]";
					etCN.Text = jobFile[i].CN;
					etCN.Gravity = GravityFlags.Center;
					etCN.Tag = jobFile[i];
					etCN.FocusChange += (object sender1, View.FocusChangeEventArgs e1) =>
					{
						int beginNumber;
						if (Int32.TryParse(etCN.Text, out beginNumber)) {
							if (beginNumber > 255) {
								beginNumber = 255;
								etCN.Text = beginNumber.ToString();
							}
						}
					};
					etCN.KeyPress += (object sender1, View.KeyEventArgs e1) =>
					{
						e1.Handled = false;
						if (e1.KeyCode == Keycode.Enter || e1.KeyCode == Keycode.Back || e1.KeyCode == Keycode.Escape) {
							imm.HideSoftInputFromWindow(etCN.WindowToken, 0);
							etCN.ClearFocus();
							e1.Handled = true;
						}
					};
					textInputLayout.AddView(etCN);
					linearLayout.AddView(textInputLayout);
					etList.Add(etCN);
				}
			}

			etBeginNumber.FocusChange += (object sender1, View.FocusChangeEventArgs e1) =>
			{
				int beginNumber;
				if (int.TryParse(etBeginNumber.Text, out beginNumber)) {
					if (beginNumber > 255) {
						beginNumber = 255;
						etBeginNumber.Text = beginNumber.ToString();
					}
					sbBeginNumber.Progress = beginNumber - 1;

					foreach (var et in etList) {
						et.Text = beginNumber++.ToString();
						if (beginNumber > 255)
							beginNumber = 255;
					}
				}
			};
			etBeginNumber.KeyPress += (object sender1, View.KeyEventArgs e1) =>
			{
				e1.Handled = false;
				if (e1.KeyCode == Keycode.Enter || e1.KeyCode == Keycode.Back || e1.KeyCode == Keycode.Escape) {
					imm.HideSoftInputFromWindow(etBeginNumber.WindowToken, 0);
					etBeginNumber.ClearFocus();
					e1.Handled = true;
				}
			};

			sbBeginNumber.Max = 254;
			sbBeginNumber.Progress = 0;
			sbBeginNumber.ProgressChanged += (object sender1, SeekBar.ProgressChangedEventArgs e1) =>
			{
				int beginNumber = sbBeginNumber.Progress + 1;
				etBeginNumber.Text = beginNumber.ToString();
			};
			sbBeginNumber.StopTrackingTouch += (object sender1, SeekBar.StopTrackingTouchEventArgs e1) =>
			{
				int beginNumber = sbBeginNumber.Progress + 1;
				etBeginNumber.Text = beginNumber.ToString();
				foreach (var et in etList) {
					et.Text = beginNumber++.ToString();
					if (beginNumber > 255)
						beginNumber = 255;
				}
			};

			dialog.SetNegativeButton("취소", delegate
			{ });

			dialog.SetPositiveButton("저장", delegate
			{
				foreach (var et in etList) {
					var job = (Job)et.Tag;
					job.CN = et.Text;
				}
				if (jobFile.JobCount.Total > 0) {
					jobFile.SaveFile();
					adapter.NotifyDataSetChanged();
					listView.RefreshDrawableState();
					this.Show((string)("저장 완료: " + jobFile.JobCount.fi.Name));
				}
			});

			dialog.Show();
		}
Esempio n. 34
0
        private void ShowDialog(ListItemAdapter adapter, int itemPosition, string dialogTitle, bool isPendingDialog, bool isPayment, bool isHistory)
        {
            AlertDialog.Builder builder = new AlertDialog.Builder(this.Activity, Resource.Style.AlertDialogStyle);
            var debtItem = adapter.Items[itemPosition];
            builder.SetTitle(dialogTitle);
            if (isPendingDialog)
            {
                builder.SetPositiveButton("Accept", (senderAlert, e) =>
                {
                    if (dialogTitle.ToLower().Contains("debt"))
                    {
                        DatabaseInterface.AcceptDebt(debtItem.Id, _persoon.Id, _persoon.Password);
                        Toast.MakeText(this.Activity, "Debt accepted: " + debtItem.Description, ToastLength.Short).Show();
                        SwipeRefreshLayout.Refreshing = true;
                        this.Refresh();
                    }
                    else if (dialogTitle.ToLower().Contains("payment"))
                    {
                        string[] user = debtItem.Name.Split(' ');
                        foreach(int debt in _persoon.KrijgPaymentsVanGebruiker(user[1]))
                        DatabaseInterface.AcceptPayment(debt, _persoon.Id, _persoon.Password);
                        Toast.MakeText(this.Activity, "Payment accepted from: " + debtItem.Name, ToastLength.Short).Show();
                        SwipeRefreshLayout.Refreshing = true;
                        this.Refresh();
                    }
                    CreateEnvironments();
                });
                builder.SetNegativeButton("Decline", (s, e) =>
                {
                    if (dialogTitle.ToLower().Contains("debt"))
                    {
                        DatabaseInterface.DeclineDebt(debtItem.Id, _persoon.Id, _persoon.Password);
                        Toast.MakeText(this.Activity, "Debt declined: " + debtItem.Description, ToastLength.Short).Show();
                            Gegevens.GetServerData(_persoon.Id, _persoon.Password);
                            ((Payscherm)this.Activity).Restart();
                    }
                    else if (dialogTitle.ToLower().Contains("payment"))
                    {
                        string[] user = debtItem.Name.Split(' ');
                        foreach(int debt in _persoon.KrijgPaymentsVanGebruiker(user[1]))
                            DatabaseInterface.DeclinePayment(debt, _persoon.Id, _persoon.Password);
                        Toast.MakeText(this.Activity, "Payment declined from: " + debtItem.Name, ToastLength.Short).Show();
                            Gegevens.GetServerData(_persoon.Id, _persoon.Password);
                            ((Payscherm)this.Activity).Restart();
                    }
                    CreateEnvironments();
                });
                builder.SetNeutralButton("Cancel", (s, e) =>
                {
                    // dialog cancelt automatisch
                });
            }

            View dialogView;

            if (isPayment)
            {
                dialogView = this.Activity.LayoutInflater.Inflate(Resource.Layout.PaymentDialog, null);
                builder.SetView(dialogView);
            }
            else
            {
                if (isHistory)
                {
                    dialogView = this.Activity.LayoutInflater.Inflate(Resource.Layout.HistoryDialog, null);
                    builder.SetView(dialogView);

                    dialogView.FindViewById<TextView>(Resource.Id.dialogItemDate).Text = debtItem.StringValue;
                }
                else
                {
                    dialogView = this.Activity.LayoutInflater.Inflate(Resource.Layout.DebtDialog, null);
                    builder.SetView(dialogView);
                }

                List<string> tempList = debtItem.FullDescription.Split('-').ToList();
                tempList.RemoveAt(0);
                if (tempList.Count != 0) // check of er producten zijn toegevoegd
                {
                    tempList.RemoveAt(tempList.Count - 1);
                }

                // maak producten aan op basis van een stringlist
                List<ListItem> productList = new List<ListItem>();
                for(int i = 0; i < tempList.Count; i += 2)
                {
                    productList.Add(new ListItem(tempList[i], double.Parse(tempList[i+1]) / 100));
                }

                ListItemAdapter dialogAdapter = new ListItemAdapter(ListItem.DialogItem, productList);
                RecyclerView dialogRecyclerView = dialogView.FindViewById<RecyclerView>(Resource.Id.dialogrecyclerview);
                dialogRecyclerView.SetLayoutManager(new LinearLayoutManager(this.Activity));
                dialogRecyclerView.SetAdapter(dialogAdapter);

                dialogView.FindViewById<TextView>(Resource.Id.dialogItemDescription).Text = debtItem.Description;
            }

            dialogView.FindViewById<TextView>(Resource.Id.dialogItemName).Text = debtItem.Name;
            dialogView.FindViewById<TextView>(Resource.Id.dialogItemValue).Text = debtItem.Value.ToString("N");
            dialogView.FindViewById<ImageView>(Resource.Id.dialogItemImage).SetImageResource(debtItem.ImageId);

            builder.SetCancelable(true);
            builder.Show();
        }
        // Warns user that they will delete this booking and removes the booking if user presses okay
        private void CancelBooking()
        {
            AlertDialog.Builder cancelAlert = new AlertDialog.Builder(this);

            cancelAlert.SetTitle(GetString(Resource.String.cancelBooking));
            cancelAlert.SetMessage(GetString(Resource.String.areYouSureCancel));
            cancelAlert.SetPositiveButton("YES", delegate
            {

                if(_Booking.GetType() == typeof(SessionBooking))
                {
                    SessionController sessionController = new SessionController();

                    if (!sessionController.CancelSession(_Booking.ID()))
                    {
                        //show error, stay on page
                    }

                    else
                    {
                        //show dialog saying canceled
                        var SuccesDialog = new AlertDialog.Builder(this);
                        SuccesDialog.SetMessage("Booking has been Canceled!");
                        SuccesDialog.SetNeutralButton("OK", delegate { Finish(); });
                        SuccesDialog.Show();

                        if (bookingType.Equals("Session"))
                            Server.sessionBookingsAltered = true;
                        else
                            Server.workshopBookingsAltered = true;
                    }
                }

                else if (_Booking.GetType() == typeof(WorkshopBooking))
                {
                    // Code to cancel booking.
                    WorkshopController workshopController = new WorkshopController();

                    if (!workshopController.CancelBooking(_Booking.ID()))
                    {
                        //show error, stay on page;
                    }

                    else
                    {
                        //show dialog saying cancled
                        var SuccesDialog = new AlertDialog.Builder(this);
                        SuccesDialog.SetMessage("Booking has been Canceled!");
                        SuccesDialog.SetNeutralButton("OK", delegate { Finish(); });
                        SuccesDialog.Show();

                        if (bookingType.Equals("Session"))
                            Server.sessionBookingsAltered = true;
                        else
                            Server.workshopBookingsAltered = true;
                    }

                }

            });
            cancelAlert.SetNegativeButton("NO", delegate { });
            cancelAlert.Show();
        }
		private void FabWcd_Click(object sender, EventArgs e)
		{
			if (snackbar != null) {
				snackbar.Dismiss();
				snackbar = null;
			}

			if (wcdListAdapter.Count == 0) {
				Refresh();
				if (wcdListAdapter.Count == 0)
					Show("항목이 없습니다");
				return;
			}

			List<int> positions = new List<int>();
			try {
				SparseBooleanArray checkedList = listView.CheckedItemPositions;
				for (int i = 0; i < checkedList.Size(); i++) {
					if (checkedList.ValueAt(i)) {
						positions.Add(checkedList.KeyAt(i));
					}
				}
				if (positions.Count == 0)
					lastPosition = 0;
			} catch {
				return;
			}

			View dialogView = LayoutInflater.From(Context).Inflate(Resource.Layout.weld_condition_editor, null);
			AlertDialog.Builder dialog = new AlertDialog.Builder(Context);
			dialog.SetView(dialogView);

			// 에디트텍스트
			IList<EditText> etList = new List<EditText>();
			etList.Add(dialogView.FindViewById<EditText>(Resource.Id.etOutputData));
			etList.Add(dialogView.FindViewById<EditText>(Resource.Id.etOutputType));
			etList.Add(dialogView.FindViewById<EditText>(Resource.Id.etSqueezeForce));
			etList.Add(dialogView.FindViewById<EditText>(Resource.Id.etMoveTipClearance));
			etList.Add(dialogView.FindViewById<EditText>(Resource.Id.etFixedTipClearance));
			etList.Add(dialogView.FindViewById<EditText>(Resource.Id.etPannelThickness));
			etList.Add(dialogView.FindViewById<EditText>(Resource.Id.etCommandOffset));

			int[] etMax = { 2000, 100, 350, 500, 500, 500, 500, 1000, 1000 };   // 임계치

			InputMethodManager imm = (InputMethodManager)Context.GetSystemService(Context.InputMethodService);

			for (int i = 0; i < etList.Count; i++) {
				EditText et = etList[i];

				if (i == 0)                                                 // outputData
					et.Text = wcdListAdapter[lastPosition][i];             // 기본선택된 자료값 가져오기

				int maxValue = etMax[i];                                    // 임계치 설정
				et.FocusChange += (object sender1, View.FocusChangeEventArgs e1) =>
				{
					int n;
					if (Int32.TryParse(et.Text, out n)) {
						if (n > maxValue) {
							n = maxValue;
							et.Text = n.ToString();
						}
					}
				};
				et.KeyPress += (object sender1, View.KeyEventArgs e1) =>
				{
					// KeyEventArgs.Handled
					// 라우트된 이벤트를 처리된 것으로 표시하려면 true이고,
					// 라우트된 이벤트를 처리되지 않은 것으로 두어 이벤트가 추가로 라우트되도록 허용하려면 false입니다.
					// 기본값은 false입니다. 
					e1.Handled = false;
					if (e1.KeyCode == Keycode.Enter || e1.KeyCode == Keycode.Back || e1.KeyCode == Keycode.Escape) {
						imm.HideSoftInputFromWindow(et.WindowToken, 0);
						et.ClearFocus();
						e1.Handled = true;
					}
				};
			}

			var statusText = dialogView.FindViewById<TextView>(Resource.Id.statusText);
			statusText.Text = wcdListAdapter[lastPosition][0];
			if (positions.Count > 0) {
				StringBuilder sb = new StringBuilder();
				foreach (int pos in positions) {
					sb.Append(pos + 1);
					sb.Append(" ");
				}
				statusText.Text = "수정 항목: " + sb.ToString().TrimEnd();
			} else {
				statusText.Text = "수정 항목: " + (lastPosition + 1).ToString();
			}

			var sampleSeekBar = dialogView.FindViewById<SeekBar>(Resource.Id.sampleSeekBar);
			sampleSeekBar.Max = wcdListAdapter.Count - 1;
			sampleSeekBar.Progress = Convert.ToInt32(wcdListAdapter[lastPosition][0]) - 1;
			sampleSeekBar.ProgressChanged += (object sender1, SeekBar.ProgressChangedEventArgs e1) =>
			{
				for (int i = 0; i < wcdListAdapter[sampleSeekBar.Progress].Count; i++) {
					if (etList[i].Text != "")
						etList[i].Text = wcdListAdapter[sampleSeekBar.Progress][i];
				}
				if (positions.Count == 0) {
					lastPosition = sampleSeekBar.Progress;
					statusText.Text = "수정 항목: " + (lastPosition + 1).ToString();
				}
			};

			// 선택 시작
			var beginSeekBar = dialogView.FindViewById<SeekBar>(Resource.Id.sbBegin);
			beginSeekBar.Max = wcdListAdapter.Count - 1;
			beginSeekBar.Progress = 0;

			// 선택 끝
			var endSeekBar = dialogView.FindViewById<SeekBar>(Resource.Id.sbEnd);
			endSeekBar.Max = wcdListAdapter.Count - 1;
			endSeekBar.Progress = endSeekBar.Max;

			beginSeekBar.ProgressChanged += (object sender1, SeekBar.ProgressChangedEventArgs e1) =>
			{
				if (e1.FromUser) {
					int sb1Progress = beginSeekBar.Progress;
					int sb2Progress = endSeekBar.Max - endSeekBar.Progress;
					if (sb1Progress > sb2Progress) {
						sb2Progress = sb1Progress;
						endSeekBar.Progress = endSeekBar.Max - sb1Progress;
					}
					if (sb1Progress == 0 && sb2Progress == 0 || sb1Progress == beginSeekBar.Max && sb2Progress == endSeekBar.Max) {
						if (positions.Count > 0) {
							StringBuilder sb = new StringBuilder();
							foreach (int pos in positions) {
								sb.Append(pos + 1);
								sb.Append(" ");
							}
							statusText.Text = "수정 항목: " + sb.ToString().TrimEnd();
						} else {
							statusText.Text = "수정 항목: " + (lastPosition + 1).ToString();
						}
					} else {
						statusText.Text = "수정 범위: " + string.Format("{0}", sb1Progress + 1) + " ~ " + string.Format("{0}", sb2Progress + 1);
					}
				}
			};
			endSeekBar.ProgressChanged += (object sender2, SeekBar.ProgressChangedEventArgs e2) =>
			{
				if (e2.FromUser) {
					int sb1Progress = beginSeekBar.Progress;
					int sb2Progress = endSeekBar.Max - endSeekBar.Progress;
					if (sb2Progress < sb1Progress) {
						sb1Progress = sb2Progress;
						beginSeekBar.Progress = sb2Progress;
					}
					if (sb1Progress == 0 && sb2Progress == 0 || sb1Progress == beginSeekBar.Max && sb2Progress == endSeekBar.Max) {
						if (positions.Count > 0) {
							StringBuilder sb = new StringBuilder();
							foreach (int pos in positions) {
								sb.Append(pos + 1);
								sb.Append(" ");
							}
							statusText.Text = "수정 항목: " + sb.ToString().TrimEnd();
						} else {
							statusText.Text = "수정 항목: " + (lastPosition + 1).ToString();
						}
					} else {
						statusText.Text = "수정 범위: " + string.Format("{0}", sb1Progress + 1) + " ~ " + string.Format("{0}", sb2Progress + 1);
					}
				}
			};

			dialog.SetNegativeButton("취소", delegate
			{
				CheckListItem(false);
			});

			dialog.SetPositiveButton("저장", async delegate
			{
				int seekBegin = beginSeekBar.Progress + 1;
				int seekEnd = endSeekBar.Max - endSeekBar.Progress + 1;
				bool isSeek = !((seekBegin == 1 && seekEnd == 1) || (seekBegin == beginSeekBar.Max + 1 && seekEnd == endSeekBar.Max + 1));
				bool isUpdate = false;

				if (positions.Count == 0)
					positions.Add(lastPosition);
				if (isSeek) {
					positions.Clear();
					for (int rowNum = seekBegin - 1; rowNum < seekEnd; rowNum++) {
						positions.Add(rowNum);
					}
				}
				foreach (int rowNum in positions) {
					for (int colNum = 1; colNum < wcdListAdapter[rowNum].Count; colNum++) {
						if (etList[colNum].Text != "") {
							wcdListAdapter[rowNum][colNum] = etList[colNum].Text;
							isUpdate = true;
						}
					}
					listView.SetItemChecked(rowNum, false);
					wcdListAdapter[rowNum].ItemChecked = false;
				}
				if (isUpdate) {
					wcdListAdapter.NotifyDataSetChanged();
					await UpdateFileAsync(robotPath, wcdListAdapter);
				} else {
					CheckListItem(false);
				}
				try {
					if (wcdListAdapter.Count == 0)
						fabWcd.SetImageResource(Resource.Drawable.ic_refresh_white);
					else if (listView.CheckedItemCount == 0)
						fabWcd.SetImageResource(Resource.Drawable.ic_subject_white);
					else
						fabWcd.SetImageResource(Resource.Drawable.ic_edit_white);
				} catch { }
			});

			dialog.Show();
		}
Esempio n. 37
0
        public override void Prompt(PromptConfig config)
        {
            Utils.RequestMainThread(() => {
                var activity = this.getTopActivity();

                var txt = new EditText(activity) {
                    Hint = config.Placeholder
                };
                if (config.Text != null)
                    txt.Text = config.Text;

                this.SetInputType(txt, config.InputType);

                var builder = new AlertDialog
                    .Builder(activity)
                    .SetCancelable(false)
                    .SetMessage(config.Message)
                    .SetTitle(config.Title)
                    .SetView(txt)
                    .SetPositiveButton(config.OkText, (o, e) =>
                        config.OnResult(new PromptResult {
                            Ok = true,
                            Text = txt.Text
                        })
                    );

                if (config.IsCancellable) {
                    builder.SetNegativeButton(config.CancelText, (o, e) =>
                        config.OnResult(new PromptResult {
                            Ok = false,
                            Text = txt.Text
                        })
                    );
                }

                var dialog = builder.Create();
                dialog.Window.SetSoftInputMode(SoftInput.StateVisible);
                dialog.Show();
            });
        }