public void dialodTransacaoAprovadaMsitef(Intent data) { Android.App.AlertDialog alertDialog = new Android.App.AlertDialog.Builder(MainActivity.mContext).Create(); StringBuilder cupom = new StringBuilder(); cupom.Append("CODRESP: " + data.GetStringExtra("CODRESP") + "\n"); cupom.Append("COMP_DADOS_CONF: " + data.GetStringExtra("COMP_DADOS_CONF") + "\n"); cupom.Append("CODTRANS: " + data.GetStringExtra("CODTRANS") + "\n"); cupom.Append("CODTRANS: " + data.GetStringExtra("CODTRANS") + " " + Convert.ToString(retornaTipoParcelamento(Convert.ToInt32(data.GetStringExtra("TIPO_PARC")))) + "\n"); cupom.Append("VLTROCO: " + data.GetStringExtra("VLTROCO") + "\n"); cupom.Append("REDE_AUT: " + data.GetStringExtra("REDE_AUT") + "\n"); cupom.Append("BANDEIRA: " + data.GetStringExtra("BANDEIRA") + "\n"); cupom.Append("NSU_SITEF: " + data.GetStringExtra("NSU_SITEF") + "\n"); cupom.Append("NSU_HOST: " + data.GetStringExtra("NSU_HOST") + "\n"); cupom.Append("COD_AUTORIZACAO: " + data.GetStringExtra("COD_AUTORIZACAO") + "\n"); cupom.Append("NUM_PARC: " + data.GetStringExtra("NUM_PARC") + "\n"); alertDialog.SetTitle("Ação executada com sucesso"); alertDialog.SetMessage(cupom.ToString()); alertDialog.SetButton("OK", delegate { alertDialog.Dismiss(); }); alertDialog.Show(); }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); // Set our view from the "main" layout resource SetContentView(Resource.Layout.Main); var toolbar = FindViewById <Android.Support.V7.Widget.Toolbar>(Resource.Id.toolbar); SetSupportActionBar(toolbar); SupportActionBar.Title = "Flash Light"; btnFlash = FindViewById <ImageView>(Resource.Id.imageView); player = MediaPlayer.Create(this, Resource.Raw.sound_click); btnFlash.Click += delegate { FlashLight(); }; bool hasFlash = ApplicationContext.PackageManager.HasSystemFeature(Android.Content.PM.PackageManager.FeatureCameraFlash); if (!hasFlash) { Android.App.AlertDialog alert = new Android.App.AlertDialog.Builder(this).Create(); alert.SetTitle("Error"); alert.SetMessage("Sorry,your device doesn't support flash light"); alert.SetButton("OK", (s, e) => { return; }); alert.Show(); } getCamera(); }
public CustomDialog(View view, string title, string body, Action callback) { Android.App.AlertDialog alertDialog = new Android.App.AlertDialog.Builder(view.Context).Create(); alertDialog.SetTitle(title); alertDialog.SetMessage(body); alertDialog.SetButton("確認", (senderAlert, args) => { callback?.Invoke(); }); alertDialog.Show(); }
public CustomDialog(View view, string title, string body, Action <bool> callback) { Android.App.AlertDialog alertDialog = new Android.App.AlertDialog.Builder(view.Context).Create(); alertDialog.SetTitle(title); alertDialog.SetMessage(body); alertDialog.SetButton2("はい", (sender, e) => { callback(true); }); alertDialog.SetButton("いいえ", (sender, e) => { callback(false); }); alertDialog.Show(); }
private void alert(String message) { Android.App.AlertDialog alertDialog = new Android.App.AlertDialog.Builder(Impressora.impressoraActivity).Create(); alertDialog.SetTitle("Alerta"); alertDialog.SetMessage(message); alertDialog.SetButton("OK", delegate { alertDialog.Dismiss(); }); alertDialog.Show(); }
public static void Alert(String titleAlert, String message) { Android.App.AlertDialog AlertDialog = new Android.App.AlertDialog.Builder(context).Create(); AlertDialog.SetTitle(titleAlert); AlertDialog.SetMessage(message); AlertDialog.SetButton("OK", delegate { AlertDialog.Dismiss(); }); AlertDialog.Show(); }
public void saveForm_Click12(object sender, EventArgs e) { //De ce nu merge sa salvez recordu in baza dedate si sa stau pe form in continuare? Android.App.AlertDialog cat = new Android.App.AlertDialog.Builder(Activity).Create(); //cat.SetMessage("Location : " + formLocation + " || Date :" + formDate + " || Note : " + formNote); cat.SetMessage("Location"); cat.SetTitle("message title"); cat.SetButton("OK", delegate { }); cat.Show(); }
private void LvContact_ItemLongClick(object sender, AdapterView.ItemLongClickEventArgs e) { Contact contact = contacts[e.Position]; var alert = new Android.App.AlertDialog.Builder(this).Create(); alert.SetTitle("Kasowanie kontaktu"); alert.SetMessage(string.Format("Usunąć {0}", contact.Name)); alert.SetButton("Tak", delegate { contacts.Remove(contact); adapter.NotifyDataSetChanged(); }); alert.SetButton2("Nie", delegate { }); alert.Show(); }
private void ItemLongClicked(object sender, AdapterView.ItemLongClickEventArgs args) { var contact = contacts[args.Position]; var alert = new Android.App.AlertDialog.Builder(this).Create(); alert.SetTitle("Delete contact"); alert.SetMessage(string.Format("Are you sure you want to delete {0}?", contact.Name)); alert.SetButton("Yes", delegate { contacts.Remove(contact); adapter.NotifyDataSetChanged(); }); alert.SetButton2("No", delegate { }); alert.Show(); }
public void dialodTransacaoNegadaMsitef(Intent data) { Android.App.AlertDialog alertDialog = new Android.App.AlertDialog.Builder(MainActivity.mContext).Create(); StringBuilder cupom = new StringBuilder(); cupom.Append("CODRESP: " + data.GetStringExtra("CODRESP") + "\n"); alertDialog.SetTitle("Ocorreu um erro durante a realização da ação"); alertDialog.SetMessage(cupom.ToString()); alertDialog.SetButton("OK", delegate { alertDialog.Dismiss(); }); alertDialog.Show(); }
public void dialodTransacaoNegadaGer7(OperacaoRetorno retorno) { Android.App.AlertDialog alertDialog = new Android.App.AlertDialog.Builder(MainActivity.mContext).Create(); StringBuilder cupom = new StringBuilder(); cupom.Append("version: " + retorno.version + "\n"); cupom.Append("errcode: " + retorno.errcode + "\n"); cupom.Append("errmsg: " + retorno.errmsg + "\n"); alertDialog.SetTitle("Ocorreu um erro durante a realização da ação"); alertDialog.SetMessage(cupom.ToString()); alertDialog.SetButton("OK", delegate { alertDialog.Dismiss(); }); alertDialog.Show(); }
public void DoSmthNew(object sender, EventArgs e) { var formLocation = Activity.FindViewById <EditText>(Resource.Id.formLocation).Text; var formDate = Activity.FindViewById <EditText>(Resource.Id.formDate).Text; var formNote = Activity.FindViewById <EditText>(Resource.Id.formNote).Text; var record = new AnxityRecords(formLocation, formDate, 3, formNote, "art"); var db = new AnxityDatabase(); db.SaveAnxityRecordAsync(record); Android.App.AlertDialog cat = new Android.App.AlertDialog.Builder(Activity).Create(); cat.SetMessage("Location : " + formLocation + " || Date :" + formDate + " || Note : " + formNote); var trans = Activity.SupportFragmentManager.BeginTransaction(); trans.Replace(Resource.Id.fragmentLayout, new Journal(), "Main_Page"); trans.Commit(); cat.SetTitle("message title"); cat.SetButton("OK", delegate { }); cat.Show(); }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); // Set our view from the "main" layout resource SetContentView(Resource.Layout.Main); var toolbar = FindViewById <Android.Support.V7.Widget.Toolbar>(Resource.Id.toolbar); SetSupportActionBar(toolbar); imageView = FindViewById <ImageView>(Resource.Id.imageView); if (bundle != null) { isFlashLight = bundle.GetBoolean("light_status", false); } imageView.Click += delegate { FlashLight(); }; bool hasFlash = ApplicationContext.PackageManager.HasSystemFeature(Android.Content.PM.PackageManager.FeatureCameraFlash); if (!hasFlash) { Android.App.AlertDialog alert = new Android.App.AlertDialog.Builder(this).Create(); alert.SetTitle("Error"); alert.SetMessage("Your device does not support flash light"); alert.SetButton("OK", (s, e) => { return; }); alert.Show(); } getCamera(); }
public void dialodTransacaoAprovadaGer7(OperacaoRetorno retorno) { Android.App.AlertDialog alertDialog = new Android.App.AlertDialog.Builder(MainActivity.mContext).Create(); StringBuilder cupom = new StringBuilder(); cupom.Append("version: " + retorno.version + "\n"); cupom.Append("status: " + retorno.status + "\n"); cupom.Append("config: " + retorno.config + "\n"); cupom.Append("license: " + retorno.license + "\n"); cupom.Append("terminal: " + retorno.terminal + "\n"); cupom.Append("merchant: " + retorno.merchant + "\n"); cupom.Append("id: " + retorno.id + "\n"); cupom.Append("type: " + retorno.type + "\n"); cupom.Append("product: " + retorno.product + "\n"); cupom.Append("response: " + retorno.response + "\n"); cupom.Append("authorization: " + retorno.authorization + "\n"); cupom.Append("amount: " + retorno.amount + "\n"); cupom.Append("installments: " + retorno.installments + "\n"); cupom.Append("instmode: " + retorno.instmode + "\n"); cupom.Append("stan: " + retorno.stan + "\n"); cupom.Append("rrn: " + retorno.rrn + "\n"); cupom.Append("time: " + retorno.time + "\n"); cupom.Append("track2: " + retorno.track2 + "\n"); cupom.Append("aid: " + retorno.aid + "\n"); cupom.Append("cardholder: " + retorno.cardholder + "\n"); cupom.Append("prefname: " + retorno.prefname + "\n"); cupom.Append("errcode: " + retorno.errcode + "\n"); cupom.Append("label: " + retorno.label + "\n"); alertDialog.SetTitle("Ação executada com sucesso"); alertDialog.SetMessage(cupom.ToString()); alertDialog.SetButton("OK", delegate { alertDialog.Dismiss(); }); alertDialog.Show(); }
protected override void OnCreate(Bundle savedInstanceState) { string pass; this.Window.SetFlags(WindowManagerFlags.Secure, WindowManagerFlags.Secure); #region Initialize Activity base.OnCreate(savedInstanceState); Platform.Init(this, savedInstanceState); SetContentView(Resource.Layout.activity_main); #endregion #region Initialize Widget EditText pKey_0 = FindViewById <EditText>(Resource.Id.pKey_0); EditText pKey_1 = FindViewById <EditText>(Resource.Id.pKey_1); EditText pKey_2 = FindViewById <EditText>(Resource.Id.pKey_2); SeekBar seekBar = FindViewById <SeekBar>(Resource.Id.seekBar); CheckBox isHard = FindViewById <CheckBox>(Resource.Id.isHard); CheckBox isShort = FindViewById <CheckBox>(Resource.Id.isShort); Button generate = FindViewById <Button>(Resource.Id.Generate); Button clean = FindViewById <Button>(Resource.Id.Clean); Button randomStr = FindViewById <Button>(Resource.Id.RandomStr); #endregion RefreshLengthDisplay(FindViewById <TextView>(Resource.Id.current_length)); seekBar.Max = 4; seekBar.Min = 0; seekBar.ProgressChanged += (sender, e) => { Seekbar2Length(seekBar); }; generate.Click += (sender, e) => { Core.Core core = new Core.Core(); pass = core.EncryptMyPass(pKey_0.Text, pKey_1.Text, pKey_2.Text, isHard.Checked, passLength); if (pass != null && pass != string.Empty && pass != "") { var alertDialog = new Android.App.AlertDialog.Builder(this).Create(); alertDialog.SetTitle(Resources.GetString(Resource.String.alert_title)); alertDialog.SetMessage(Resources.GetString(Resource.String.pass_front) + " " + pass); alertDialog.SetButton(Resources.GetString(Resource.String.ok), (s, a) => { }); alertDialog.SetButton2(Resources.GetString(Resource.String.copy_to_clipboard), async(s, a) => { await Clipboard.SetTextAsync(pass); }); alertDialog.Show(); } else { var alertDialog = new Android.App.AlertDialog.Builder(this).Create(); alertDialog.SetTitle(Resources.GetString(Resource.String.alert_title)); alertDialog.SetMessage(Resources.GetString(Resource.String.null_return)); alertDialog.SetButton(Resources.GetString(Resource.String.ok), (s, a) => { }); alertDialog.SetButton2(Resources.GetString(Resource.String.detail), (s, a) => { var alertDialog2 = new Android.App.AlertDialog.Builder(this).Create(); alertDialog2.SetTitle(Resources.GetString(Resource.String.error_detail)); alertDialog2.SetMessage(Resources.GetString(Resource.String.null_return_code) + "\n" + Resources.GetString(Resource.String.null_return_disc)); alertDialog2.SetButton(Resources.GetString(Resource.String.ok), (n, m) => { }); alertDialog2.Show(); }); alertDialog.Show(); } }; clean.Click += (sender, e) => pKey_0.Text = pKey_1.Text = pKey_2.Text = string.Empty; isShort.CheckedChange += (sender, e) => { if (isShort.Checked) { var alertDialog = new Android.App.AlertDialog.Builder(this).Create(); alertDialog.SetTitle(Resources.GetString(Resource.String.warning)); alertDialog.SetMessage(Resources.GetString(Resource.String.lowlength_warning)); alertDialog.SetButton(Resources.GetString(Resource.String.confirm), (s, a) => { ShortMode = true; Seekbar2Length(seekBar); }); alertDialog.SetButton2(Resources.GetString(Resource.String.cancle), (s, a) => { ShortMode = false; isShort.Checked = false; Seekbar2Length(seekBar); }); alertDialog.Show(); } else { ShortMode = false; Seekbar2Length(seekBar); } }; randomStr.Click += (sender, e) => { char[] CharPool = new char[passLength + 5]; for (int loop = 0; loop < passLength; loop++) { CharPool[loop] = Int2Char(RandomInt(isHard.Checked)); } string str = new string(CharPool); var alertDialog = new Android.App.AlertDialog.Builder(this).Create(); alertDialog.SetTitle(Resources.GetString(Resource.String.alert_title)); alertDialog.SetMessage(str); alertDialog.SetButton(Resources.GetString(Resource.String.ok), (s, a) => { }); alertDialog.SetButton2(Resources.GetString(Resource.String.copy_to_clipboard), async(s, a) => { await Clipboard.SetTextAsync(str); }); alertDialog.Show(); }; }
protected override void OnCreate(Bundle savedInstanceState) { string mode = "chs"; //CHS or ENG or CXG long currentTime; int fastClickCounter = 0; long lastClickTime = 0; int fastClickCounter4Chouxiang = 0; long lastClickTime4Chouxiang = 0; base.OnCreate(savedInstanceState); Xamarin.Essentials.Platform.Init(this, savedInstanceState); SetContentView(Resource.Layout.activity_main); #region Widget Button btn_generate = FindViewById <Button>(Resource.Id.generate); EditText et_theme = FindViewById <EditText>(Resource.Id.theme); EditText et_output = FindViewById <EditText>(Resource.Id.output); Button btn_switch = FindViewById <Button>(Resource.Id.btnswitch); #endregion Chouxiang chouxiang = new Chouxiang(); ShitEnglish shitEnglish = new ShitEnglish(); et_theme.Text = Shit.theme; btn_generate.Click += (sender, e) => { currentTime = DateTime.Now.Ticks; if (fastClickCounter == 0) { fastClickCounter += 1; lastClickTime = currentTime; } else { if (currentTime - lastClickTime <= 10000000) { fastClickCounter += 1; lastClickTime = currentTime; } else { fastClickCounter = 0; } } if (fastClickCounter == 10) { Toast.MakeText(Application.Context, "BullshitGenerator by menzi11\nBullshitGenerator.Android by Kevin\nEnglish algorithm by JIUYANGZH\nMIT License\nKevin ♥ Jiangyu & .NET", ToastLength.Long).Show(); fastClickCounter = 0; //Replace counter } switch (mode.ToLower()) { case "chs": et_output.Text = Shit.GenerateArticle(et_theme.Text); break; case "eng": et_output.Text = shitEnglish.Generate(et_theme.Text).Replace(" .\n", "").Replace(" .\n", ""); break; case "cxg": et_output.Text = chouxiang.ChangeChouxiang(Shit.GenerateArticle(et_theme.Text)); //TODO: Do some chouxiang break; } }; btn_generate.LongClick += (sender, e) => { var alertDialog = new Android.App.AlertDialog.Builder(this).Create(); alertDialog.SetTitle(Resources.GetString(Resource.String.info)); alertDialog.SetMessage(Resources.GetString(Resource.String.copy_to_clipboard)); alertDialog.SetButton(Resources.GetString(Resource.String.ok), async(s, a) => { await Clipboard.SetTextAsync(et_output.Text); }); alertDialog.SetButton2(Resources.GetString(Resource.String.cancle), (s, a) => { }); alertDialog.Show(); }; btn_switch.Click += (sender, e) => { currentTime = DateTime.Now.Ticks; if (fastClickCounter4Chouxiang == 0) { fastClickCounter4Chouxiang += 1; lastClickTime4Chouxiang = currentTime; } else { if (currentTime - lastClickTime4Chouxiang <= 10000000) { fastClickCounter4Chouxiang += 1; lastClickTime4Chouxiang = currentTime; } else { fastClickCounter4Chouxiang = 0; } } if (fastClickCounter4Chouxiang == 5) { mode = "cxg"; btn_switch.SetTextColor(Android.Content.Res.ColorStateList.ValueOf(Color.Red)); fastClickCounter4Chouxiang = 0; var alertDialog = new Android.App.AlertDialog.Builder(this).Create(); alertDialog.SetTitle(Resources.GetString(Resource.String.info)); alertDialog.SetMessage(Resources.GetString(Resource.String.cxg_mode_on)); alertDialog.SetButton(Resources.GetString(Resource.String.ok), (s, a) => { }); alertDialog.Show(); } else { switch (mode.ToLower()) { case "chs": case "cxg": if (et_theme.Text == "一天掉多少根头发") { et_theme.Text = shitEnglish.theme; } mode = "eng"; btn_switch.Text = Resources.GetString(Resource.String.switch_chs); break; case "eng": mode = "chs"; if (et_theme.Text == shitEnglish.theme) { et_theme.Text = Shit.theme; } btn_switch.Text = Resources.GetString(Resource.String.switch_eng); break; default: throw new IndexOutOfRangeException(); } btn_switch.SetTextColor(Android.Content.Res.ColorStateList.ValueOf(Color.Black)); } }; }
public void dialogImpressaoGPOS(String texto, int size, string api) { MainActivity.printer = new GertecPrinter(MainActivity.mContext); MainActivity.configPrint = new ConfigPrint(); MainActivity.printer.setConfigImpressao(MainActivity.configPrint); //Console.WriteLine("Texto: " + texto.IndexOf("\n")); Android.App.AlertDialog alertDialog = new Android.App.AlertDialog.Builder(MainActivity.mContext).Create(); StringBuilder cupom = new StringBuilder(); cupom.Append("Deseja realizar a impressão pela aplicação?"); alertDialog.SetTitle("Realizar Impressão"); alertDialog.SetMessage(cupom.ToString()); alertDialog.SetButton("Sim", OkAction); alertDialog.SetButton2("Não", CancelAction); alertDialog.Show(); void OkAction(object sender, DialogClickEventArgs e) { String textoEstabelecimento = ""; String textoCliente = ""; MainActivity.configPrint.Alinhamento = ("LEFT"); MainActivity.configPrint.Fonte = ("MONOSPACE"); MainActivity.configPrint.Tamanho = (size); MainActivity.configPrint.Negrito = (true); MainActivity.configPrint.Italico = (false); MainActivity.configPrint.SubLinhado = (false); try { MainActivity.printer.getStatusImpressora(); if (MainActivity.printer.IsImpressoraOK()) { MainActivity.printer.setConfigImpressao(MainActivity.configPrint); //Console.WriteLine("GertecPrinter" + printer); if (api.Equals("GER7")) { textoEstabelecimento = texto.Substring(0, texto.IndexOf("\f")); //Console.WriteLine("Aqui " + texto.Substring(0, texto.IndexOf("\f"))); textoCliente = texto.Substring(texto.IndexOf("\f")); //printer.ImprimeTexto(textoEstabelecimento); ImprimaGer7(textoEstabelecimento); MainActivity.printer.AvancaLinha(100); ImprimaGer7(textoCliente); //printer.ImprimeTexto(textoCliente); } else { MainActivity.printer.ImprimeTexto(texto); } MainActivity.printer.AvancaLinha(150); } MainActivity.printer.ImpressoraOutput(); } catch (System.Exception) { Console.WriteLine(System.Environment.StackTrace); } } void CancelAction(object sender, DialogClickEventArgs e) { //não faz nada //Console.WriteLine("Não faz nada aqui"); } }