Beispiel #1
0
        private void BtnCompute_Click(object sender, System.EventArgs e)
        {
            num1 = decimal.Parse(editNum1.Text);
            num2 = decimal.Parse(editNum2.Text);

            alert.SetTitle("Answer");

            if (num1.Equals(null))
            {
                editNum1.SetError("Num1 Cannot be Empty", null);
            }

            if (num2.Equals(null))
            {
                editNum1.SetError("Num2 Cannot be Empty", null);
            }


            switch (selectedOperation)
            {
            case "Add":
                output = mathService.Add(num1, num2);
                //Display Alert
                alert.SetMessage("The sum is " + output);
                alert.Show();
                break;

            case "Subtract":
                output = mathService.Subtract(num1, num2);
                //Display Alert
                alert.SetMessage("The difference is " + output);
                alert.Show();
                break;

            case "Multiply":
                output = mathService.Multiply(num1, num2);
                //Display Alert
                alert.SetMessage("The product is " + output);
                alert.Show();
                break;

            case "Divide":
                output = mathService.Divide(num1, num2);
                //Display Alert
                alert.SetMessage("The quotient is " + output);
                alert.Show();
                break;
            }
        }
        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));
        }
Beispiel #3
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);
        }
Beispiel #4
0
        private void TxtWidth_FocusChange(object sender, View.FocusChangeEventArgs e)
        {
            var txt = (EditText)sender;

            if (txt.Text != string.Empty)
            {
                var resp = Validartxt(txt);

                if (resp == false)
                {
                    alert.Builder adb = new alert.Builder(this);

                    adb.SetTitle("Advertencia?");
                    adb.SetMessage("Verifique el datos ingresado " + txt.Text + " y corregir!!!");
                    adb.SetNeutralButton("Mantener Dato", (senderAlert, args) =>
                    {
                    });
                    adb.SetPositiveButton("Borrar Dato Ingresado", (senderAlert, args) =>
                    {
                        txt.Text = "";
                        txt.RequestFocus();
                    });

                    alert dialog = adb.Create();

                    dialog.Show();
                }
                else
                {
                    txt.Focusable = true;
                }
            }
        }
Beispiel #5
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();
     });
 }
 void downloadWhatsAppFileCompleted(object sender, AsyncCompletedEventArgs e)
 {
     RunOnUiThread(() => {
         progressDialog.Dismiss();
         if (downloadedOK)
         {
             var installApk = new Intent(Intent.ActionView);
             installApk.SetDataAndType(Android.Net.Uri.Parse("file://" + fullLatestWhatsAppFilename), "application/vnd.android.package-archive");
             installApk.SetFlags(ActivityFlags.NewTask);
             try {
                 StartActivity(installApk);
                 AlertDialog deleteWhatsApp = new AlertDialog.Builder(this).Create();
                 deleteWhatsApp.SetTitle(Resources.GetString(Resource.String.delete));
                 deleteWhatsApp.SetMessage(Resources.GetString(Resource.String.delete_description));
                 deleteWhatsApp.SetButton((int)DialogButtonType.Positive, Resources.GetString(Resource.String.delete_button_delete), (object senderDelete, DialogClickEventArgs eDelete) => File.Delete(fullLatestWhatsAppFilename));
                 deleteWhatsApp.SetButton((int)DialogButtonType.Negative, Resources.GetString(Resource.String.delete_button_cancel), (object senderCancel, DialogClickEventArgs eCancel) => deleteWhatsApp.Dismiss());
                 deleteWhatsApp.SetCancelable(false);
                 deleteWhatsApp.Show();
             } catch (ActivityNotFoundException ex) {
                 var errorInstalled = new AlertDialog.Builder(this).Create();
                 errorInstalled.SetTitle(Resources.GetString(Resource.String.download_error));
                 errorInstalled.SetMessage(string.Format(Resources.GetString(Resource.String.download_error_description), "WhatsApp " + latestWhatsAppVersion));
                 errorInstalled.Show();
             }
             downloadedOK = false;
         }
         else
         {
             File.Delete(fullLatestWhatsAppFilename);
         }
     });
 }
        protected override void OnStart()
        {
            base.OnStart();
            active = true;
            var connectivityManager = (ConnectivityManager)GetSystemService(ConnectivityService);
            var activeConnection    = connectivityManager.ActiveNetworkInfo;

            if ((activeConnection == null) || !activeConnection.IsConnected)
            {
                // brak połączenia z siecią
                AlertDialog.Builder alert = new AlertDialog.Builder(this);

                alert.SetTitle("Błąd:");
                alert.SetMessage("Brak połączenia z internetem!");
                alert.SetPositiveButton("Ok", (senderAlert, args) => {
                    //
                });
                alert.Create().Show();
            }
            else
            {
                if (viewSwitcher.CurrentView != progressLayout)
                {
                    viewSwitcher.ShowNext();
                }
                GetData();
            }
        }
Beispiel #8
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            SetContentView(Resource.Layout.play);

            //彈出視窗解說:
            AlertDialog.Builder alert_play = new AlertDialog.Builder(this);  // For initial tips dialog
            if (counter == 0)
            {
                alert_play.SetTitle("注意事項");
                alert_play.SetMessage("1. 請確認影片畫質是否正常且人臉完全包覆於合理範圍中,若不符合請\u201C返回操作\u201C重新測謊.\n" +
                                      "2. 確認無誤後,即可\u201C上傳檔案\u201C進行測謊分析.\n" +
                                      "3. 點選\u201C查看結果\u201C觀看測謊結果!!!");
                alert_play.SetIcon(Android.Resource.Drawable.IcDialogInfo);
                alert_play.SetPositiveButton(" ok", new EventHandler <DialogClickEventArgs>((sender, e) => { }));
                alert_play.Show();
                counter++;
            }

            // 跑馬燈
            TextView play_tv = FindViewById <TextView>(Resource.Id.playtextview);

            play_tv.Selected = true;

            FindViewById <Button>(Resource.Id.btn_back).Click += Back_Click;
            //FindViewById<Button>(Resource.Id.btn_upload).Click += Back_Upload;
            FindViewById <Button>(Resource.Id.btn_play).Click   += Back_Play;
            FindViewById <Button>(Resource.Id.btn_result).Click += Back_Result;
        }
Beispiel #9
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(); });
        }
Beispiel #10
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);
            }
        }
Beispiel #11
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));
            }
        }
 void downloadAppFileCompleted(object sender, AsyncCompletedEventArgs e)
 {
     RunOnUiThread(() => {
         progressDialog.Dismiss();
         if (downloadedOK)
         {
             var installApk = new Intent(Intent.ActionView);
             installApk.SetDataAndType(Android.Net.Uri.Parse("file://" + fullLatestAppFilename), "application/vnd.android.package-archive");
             installApk.SetFlags(ActivityFlags.NewTask);
             try {
                 StartActivity(installApk);
             } catch (ActivityNotFoundException ex) {
                 var errorInstalled = new AlertDialog.Builder(this).Create();
                 errorInstalled.SetTitle(Resources.GetString(Resource.String.download_error));
                 errorInstalled.SetMessage(string.Format(Resources.GetString(Resource.String.download_error_description), Resources.GetString(Resource.String.app_name) + " " + latestAppVersion));
                 errorInstalled.Show();
             }
             downloadedOK = false;
         }
         else
         {
             File.Delete(fullLatestAppFilename);
         }
     });
 }
Beispiel #13
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();
            }
        }
 /// <summary>
 /// Display an error dialog saying IA cannot find a playable move.
 /// </summary>
 private void ShowErrorDialog()
 {
     AlertDialog.Builder alert = new AlertDialog.Builder(this);
     alert.SetTitle("Error");
     alert.SetMessage("Application cannot find a playable move.");
     alert.SetNeutralButton("Go back", delegate { base.OnBackPressed(); });
     alert.Show();
 }
Beispiel #15
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();
 }
Beispiel #16
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();
                };
            }
Beispiel #17
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();
        }
 public virtual void Alert(string format, params object[] args)
 {
     RunOnUiThread(() =>
     {
         var alert = new AlertDialog.Builder(this);
         alert.SetMessage(string.Format(format, args));
         alert.SetPositiveButton("OK", (sender, e) => { });
         alert.Show();
     });
 }
Beispiel #19
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);
                });
            }
        }
Beispiel #20
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);
        }
        public void showRegisteredDialog()
        {
            AlertDialog.Builder alert = new AlertDialog.Builder(context);
            alert.SetTitle("Success!");
            alert.SetMessage("Registration completed");
            alert.SetPositiveButton("Ok!", (sender, args) => { });

            Dialog dialog = alert.Create();

            dialog.Show();
        }
Beispiel #22
0
 private void DisplayException(Exception exception)
 {
     if (exception == null)
     {
         throw new ArgumentNullException(nameof(exception));
     }
     AlertDialog.Builder builder = new AlertDialog.Builder(Context, Resource.Style.MyMaterialTheme);
     builder.SetTitle(Resource.String.ErrorTitle);
     builder.SetMessage(exception.Message);
     builder.SetPositiveButton(Android.Resource.String.Ok, (IDialogInterfaceOnClickListener)null);
     builder.Show();
 }
Beispiel #23
0
        private void ShowDialog(string title, string messaage)
        {
            AlertDialog.Builder alertDiag = new AlertDialog.Builder(this);
            alertDiag.SetTitle(title);
            alertDiag.SetMessage(messaage);
            alertDiag.SetPositiveButton("Okay", (senderAlert, args) =>
            {
            });
            Dialog diag = alertDiag.Create();

            diag.Show();
        }
Beispiel #24
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();
 }
        private void AlertIncomplete(string message)
        {
            var alert = new AlertDialog.Builder(this);

            alert.SetTitle("Incorrect operation");
            alert.SetMessage(message);
            alert.SetNeutralButton("OK", (senderAlert, args) => { alert.Dispose(); });

            Dialog dialog = alert.Create();

            dialog.Show();
        }
Beispiel #26
0
 // Sets up the alert dialog
 private void ShowAlertDialog(String title, String message)
 {
     AlertDialog.Builder builder = new AlertDialog.Builder(this);
     builder.SetTitle(title);
     builder.SetMessage(message);
     builder.SetPositiveButton("OK", (sender, e) =>
     {
         Intent logout = new Intent(this, typeof(MainActivity));
         logout.SetFlags(ActivityFlags.ClearTask | ActivityFlags.NewTask);
         StartActivity(logout);
     });
     builder.Create().Show();
 }
Beispiel #27
0
        private void ArrowBackOnClick()
        {
            var alertDialogBuilder = new AlertDialog.Builder(this);

            alertDialogBuilder
            .SetMessage("Do you want to abort quiz?")
            .SetPositiveButton("Yes", (sender, args) => InitSummaryActivity())
            .SetNegativeButton("No", (sender, args) => {});

            var alertDialog = alertDialogBuilder.Create();

            alertDialog.Show();
        }
        public void showAlert(string title, string text, string buttonLabel)
        {
            AlertDialog.Builder alert = new AlertDialog.Builder(context);
            alert.SetTitle(title);
            alert.SetMessage(text);
            alert.SetPositiveButton(buttonLabel, (senderAlert, args) => {
            });


            Dialog dialog = alert.Create();

            dialog.Show();
        }
        public void ShowAlertOK(String Message)
        {
            ThemedDialog.Builder alert = new ThemedDialog.Builder(_Context);
            alert.SetTitle("Menu Pick");
            alert.SetMessage(Message);

            alert.SetPositiveButton("OK", (senderAlert, args) => {
            });

            Dialog dialog = alert.Create();

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

            alert.SetTitle(friendsList[e.Position].Name);
            alert.SetMessage(friendsList[e.Position].Description);
            alert.SetPositiveButton("Ok", (senderAlert, args) => {
            });

            RunOnUiThread(() => {
                alert.Show();
            });
        }
Beispiel #31
0
        private void Alert(string message)
        {
            AlertDialog.Builder builder = new AlertDialog.Builder(this, Resource.Style.AlertDialogStyle);

            builder.SetTitle("Error");
            builder.SetMessage(message);
            builder.SetPositiveButton("OK", (senderAlert, e) => { });
            builder.Show();
        }
		void downloadAppFileCompleted (object sender, AsyncCompletedEventArgs e) {
			RunOnUiThread (() => {
				progressDialog.Dismiss ();
				if (downloadedOK) {
					var installApk = new Intent(Intent.ActionView);
					installApk.SetDataAndType(Android.Net.Uri.Parse("file://" + fullLatestAppFilename), "application/vnd.android.package-archive");
					installApk.SetFlags(ActivityFlags.NewTask);
					try {
						StartActivity(installApk);
					} catch (ActivityNotFoundException ex) {
						var errorInstalled = new AlertDialog.Builder (this).Create ();
						errorInstalled.SetTitle (Resources.GetString(Resource.String.download_error));
						errorInstalled.SetMessage (string.Format(Resources.GetString(Resource.String.download_error_description), Resources.GetString(Resource.String.app_name) + " " + latestAppVersion));
						errorInstalled.Show ();	
					}
					downloadedOK = false;
				} else {
					File.Delete(fullLatestAppFilename);
				}
			});
		}
		void downloadWhatsAppFileCompleted (object sender, AsyncCompletedEventArgs e) {
			RunOnUiThread (() => {
				progressDialog.Dismiss ();
				if (downloadedOK) {
					var installApk = new Intent(Intent.ActionView);
					installApk.SetDataAndType(Android.Net.Uri.Parse("file://" + fullLatestWhatsAppFilename), "application/vnd.android.package-archive");
					installApk.SetFlags(ActivityFlags.NewTask);
					try {
						StartActivity(installApk);
						AlertDialog deleteWhatsApp = new AlertDialog.Builder (this).Create ();
						deleteWhatsApp.SetTitle (Resources.GetString(Resource.String.delete));
						deleteWhatsApp.SetMessage (Resources.GetString(Resource.String.delete_description));
						deleteWhatsApp.SetButton ((int)DialogButtonType.Positive, Resources.GetString(Resource.String.delete_button_delete), (object senderDelete, DialogClickEventArgs eDelete) => File.Delete(fullLatestWhatsAppFilename));
						deleteWhatsApp.SetButton ((int)DialogButtonType.Negative, Resources.GetString(Resource.String.delete_button_cancel), (object senderCancel, DialogClickEventArgs eCancel) => deleteWhatsApp.Dismiss ());
						deleteWhatsApp.SetCancelable (false);
						deleteWhatsApp.Show ();
					} catch (ActivityNotFoundException ex) {
						var errorInstalled = new AlertDialog.Builder (this).Create ();
						errorInstalled.SetTitle (Resources.GetString(Resource.String.download_error));
						errorInstalled.SetMessage (string.Format(Resources.GetString(Resource.String.download_error_description), "WhatsApp " + latestWhatsAppVersion));
						errorInstalled.Show ();	
					}
					downloadedOK = false;
				} else {
					File.Delete(fullLatestWhatsAppFilename);
				}
			});
		}
		// Retrieve latest version of Beta Updater
		public async Task GetLatestAppVersion (string pageUrl) {
			var getVersion = new WebClient();
			string htmlAndroid = getVersion.DownloadString (new Uri(pageUrl));

			// Get WhatsApp latest version
			string[] split = htmlAndroid.Split (new char[] { '>' });
			int i = 0;
			while (i < split.Length) {
				if (split.GetValue (i).ToString ().StartsWith ("v")) {
					split = split.GetValue (i).ToString ().Split (new char[] { 'v', '<' });
					latestAppVersion = split.GetValue (1).ToString ().Trim ();
					break;
				}
				i++;
			}

			installedAppVersion = PackageManager.GetPackageInfo ("com.javiersantos.whatsappbetaupdater", 0).VersionName.Trim ();

			if (CompareVersionReceiver.VersionCompare (installedAppVersion, latestAppVersion) < 0) {
				appApk = appApk + "v" + latestAppVersion + "/com.javiersantos.whatsappbetaupdater.apk";

				AlertDialog appUpdateDialog = new AlertDialog.Builder (this).Create ();
				appUpdateDialog.SetTitle (string.Format(Resources.GetString(Resource.String.app_update), latestAppVersion));
				appUpdateDialog.SetMessage (string.Format(Resources.GetString(Resource.String.app_update_description), Resources.GetString(Resource.String.app_name)));
				appUpdateDialog.SetButton ((int)DialogButtonType.Positive, Resources.GetString (Resource.String.update_button), (object senderUpdateAppOK, DialogClickEventArgs eUpdateAppOK) => {
					SetDownloadDialog ();
					var webClient = new WebClient ();
					webClient.DownloadProgressChanged += new DownloadProgressChangedEventHandler (downloadProgressChanged);
					webClient.DownloadFileCompleted += new AsyncCompletedEventHandler (downloadAppFileCompleted);
					webClient.DownloadFileAsync (new Uri (appApk), fullLatestAppFilename);
					progressDialog.SetTitle (string.Format(Resources.GetString(Resource.String.downloading), Resources.GetString(Resource.String.app_name) + " " + latestAppVersion + "..."));
					progressDialog.SetButton (Resources.GetString(Resource.String.cancel_button), (object senderCancel, DialogClickEventArgs eCancel) => {webClient.CancelAsync (); progressDialog.Dismiss ();});
					progressDialog.Show ();
				});
				appUpdateDialog.SetButton ((int)DialogButtonType.Negative, Resources.GetString(Resource.String.cancel_button), (object senderUpdateAppCancel, DialogClickEventArgs eUpdateAppCancel) => appUpdateDialog.Dismiss ());
				appUpdateDialog.SetButton ((int)DialogButtonType.Neutral, Resources.GetString(Resource.String.never_button), (object senderUpdateAppNever, DialogClickEventArgs eUpdateAppNever) => {prefs.Edit().PutBoolean("prefShowAppUpdates", false).Commit(); appUpdateDialog.Dismiss (); });
				appUpdateDialog.SetCancelable (false);
				appUpdateDialog.Show ();
			}
		}
        private async Task Waitlist()
        {
            WorkshopController workshopController = new WorkshopController();
            await workshopController.Waitlist(_Workshop.WorkshopId);

            //show dialog saying canceled
            var SuccesDialog = new AlertDialog.Builder(this);
            SuccesDialog.SetMessage("You have successfully been waitlisted!");
            SuccesDialog.SetNeutralButton("OK", delegate { Finish(); });
            SuccesDialog.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 async Task Book()
 {
     // Code to book the workshop
     WorkshopController workshopController = new WorkshopController();
     if (! await workshopController.Book(_Workshop.WorkshopId))
     {
         //show error , stay on page;
     }
     else
     {
         //show dialog saying booked
         var SuccesDialog = new AlertDialog.Builder(this);
         SuccesDialog.SetMessage("You have successfully been booked!");
         SuccesDialog.SetNeutralButton("OK", delegate { Finish(); });
         SuccesDialog.Show();
     }
 }
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate (bundle);
            //RequestedOrientation = global::Android.Content.PM.ScreenOrientation.Landscape;

            // Set our view from the "main" layout resource
            SetContentView (Resource.Layout.Main);

            SignaturePadView signature = FindViewById<SignaturePadView> (Resource.Id.signatureView);

            if (true) { // Customization activated
                View root = FindViewById<View> (Resource.Id.rootView);

                // Activate this to internally use a bitmap to store the strokes
                // (good for frequent-redraw situations, bad for memory footprint)
                // signature.UseBitmapBuffer = true;

                signature.Caption.Text = "Authorization Signature";
                signature.Caption.SetTypeface (Typeface.Serif, TypefaceStyle.BoldItalic);
                signature.Caption.SetTextSize (global::Android.Util.ComplexUnitType.Sp, 16f);
                signature.SignaturePrompt.Text = ">>";
                signature.SignaturePrompt.SetTypeface (Typeface.SansSerif, TypefaceStyle.Normal);
                signature.SignaturePrompt.SetTextSize (global::Android.Util.ComplexUnitType.Sp, 32f);
                signature.BackgroundColor = Color.Rgb (255, 255, 200); // a light yellow.
                signature.StrokeColor = Color.Black;

                signature.BackgroundImageView.SetImageResource (Resource.Drawable.logo_galaxy_black_64);
                signature.BackgroundImageView.SetAlpha (16);
                signature.BackgroundImageView.SetAdjustViewBounds (true);

                var layout = new RelativeLayout.LayoutParams (ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent);
                layout.AddRule (LayoutRules.CenterInParent);
                layout.SetMargins (20, 20, 20, 20);
                signature.BackgroundImageView.LayoutParameters = layout;

                // You can change paddings for positioning...
                var caption = signature.Caption;
                caption.SetPadding (caption.PaddingLeft, 1, caption.PaddingRight, 25);
            }

            // Get our button from the layout resource,
            // and attach an event to it
            Button btnSave = FindViewById<Button> (Resource.Id.btnSave);
            btnSave.Click += delegate {
                if (signature.IsBlank)
                {//Display the base line for the user to sign on.
                    AlertDialog.Builder alert = new AlertDialog.Builder (this);
                    alert.SetMessage ("No signature to save.");
                    alert.SetNeutralButton ("Okay", delegate { });
                    alert.Create ().Show ();
                }
                points = signature.Points;
            };
            btnSave.Dispose ();

            Button btnLoad = FindViewById<Button> (Resource.Id.btnLoad);
            btnLoad.Click += delegate {
                if (points != null)
                    signature.LoadPoints (points);
            };
            btnLoad.Dispose ();
        }
		// Retrieve latest version of WhatsApp
		public async Task GetLatestWhatsAppVersion (string pageUrl) {
			var getVersion = new WebClient();
			string htmlAndroid = getVersion.DownloadString (new Uri(pageUrl));

			// Get WhatsApp latest version
			string[] split = htmlAndroid.Split (new char[] { '>' });
			int i = 0;
			while (i < split.Length) {
				if (split.GetValue (i).ToString ().StartsWith ("Version")) {
					split = split.GetValue (i).ToString ().Split (new char[] { ' ', '<' });
					latestWhatsAppVersion = split.GetValue (1).ToString ().Trim ();
					break;
				}
				i++;
			}

			// Display WhatsApp installed and latest version
			TextView whatsapp_installed_version = FindViewById<TextView> (Resource.Id.whatsapp_installed_version);
			TextView whatsapp_latest_version = FindViewById<TextView> (Resource.Id.whatsapp_latest_version);

			installedWhatsAppVersion = PackageManager.GetPackageInfo ("com.whatsapp", 0).VersionName.Trim ();

			whatsapp_installed_version.Text = installedWhatsAppVersion;
			whatsapp_latest_version.Text = latestWhatsAppVersion;

			fullLatestWhatsAppFilename = filename + "WhatsApp_" + latestWhatsAppVersion + ".apk";

			// Load Floating Button
			var fab = FindViewById<FloatingActionButton> (Resource.Id.fab);

			// Compare installed and latest WhatsApp version
			if (CompareVersionReceiver.VersionCompare(installedWhatsAppVersion, latestWhatsAppVersion) < 0) { // There is a new version
				fab.SetImageDrawable(Resources.GetDrawable(Resource.Drawable.ic_download));
				// Preference: Autodownload
				if (prefAutoDownload) {
					SetDownloadDialog ();
					var webClient = new WebClient ();
					webClient.DownloadProgressChanged += new DownloadProgressChangedEventHandler (downloadProgressChanged);
					webClient.DownloadFileCompleted += new AsyncCompletedEventHandler (downloadWhatsAppFileCompleted);
					webClient.DownloadFileAsync (new Uri (whatsAppApk), fullLatestWhatsAppFilename);
					progressDialog.SetTitle (string.Format(Resources.GetString(Resource.String.downloading), "WhatsApp " + latestWhatsAppVersion + "..."));
					progressDialog.SetButton (Resources.GetString(Resource.String.cancel_button), (object senderCancel, DialogClickEventArgs eCancel) => {webClient.CancelAsync (); progressDialog.Dismiss ();});
					progressDialog.Show ();
				} else {
					fab.Click += delegate {
						SetDownloadDialog ();
						var webClient = new WebClient ();
						webClient.DownloadProgressChanged += new DownloadProgressChangedEventHandler (downloadProgressChanged);
						webClient.DownloadFileCompleted += new AsyncCompletedEventHandler (downloadWhatsAppFileCompleted);
						webClient.DownloadFileAsync (new Uri (whatsAppApk), fullLatestWhatsAppFilename);
						progressDialog.SetTitle (string.Format(Resources.GetString(Resource.String.downloading), "WhatsApp " + latestWhatsAppVersion + "..."));
						progressDialog.SetButton (Resources.GetString(Resource.String.cancel_button), (object senderCancel, DialogClickEventArgs eCancel) => {webClient.CancelAsync (); progressDialog.Dismiss ();});
						progressDialog.Show ();
					};
				}
			// There is not a new version
			} else {
				fab.SetImageDrawable(Resources.GetDrawable(Resource.Drawable.ic_menu_about));
				fab.Click += delegate {
					AlertDialog errorInstalled = new AlertDialog.Builder (this).Create ();
					errorInstalled.SetTitle (Resources.GetString(Resource.String.latest_installed));
					errorInstalled.SetMessage (string.Format(Resources.GetString(Resource.String.latest_installed_description), "WhatsApp " + installedWhatsAppVersion));
					errorInstalled.SetButton ((int)DialogButtonType.Positive, Resources.GetString(Resource.String.ok), (object senderClose, DialogClickEventArgs eClose) => errorInstalled.Dismiss ());
					errorInstalled.Show ();
				};
			}
		}
 private void ShowFailedAlert(string msg)
 {
     var registerFailAlert = new SupportAlert.Builder(this);
     registerFailAlert.SetMessage(msg);
     registerFailAlert.SetNeutralButton("OK", delegate { });
     registerFailAlert.Show();
 }
Beispiel #41
0
        /// <summary>
        /// Handles the lesson fragment's lesson finished event
        /// </summary>
        /// <param name="sender">sender.</param>
        /// <param name="e">event args.</param>
        void LessonFragment_LessonFinished(object sender, EventArgs e)
        {
            //Toast.MakeText(this, "Lesson finished!", ToastLength.Short).Show();

            var builder = new AlertDialog.Builder(this);
            builder.SetTitle(Resource.String.lesson_finished);
            builder.SetMessage(Resource.String.lesson_finished_message);
            builder.SetCancelable(false);
            builder.SetPositiveButton(Android.Resource.String.Ok, (s, args) => NextLesson());
            builder.Show();
        }
Beispiel #42
0
 /// <summary>
 /// Switches to the next lesson if available
 /// </summary>
 private void NextLesson()
 {
     var nextLesson = DataHolder.Current.CurrentModule.GetNextLesson(DataHolder.Current.CurrentLesson);
     if (nextLesson != null)
     {
         DataHolder.Current.CurrentLesson = nextLesson;
         DataHolder.Current.CurrentIteration = nextLesson.Iterations.First();
         InitLesson();
     }
     else
     {
         var builder = new AlertDialog.Builder(this);
         builder.SetTitle(Resource.String.module_finished);
         builder.SetMessage(Resource.String.module_finished_message);
         builder.SetCancelable(false);
         builder.SetPositiveButton(Android.Resource.String.Ok, (s, args) => Finish());
         builder.Show();
     }
 }