public Dialog Show() { var item = rss.channels[0].items[rss.channels[0].items.Count - 1]; var view = LayoutInflater.From(context).Inflate(Resource.Layout.dialog_rss, null); var title = view.FindViewById <TextView>(Resource.Id.title); var content = view.FindViewById <TextView>(Resource.Id.content); title.Text = item.title; content.Text = Html.FromHtml(item.description).ToString(); var adb = new IONAlertDialog(context); adb.SetPositiveButton(Resource.String.open, (sender, e) => { var uri = Android.Net.Uri.Parse(item.link); var intent = new Intent(); intent.SetData(uri); intent.AddFlags(ActivityFlags.NewTask); context.StartActivity(intent); }); adb.SetNegativeButton(Resource.String.close, (sender, e) => { }); adb.SetTitle(Resource.String.rss); adb.SetView(view); var ret = adb.Create(); ret.Show(); return(ret); }
/// <summary> /// Creates a new UnitDialog that will allow the user to select a unit. /// </summary> /// <param name="context">Context.</param> /// <param name="units">Units.</param> public static AlertDialog Create(Context context, IEnumerable <Unit> units, EventHandler <Unit> unitSelectionEvent) { var adb = new IONAlertDialog(context); adb.SetTitle(Resource.String.pick_unit); adb.SetItems(UnitsToString(units), (obj, args) => { unitSelectionEvent(adb, units.ElementAt(args.Which)); }); adb.SetCancelable(true); return(adb.Create()); }
/// <summary> /// Shows the dialog. /// </summary> /// <param name="context">Context.</param> public AlertDialog Show(Context context) { var adb = new IONAlertDialog(context); adb.SetTitle(title); adb.SetMessage(message); var entry = new EditText(context); entry.Hint = hint; entry.Text = initialValue + ""; entry.InputType = Android.Text.InputTypes.NumberFlagDecimal; adb.SetView(entry); AlertDialog ret = null; adb.SetNegativeButton(context.GetString(Resource.String.cancel), (obj, args) => { var dialog = obj as Android.App.Dialog; dialog.Dismiss(); }); adb.SetPositiveButton(context.GetString(Resource.String.ok_done), (obj, args) => { var dialog = obj as Android.App.Dialog; try { if (string.IsNullOrEmpty(entry.Text)) { handler(ret, 0); } else { var number = double.Parse(entry.Text); if (handler != null) { handler(ret, number); } } dialog.Dismiss(); } catch (Exception) { Toast.MakeText(context, Resource.String.please_enter_valid_number, ToastLength.Long).Show(); } }); ret = adb.Create(); ret.Show(); return(ret); }