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(); }); }
//--------------------------------------------------------------------- // 개인정보취급방침 다이얼로그 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); }
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); } }); }
/// <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(); }); }
private void ShowModeConfigurationDialog(int joystickId) { // Build and display the mode configuration dialog AlertDialog modeConfigurationDialog = null; AlertDialog.Builder builder = new AlertDialog.Builder(Activity, Resource.Style.AlertDialogStyle); builder.SetSingleChoiceItems(Resource.Array.JoystickModes, (int)GetRelatedJoystickConfiguration(joystickId).JoystickMode, delegate(object sender, DialogClickEventArgs args) { ConfigureJoystickAxis((JoystickConfiguration.JoystickModes)args.Which, joystickId); // ReSharper disable once AccessToModifiedClosure modeConfigurationDialog?.Dismiss(); }); builder.SetPositiveButton(Resource.String.ControlInterfaceActivity_configureJoystickModeDialogPositive, delegate { // ReSharper disable once AccessToModifiedClosure modeConfigurationDialog?.Dismiss(); }); builder.SetTitle(Resource.String.ControlInterfaceActivity_configureJoystickModeDialogTitle); builder.SetCancelable(false); modeConfigurationDialog = builder.Create(); modeConfigurationDialog.Show(); }
private void ShowMotorConfigurationDialog(int joystickId, int joystickAxis) { // Build and display the motor configuration dialog AlertDialog motorConfigurationDialog = null; AlertDialog.Builder builder = new AlertDialog.Builder(Activity, Resource.Style.AlertDialogStyle); builder.SetSingleChoiceItems(GetMotorList(), GetRelatedJoystickConfiguration(joystickId).MotorIndexes[joystickAxis], delegate(object sender, DialogClickEventArgs args) { // When one motor was clicked we set it and display the next dialog SetMotorIndex(joystickId, args.Which, joystickAxis); // ReSharper disable once AccessToModifiedClosure motorConfigurationDialog?.Dismiss(); // If configured the first joystick axis we have to configure the second. // This can be done better but it works :) if (joystickAxis == 0) { ShowMotorConfigurationDialog(joystickId, ++joystickAxis); } }); builder.SetPositiveButton(Resource.String.ControlInterfaceActivity_configureJoystickMotor1DialogPositive, delegate { // ReSharper disable once AccessToModifiedClosure motorConfigurationDialog?.Dismiss(); // If configured the first joystick axis we have to configure the second. if (joystickAxis == 0) { ShowMotorConfigurationDialog(joystickId, ++joystickAxis); } }); if (joystickAxis == 0) { builder.SetTitle(Resource.String.ControlInterfaceActivity_configureJoystickMotor1DialogTitle); } else if (joystickAxis == 1) { builder.SetTitle(Resource.String.ControlInterfaceActivity_configureJoystickMotor2DialogTitle); } builder.SetCancelable(false); motorConfigurationDialog = builder.Create(); motorConfigurationDialog.Show(); }
private static void ShowRateDialog(Context context) { var rateReminderDialogBuilder = new AlertDialog.Builder(context, Resource.Style.AlertDialogStyle); rateReminderDialogBuilder.SetTitle(context.GetString(Resource.String.RateReminderDialog_title)); rateReminderDialogBuilder.SetMessage(context.GetString(Resource.String.RateReminderDialog_message)); rateReminderDialogBuilder.SetCancelable(true); rateReminderDialogBuilder.SetPositiveButton(Resource.String.RateReminderDialog_positive, delegate { // When the positive button has been pressed: open the app store OpenAppStore(context); // Also do not open the dialog again SetDoNotShowAgain(context, true); _rateDialog?.Dismiss(); }); rateReminderDialogBuilder.SetNeutralButton(Resource.String.RateReminderDialog_neutral, delegate { _rateDialog?.Dismiss(); }); rateReminderDialogBuilder.SetNegativeButton(Resource.String.RateReminderDialog_negative, delegate { // Do not open the dialog again SetDoNotShowAgain(context, true); _rateDialog?.Dismiss(); }); rateReminderDialogBuilder.SetCancelable(false); // Create and show the dialog _rateDialog = rateReminderDialogBuilder.Create(); _rateDialog.Show(); }
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()); }
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(); }
private void ShowDialog() { var layoutInflater = LayoutInflater.From(this); var mView = layoutInflater.Inflate(Resource.Layout.AddDialog, null); var addDialog = new AlertDialog.Builder(this); addDialog.SetView(mView); var content = mView.FindViewById <EditText>(Resource.Id.editText1); addDialog.SetCancelable(false) .SetPositiveButton("Add", delegate { insertSingleItem(content); }) .SetNegativeButton("Cancel", delegate { addDialog.Dispose(); }); var adialog = addDialog.Create(); addDialog.Show(); }
// 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 void ShowNoPasswordDialog(int requestCode, Intent intent) { var builder = new AlertDialog.Builder(this); builder.SetTitle(Resource.String.warning); builder.SetMessage(Resource.String.confirmEmptyPassword); builder.SetNegativeButton(Resource.String.no, (s, args) => { }); builder.SetPositiveButton(Resource.String.yes, (s, args) => { _passwordDialog.Dismiss(); Backup(requestCode, intent, true); }); builder.SetCancelable(true); var dialog = builder.Create(); dialog.Show(); }
//--------------------------------------------------------------------- // 오프라인 모드 여부 (서버 통신 X) private void AskOfflineMode() { AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.SetCancelable(false); builder.SetTitle("온라인 모드를 사용하시겠습니까?"); builder.SetMessage("아니오를 누르시면 문자를 서버로 전송하지 않습니다.\n대신 문자 분류 정확성이 떨어지게 됩니다."); builder.SetPositiveButton("예", (senderAlert2, args2) => { //온라인 모드이므로, 온라인 카테고리 분류 실행. DataStorageManager.SaveBoolData(this, "useOfflineMode", false); //오프라인 모드 사용하지 않음. Categorize(); }); builder.SetNegativeButton("아니오", (senderAlert2, args2) => { DataStorageManager.SaveBoolData(this, "useOfflineMode", true); //오프라인 모드 사용 Categorize(); }); Dialog dialog2 = builder.Create(); dialog2.Show(); }
//--------------------------------------------------------------------- // 기계학습 요청 private void AskMachineSupport() { AlertDialog.Builder builder2 = new AlertDialog.Builder(this); builder2.SetCancelable(false); builder2.SetTitle("기계학습 지원 요청"); builder2.SetMessage("기계학습 지원을 하시겠습니까?"); builder2.SetPositiveButton("예", (senderAlert2, args2) => { DataStorageManager.SaveBoolData(this, "isFirst", false); //isFirst 해제 DataStorageManager.SaveBoolData(this, "supportMachineLearning", true); //기계학습 지원 승인 Finish(); //Welecome Activity 종료 }); builder2.SetNegativeButton("아니오", (senderAlert2, args2) => { DataStorageManager.SaveBoolData(this, "isFirst", false); //isFirst 해제 DataStorageManager.SaveBoolData(this, "supportMachineLearning", false); //기계학습 지원 비승인 Finish(); }); Dialog dialog2 = builder2.Create(); dialog2.Show(); }
public override bool OnOptionsItemSelected(IMenuItem item) { switch (item.ItemId) { case Resource.Id.action_show: AlertDialog.Builder builder = new AlertDialog.Builder(Context, Resource.Style.CustomDialogTheme); builder.SetTitle("Seleccione la opción"); builder.SetCancelable(true); string[] values = { "Solo mis órdenes", "Todas las órdenes" }; int checkedItem = 0; builder.SetSingleChoiceItems(values, checkedItem, (c, ev) => { switch (c) { case 0: Console.WriteLine("just mine"); break; case 1: Console.WriteLine("all"); break; } }); builder.SetPositiveButton("confirmar", (c, ev) => { }); builder.SetNegativeButton("cancelar", (c, ev) => { }); AlertDialog alert = builder.Create(); alert.Show(); return(true); } return(base.OnOptionsItemSelected(item)); }
private void ListPRoduct_ItemClick(object sender, AdapterView.ItemClickEventArgs e) { if (!subGrouop) { var subSelected = ((Prodotto)listPRoduct.GetItemAtPosition(e.Position)).SubGroup; var subQuery = query.Where(s => s[s.Count - 1].Contains(subSelected)).ToList(); GetInSub(subQuery); subGrouop = !subGrouop; } else { var text = new EditText(this); text.SetRawInputType(InputTypes.ClassNumber); var builder = new AlertDialog.Builder(this); builder.SetTitle("Seleziona la quantita"); builder.SetCancelable(true); builder.SetView(text); builder.SetNegativeButton("Annulla", delegate { }); builder.SetPositiveButton("Conferma", delegate { listProd.Add(subqueryList[e.Position].CodArt + ';' + text.Text.Replace(',', '.') + ';' + subqueryList[e.Position].UnitPrice); Intent i = new Intent(this, typeof(MainActivity)); var urisplit = subqueryList[e.Position].ImageUrl.Split('\\'); listURI.Add(urisplit.Last()); var uriarr = listURI.ToArray(); var array = listProd.ToArray(); i.PutExtra("prod", array); i.PutExtra("uri", uriarr); i.PutExtra("first", false); StartActivity(i); }); builder.Show(); } }
/// <summary> /// Shows an alert dialog with a single dismiss button. /// </summary> /// <param name="title"></param> /// <param name="message"></param> /// <param name="buttonText"></param> /// <param name="dismissCallback"></param> public void ShowPopup(string title, string message, string buttonText = "ok", Action dismissCallback = null, bool dismissable = true) { var top = Mvx.Resolve <IMvxAndroidCurrentTopActivity>(); if (top == null) { // may occur if in middle of transition return; } // lets build the alert popup AlertDialog.Builder builder = new AlertDialog.Builder(top.Activity); builder.SetMessage(message); builder.SetTitle(title); builder.SetNegativeButton(buttonText, (o, args) => { // invoke this actioni only if it is not null dismissCallback?.Invoke(); }); // if cancellable is set to true, you can dismiss the popup but tapping anywhere on the page outstide it builder.SetCancelable(dismissable); // make sure the popup is created on the UI thread, otherwise it may throw an exception top.Activity.RunOnUiThread(() => { builder.Create().Show(); }); }
/// <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(); } }
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(); }
public void SetCodCliFor() { var layoutprinc = new LinearLayout(this); layoutprinc.Orientation = Orientation.Vertical; var separator = new View(this); separator.LayoutParameters = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MatchParent, 1); separator.SetBackgroundResource(Android.Resource.Color.DarkerGray); var layoutRadio = new RadioGroup(this); layoutRadio.Orientation = Orientation.Horizontal; var radioDesc = new RadioButton(this) { Text = "Descrizione", }; var radioIva = new RadioButton(this) { Text = "Partita iva" }; var radioCod = new RadioButton(this) { Text = "Codice" }; layoutRadio.AddView(radioDesc); layoutRadio.AddView(radioIva); layoutRadio.AddView(radioCod); layoutRadio.Check(radioDesc.Id); layoutprinc.AddView(layoutRadio); layoutprinc.AddView(separator); var searchText = new AutoCompleteTextView(this); var path = Android.OS.Environment.GetExternalStoragePublicDirectory(Android.OS.Environment .DirectoryDownloads).AbsolutePath; var clienti = Helper.GetClienti(path); var descliforlist = new List <string>(); var partitaivalist = new List <string>(); var codcliforlist = new List <string>(); foreach (var cliente in clienti) { codcliforlist.Add(cliente[7]); var parttemp = cliente[15]; if (parttemp.Length != 0) { parttemp = parttemp.Substring(1); } partitaivalist.Add(parttemp); descliforlist.Add(cliente[12]); } descliforlist.RemoveAt(0); searchText.Adapter = new ArrayAdapter(this, Android.Resource.Layout.SimpleListItem1, descliforlist); layoutRadio.CheckedChange += (s, e) => { switch (e.CheckedId) { case 1: searchText.Adapter = new ArrayAdapter(this, Android.Resource.Layout.SimpleListItem1, descliforlist); break; case 2: searchText.Adapter = new ArrayAdapter(this, Android.Resource.Layout.SimpleListItem1, partitaivalist); break; case 3: searchText.Adapter = new ArrayAdapter(this, Android.Resource.Layout.SimpleListItem1, codcliforlist); break; } }; layoutprinc.AddView(searchText); var builder1 = new AlertDialog.Builder(this); builder1.SetTitle("Seleziona cliente"); builder1.SetCancelable(false); builder1.SetView(layoutprinc); builder1.SetPositiveButton("Conferma", delegate { switch (layoutRadio.CheckedRadioButtonId) { case 1: codclifor = clienti.First(list => list[12] == searchText.Text)[7]; break; case 2: codclifor = clienti.First(list => list[15] == "0" + searchText.Text)[7]; break; case 3: codclifor = searchText.Text; break; } using (StreamWriter stream = new StreamWriter(Environment.GetFolderPath(Environment.SpecialFolder.Personal) + "/codclifor.txt")) { stream.Write(codclifor); } SupportActionBar.Subtitle = "Cliente:" + clienti.First(list => list[7] == codclifor)[12]; }); layoutRadio.Check(1); builder1.Show(); }
//function when keyboard is clicked private void ButtonClick(object sender, EventArgs e) { //the current button being pressed Button currentButton = (Button)sender; //play the game tvWord.Text = operation.GamePlay(currentButton.Text); if (tvWord.Text == "win") { alertDialog = new AlertDialog.Builder(this); alertDialog.SetCancelable(false); alertDialog.SetTitle("HangMan:"); alertDialog.SetMessage(operation.winMessage()); alertDialog.SetNeutralButton("Next Word", delegate { //when game wins //next round alertDialog.Dispose(); operation.RestartGame(); initGameScreen(); }); alertDialog.Show(); } //disable button currentButton.Enabled = false; //get how many tries the user has left to play switch (operation.getTries()) { case 0: imgHangMan.SetImageResource(Resource.Drawable.first); break; case 1: imgHangMan.SetImageResource(Resource.Drawable.second); break; case 2: imgHangMan.SetImageResource(Resource.Drawable.third); break; case 3: imgHangMan.SetImageResource(Resource.Drawable.fourth); break; case 4: imgHangMan.SetImageResource(Resource.Drawable.fifth); break; case 5: imgHangMan.SetImageResource(Resource.Drawable.sixth); break; case 6: imgHangMan.SetImageResource(Resource.Drawable.seventh); break; case 7: imgHangMan.SetImageResource(Resource.Drawable.eigth); break; case 8: imgHangMan.SetImageResource(Resource.Drawable.ninth); break; case 9: imgHangMan.SetImageResource(Resource.Drawable.lose); alertDialog = new AlertDialog.Builder(this); alertDialog.SetCancelable(false); alertDialog.SetTitle("HangMan:"); alertDialog.SetMessage("You have lost the game"); alertDialog.SetNeutralButton("Restart", delegate { //what to do when lost alertDialog.Dispose(); Database.AddPlayerScore(operation.getName(), operation.getScore()); operation.RestartGame(); operation.restartScore(); RestartGame(); }); alertDialog.Show(); break; } }
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); } }); }
public bool OnNavigationItemSelected(IMenuItem item) { switch (item.ItemId) { case Resource.Id.navigation_home: listprod = new List <string>(); listView.Adapter = new ArrayAdapter(this, Android.Resource.Layout.SimpleListItem1); return(true); case Resource.Id.navigation_dashboard: var lw = new ListView(this); lw.ItemClick += Lw_ItemClick; lw.Adapter = new ArrayAdapter(this, Android.Resource.Layout.SimpleListItem1, Helper.GetGroup()); var builder = new AlertDialog.Builder(this); builder.SetTitle("Seleziona gruppo"); builder.SetCancelable(true); builder.SetView(lw); builder.SetNegativeButton("Annulla", delegate { }); builder.Show(); return(true); case Resource.Id.navigation_notifications: if (codclifor == null) { Toast.MakeText(this, "Selezionare un cliente prima!", ToastLength.Short).Show(); break; } var layout = new LinearLayout(this); layout.Orientation = Orientation.Vertical; var edittextAgente = new EditText(this); edittextAgente.Hint = "Codice agente"; layout.AddView(edittextAgente, 0); var builder1 = new AlertDialog.Builder(this); builder1.SetTitle("Conferma ordine"); builder1.SetMessage("Totale Ordine:" + Helper.GetTot(listprod)); builder1.SetCancelable(true); builder1.SetView(layout); builder1.SetNegativeButton("Annulla", delegate { }); builder1.SetPositiveButton("Conferma", delegate { if (!edittextAgente.Text.StartsWith("C") && edittextAgente.Text.Length != 6) { Toast.MakeText(this, "Codice agente non valido", ToastLength.Short).Show(); return; } var path = Android.OS.Environment.GetExternalStoragePublicDirectory(Android.OS.Environment .DirectoryDownloads).AbsolutePath + "/Sarin"; if (!Directory.Exists(path)) { Directory.CreateDirectory(path); } var curDir = new Java.IO.File(path); var csvlist = curDir.List(); var last = 0; if (csvlist != null) { foreach (var ord in csvlist) { var narr = new string(ord.Where(char.IsDigit).ToArray()); var n = narr.Aggregate("", (current, digit) => current + digit); if (Convert.ToInt32(n) > last) { last = Convert.ToInt32(n); } } } using (StreamWriter streamWriter = new StreamWriter(path + $"/OrdineN{last+1}.csv")) { foreach (var prod in listprod) { streamWriter.WriteLine(prod); } streamWriter.WriteLine($";;;{Helper.GetTot(listprod)};{edittextAgente.Text};{codclifor};{DateTime.Now.ToShortDateString()}"); } Toast.MakeText(this, "Ordine effetuato e salvato nella cartella /Downloads.", ToastLength.Short).Show(); listprod = new List <string>(); listView.Adapter = new ArrayAdapter(this, Android.Resource.Layout.SimpleListItem1); }); builder1.Show(); return(true); } return(false); }
private void DisplaySettingsView() { var alert = new AlertDialog.Builder(this); var view = new BlankView(this); alert.SetView(view); var lID = Resource.Id.BlankLayoutContainer; string[] res, fps, dfps; if (PRO_MODE) { res = new[] { "480p", "720p", "1080p", "4K" }; fps = new[] { "15", "30", "60", "120" }; dfps = new[] { "1", "5", "10", "15", "30", "60" }; } else { res = new[] { "480p", "720p" }; fps = new[] { "15", "30" }; dfps = new[] { "1", "5" }; } s.CreateAndAddLabelBoxRow(view, lID, "CONFIGURAÇÕES DE CAPTURA"); s.CreateAndAddDescriptionRow2(view, lID, "Selecione a resolução e a velocidade de captura de vídeo. A velocidade " + "serve apenas como referência - o valor real será determinado pelas capacidades do seu dispositivo."); s.CreateAndAddSpinnerRow(view, lID, "Resolução", res, (int)SavedDataStore.SelectedResolution, (o, e, re) => { switch (re.SelectedItemPosition) { case 0: SavedDataStore.SelectedResolution = SaveData.CaptureResolution.Res480p; break; case 1: SavedDataStore.SelectedResolution = SaveData.CaptureResolution.Res720p; break; case 2: SavedDataStore.SelectedResolution = SaveData.CaptureResolution.Res1080p; break; case 3: SavedDataStore.SelectedResolution = SaveData.CaptureResolution.Res2160p; break; } }); s.CreateAndAddSpinnerRow(view, lID, "Frames por Segundo (FPS)", fps, (int)SavedDataStore.SelectedFPS, (o, e, re) => { switch (re.SelectedItemPosition) { case 0: SavedDataStore.SelectedFPS = SaveData.CaptureFPS.FPS15; break; case 1: SavedDataStore.SelectedFPS = SaveData.CaptureFPS.FPS30; break; case 2: SavedDataStore.SelectedFPS = SaveData.CaptureFPS.FPS60; break; case 3: SavedDataStore.SelectedFPS = SaveData.CaptureFPS.FPS120; break; } }); s.CreateAndAddLabelBoxRow(view, lID, "DETECTORES"); s.CreateAndAddDescriptionRow2(view, lID, "Selecione o Detector desejado conforme sua necessidade. Você também pode " + "habilitar ou desabilitar a reprodução de som e vibração ao encontrar um objeto válido."); var options = new[] { "Modelos de Motocicletas", "Objetos em Geral" }; s.CreateAndAddSpinnerRow(view, lID, "Detector", options, (int)SavedDataStore.SelectedDetector, (o, e, re) => { switch (re.SelectedItemPosition) { case 0: SavedDataStore.SelectedDetector = SaveData.DetectorType.MotorcycleModels; break; case 1: SavedDataStore.SelectedDetector = SaveData.DetectorType.Objects; break; } }); s.CreateAndAddCheckBoxRow(view, lID, "Vibrar", SavedDataStore.Vibrate, (o, e, be) => { SavedDataStore.Vibrate = be.Checked; }); s.CreateAndAddCheckBoxRow(view, lID, "Reproduzir Som", SavedDataStore.PlaySound, (o, e, be) => { SavedDataStore.PlaySound = be.Checked; }); s.CreateAndAddSpinnerRow(view, lID, "Velocidade de Análise (FPS)", dfps, (int)SavedDataStore.DetectionFPS, (o, e, re) => { switch (re.SelectedItemPosition) { case 0: SavedDataStore.DetectionFPS = SaveData.DetectorFPS.FPS1; break; case 1: SavedDataStore.DetectionFPS = SaveData.DetectorFPS.FPS5; break; case 2: SavedDataStore.DetectionFPS = SaveData.DetectorFPS.FPS10; break; case 3: SavedDataStore.DetectionFPS = SaveData.DetectorFPS.FPS15; break; case 4: SavedDataStore.DetectionFPS = SaveData.DetectorFPS.FPS30; break; case 5: SavedDataStore.DetectionFPS = SaveData.DetectorFPS.FPS60; break; } }); s.CreateAndAddLabelBoxRow(view, lID, "SOBRE"); s.CreateAndAddButtonRow(view, lID, "Sobre o MotoDetector", (o, e, b) => { var alert2 = new AlertDialog.Builder(this); var view2 = new AboutView(this); alert2.SetView(view2); alert2.SetCancelable(false); alert2.SetPositiveButton("OK", (sender, e2) => { }); alert2.Create().Show(); }); alert.SetCancelable(true); alert.SetNegativeButton("CANCELAR", (sender, e2) => { }); alert.SetPositiveButton("OK", (sender, e2) => { SavedDataStore.Save(); UpdateCameraSettings(); RunOnUiThread(() => { ConfigureCapture(); }); }); alert.Create().Show(); }
// 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 void DisplayMotoDetails() { if (DetectedPlate == "" && DetectedMotoModel == "") { return; } var alert = new AlertDialog.Builder(this); var view = new BlankView(this); alert.SetView(view); var lID = Resource.Id.BlankLayoutContainer; if (DetectedPlate != "") { s.CreateAndAddLabelBoxRow(view, lID, "VERIFICAR PLACA"); s.CreateAndAddLabelBoxRow(view, lID, "Placa: " + DetectedPlate); s.CreateAndAddDescriptionRow2(view, lID, "Insira a placa detectada nos campos abaixo para verificar marca, modelo e outras informações do veículo."); s.CreateAndAddDescriptionRow2(view, lID, ""); var url = "https://cidadao.sinesp.gov.br/sinesp-cidadao/"; var web = new Android.Webkit.WebView(this); web.LoadUrl(url); LinearLayout.LayoutParams param2 = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.WrapContent, 1.0f); param2.LeftMargin = (int)(5 + 0.5f); param2.RightMargin = (int)(5 + 0.5f); param2.TopMargin = (int)(5 + 0.5f); param2.BottomMargin = (int)(5 + 0.5f); param2.Weight = 1.0f; web.LayoutParameters = param2; var layout = view.FindViewById <LinearLayout>(lID); layout.AddView(web); } else { if (MotosList.ContainsKey(DetectedMotoModel)) { s.CreateAndAddLabelBoxRow(view, lID, "INFORMAÇÕES"); var moto = MotosList[DetectedMotoModel]; s.CreateAndAddDescriptionRow(view, lID, "Fabricante", moto.Fabricante); s.CreateAndAddDescriptionRow(view, lID, "Modelo", moto.Modelo); s.CreateAndAddDescriptionRow(view, lID, "Ciclo", moto.Ciclo); s.CreateAndAddDescriptionRow(view, lID, "Cilindrada (cm3)", moto.Volume); s.CreateAndAddDescriptionRow(view, lID, "Potência (cv)", moto.Potencia); s.CreateAndAddDescriptionRow(view, lID, "Peso (kg)", moto.Peso); s.CreateAndAddDescriptionRow(view, lID, "Peso/Potência (kg/cv)", moto.Peso_Pot); s.CreateAndAddDescriptionRow(view, lID, "Comprimento (mm)", moto.Comprimento); s.CreateAndAddDescriptionRow(view, lID, "Largura (mm)", moto.Largura); s.CreateAndAddDescriptionRow(view, lID, "Altura (mm)", moto.Altura); s.CreateAndAddDescriptionRow(view, lID, "Altura do Assento (mm)", moto.Altura_Assento); } } alert.SetCancelable(true); alert.SetPositiveButton("OK", (sender, e2) => { }); alert.Create().Show(); }
private void ReasonAlert() { AlertDialog.Builder builder = new AlertDialog.Builder(this, Resource.Style.AlertDialogStyle); View dialogView = LayoutInflater.Inflate(Resource.Layout.AlertItem, null); EditText redenedit = dialogView.FindViewById<EditText> (Resource.Id.EditAmount); redenedit.FocusChange += delegate { if(redenedit.HasFocus) redenedit.Text = ""; }; builder.SetTitle("Enter the occasion of your debt"); builder.SetPositiveButton("Confirm", (senderAlert, e) => { CreateDebts(redenedit.Text); }); builder.SetNeutralButton("Cancel", (senderAlert, e) => { //cancelt de dialog }); builder.SetView(dialogView); builder.SetCancelable(true); builder.Show (); }
void OnItemClick(object sender, ListItemEventArgs args) { AlertDialog.Builder builder = new AlertDialog.Builder(this, Resource.Style.AlertDialogStyle); View dialogView = LayoutInflater.Inflate(Resource.Layout.NumberAlertItem, null); EditText Amount = dialogView.FindViewById<EditText> (Resource.Id.EditAmount); Amount.FocusChange += delegate { if(Amount.HasFocus) Amount.Text = ""; }; var tempItem = _adapter.Items[args.Position]; builder.SetTitle("Enter the amount of your payment"); builder.SetPositiveButton("Send", (senderAlert, e) => { Aflossen(tempItem.Name, System.Convert.ToDouble(Amount.Text)); }); builder.SetNeutralButton("Cancel", (senderAlert, e) => { // yay cancel }); builder.SetView(dialogView); builder.SetCancelable(true); builder.Show(); }
/// <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(); }
private void ShowDialog(ListItemAdapter adapter, int itemPosition, string dialogTitle, bool isPayment, bool isHistory) { AlertDialog.Builder builder = new AlertDialog.Builder(this.Activity, Resource.Style.AlertDialogStyle); var debtItem = adapter.Items[itemPosition]; builder.SetTitle(dialogTitle); 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); } 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(); }