本文整理汇总了C#中Android.App.AlertDialog.Builder.SetMultiChoiceItems方法的典型用法代码示例。如果您正苦于以下问题:C# AlertDialog.Builder.SetMultiChoiceItems方法的具体用法?C# AlertDialog.Builder.SetMultiChoiceItems怎么用?C# AlertDialog.Builder.SetMultiChoiceItems使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Android.App.AlertDialog.Builder
的用法示例。
在下文中一共展示了AlertDialog.Builder.SetMultiChoiceItems方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: PerformClick
public override bool PerformClick()
{
var builder = new AlertDialog.Builder(context);
builder.SetMultiChoiceItems(items, selection, this);
builder.Show();
return true;
}
示例2: OnCreateDialog
protected override Dialog OnCreateDialog(int id)
{
switch (id) {
case DIALOG_YES_NO_MESSAGE: {
var builder = new AlertDialog.Builder (this);
builder.SetIconAttribute (Android.Resource.Attribute.AlertDialogIcon);
builder.SetTitle (Resource.String.alert_dialog_two_buttons_title);
builder.SetPositiveButton (Resource.String.alert_dialog_ok, OkClicked);
builder.SetNegativeButton (Resource.String.alert_dialog_cancel, CancelClicked);
return builder.Create ();
}
case DIALOG_YES_NO_OLD_SCHOOL_MESSAGE: {
var builder = new AlertDialog.Builder (this, Android.App.AlertDialog.ThemeTraditional);
builder.SetIconAttribute (Android.Resource.Attribute.AlertDialogIcon);
builder.SetTitle (Resource.String.alert_dialog_two_buttons_title);
builder.SetPositiveButton (Resource.String.alert_dialog_ok, OkClicked);
builder.SetNegativeButton (Resource.String.alert_dialog_cancel, CancelClicked);
return builder.Create ();
}
case DIALOG_YES_NO_HOLO_LIGHT_MESSAGE: {
var builder = new AlertDialog.Builder (this, Android.App.AlertDialog.ThemeHoloLight);
builder.SetIconAttribute (Android.Resource.Attribute.AlertDialogIcon);
builder.SetTitle (Resource.String.alert_dialog_two_buttons_title);
builder.SetPositiveButton (Resource.String.alert_dialog_ok, OkClicked);
builder.SetNegativeButton (Resource.String.alert_dialog_cancel, CancelClicked);
return builder.Create ();
}
case DIALOG_YES_NO_LONG_MESSAGE: {
var builder = new AlertDialog.Builder (this);
builder.SetIconAttribute (Android.Resource.Attribute.AlertDialogIcon);
builder.SetTitle (Resource.String.alert_dialog_two_buttons_msg);
builder.SetMessage (Resource.String.alert_dialog_two_buttons_msg);
builder.SetPositiveButton (Resource.String.alert_dialog_ok, OkClicked);
builder.SetNegativeButton (Resource.String.alert_dialog_cancel, CancelClicked);
builder.SetNeutralButton (Resource.String.alert_dialog_something, NeutralClicked);
return builder.Create ();
}
case DIALOG_YES_NO_ULTRA_LONG_MESSAGE: {
var builder = new AlertDialog.Builder (this);
builder.SetIconAttribute (Android.Resource.Attribute.AlertDialogIcon);
builder.SetTitle (Resource.String.alert_dialog_two_buttons_msg);
builder.SetMessage (Resource.String.alert_dialog_two_buttons2ultra_msg);
builder.SetPositiveButton (Resource.String.alert_dialog_ok, OkClicked);
builder.SetNegativeButton (Resource.String.alert_dialog_cancel, CancelClicked);
builder.SetNeutralButton (Resource.String.alert_dialog_something, NeutralClicked);
return builder.Create ();
}
case DIALOG_LIST: {
var builder = new AlertDialog.Builder (this);
builder.SetTitle (Resource.String.select_dialog);
builder.SetItems (Resource.Array.select_dialog_items, ListClicked);
return builder.Create ();
}
case DIALOG_PROGRESS: {
progress_dialog = new ProgressDialog (this);
progress_dialog.SetIconAttribute (Android.Resource.Attribute.AlertDialogIcon);
progress_dialog.SetTitle (Resource.String.select_dialog);
progress_dialog.SetProgressStyle (ProgressDialogStyle.Horizontal);
progress_dialog.Max = MAX_PROGRESS;
progress_dialog.SetButton (Android.App.Dialog.InterfaceConsts.ButtonPositive, GetText (Resource.String.alert_dialog_ok), OkClicked);
progress_dialog.SetButton (Android.App.Dialog.InterfaceConsts.ButtonNegative, GetText (Resource.String.alert_dialog_cancel), CancelClicked);
return progress_dialog;
}
case DIALOG_SINGLE_CHOICE: {
var builder = new AlertDialog.Builder (this);
builder.SetIconAttribute (Android.Resource.Attribute.AlertDialogIcon);
builder.SetTitle (Resource.String.alert_dialog_single_choice);
builder.SetSingleChoiceItems (Resource.Array.select_dialog_items2, 0, ListClicked);
builder.SetPositiveButton (Resource.String.alert_dialog_ok, OkClicked);
builder.SetNegativeButton (Resource.String.alert_dialog_cancel, CancelClicked);
return builder.Create ();
}
case DIALOG_MULTIPLE_CHOICE: {
var builder = new AlertDialog.Builder (this);
builder.SetIcon (Resource.Drawable.ic_popup_reminder);
builder.SetTitle (Resource.String.alert_dialog_multi_choice);
builder.SetMultiChoiceItems (Resource.Array.select_dialog_items3, new bool[] { false, true, false, true, false, false, false }, MultiListClicked);
builder.SetPositiveButton (Resource.String.alert_dialog_ok, OkClicked);
builder.SetNegativeButton (Resource.String.alert_dialog_cancel, CancelClicked);
return builder.Create ();
}
case DIALOG_MULTIPLE_CHOICE_CURSOR: {
var projection = new string[] { BaseColumns.Id, Contacts.PeopleColumns.DisplayName, Contacts.PeopleColumns.SendToVoicemail };
var cursor = ManagedQuery (ContactsContract.Contacts.ContentUri, projection, null, null, null);
var builder = new AlertDialog.Builder (this);
builder.SetIcon (Resource.Drawable.ic_popup_reminder);
builder.SetTitle (Resource.String.alert_dialog_multi_choice_cursor);
//.........这里部分代码省略.........
示例3: OnCreateDialog
//This is deprecated in API level 8
//protected override Dialog OnCreateDialog(int id)
//This is deprecated in API level 13
protected override Dialog OnCreateDialog(int id, Bundle args)
{
switch(id)
{
case AlertDialog:
{
var builder = new AlertDialog.Builder(this);
builder.SetIconAttribute(Android.Resource.Attribute.AlertDialogIcon);
builder.SetTitle(Resource.String.bomb_dialog_title);
builder.SetPositiveButton(Resource.String.dialog_signal, (s, e) => { /*Do something here!*/ });
builder.SetNegativeButton(Resource.String.dialog_main_screen, (s, e) => { });
return builder.Create();
}
case ListDialog:
{
var builder = new AlertDialog.Builder(this);
builder.SetIconAttribute(Android.Resource.Attribute.AlertDialogIcon);
builder.SetTitle(Resource.String.list_dialog_title);
builder.SetSingleChoiceItems(Resource.Array.list_dialog_items, 0, ListClicked);
builder.SetPositiveButton(Resource.String.dialog_ok, OkClicked);
builder.SetNegativeButton(Resource.String.dialog_cancel, CancelClicked);
return builder.Create();
}
case MultiChoiceDialog:
{
var builder = new AlertDialog.Builder(this, Android.App.AlertDialog.ThemeHoloLight);
builder.SetIcon(Resource.Drawable.Icon);
builder.SetTitle(Resource.String.multi_choice_dialog_title);
builder.SetMultiChoiceItems(Resource.Array.multilist_dialog_items,
new[] { false, true, false, true }, MultiListClicked);
builder.SetPositiveButton(Resource.String.dialog_ok, OkClicked);
builder.SetNegativeButton(Resource.String.multi_dialog_cancel, CancelClicked);
return builder.Create();
}
case CustomViewDialog:
{
var customView = LayoutInflater.Inflate (Resource.Layout.CustomDialog, null);
var builder = new AlertDialog.Builder (this);
builder.SetView(customView);
builder.SetPositiveButton (Resource.String.dialog_ok, OkClicked);
builder.SetNegativeButton (Resource.String.dialog_cancel, CancelClicked);
return builder.Create ();
}
}
return base.OnCreateDialog(id, args);
}
示例4: OnCreateView
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
{
// Use this to return your custom view for this Fragment
// return inflater.Inflate(Resource.Layout.YourFragment, container, false);
base.OnCreateView (inflater, container, savedInstanceState);
View rootView = inflater.Inflate (Resource.Layout.Block1Fragment, container, false);
pharmacyID = Arguments.GetInt (Common.PHARMACY_ID);
user = Common.GetCurrentUser ();
netCategories = Common.GetNetCategories (user.username);
promos = Common.GetPromos (user.username);
merchant = Common.GetMerchant (user.username);
territory = Common.GetTerritory (user.username);
pharmacy = PharmacyManager.GetPharmacy (pharmacyID);
var tradenets = Common.GetTradeNets (user.username);
Dictionary <int, string> tnDict = new Dictionary<int, string> ();
foreach (var item in tradenets) {
tnDict.Add (item.id, item.shortName);
};
attendance = AttendanceManager.GetCurrentAttendance ();
if (attendance == null) {
attendance = AttendanceManager.GetLastAttendance (pharmacyID);
if (attendance == null) {
attendance = new Attendance () {
pharmacy = pharmacyID,
date = DateTime.Now,
merchant = merchant.id
};
} else {
attendance.id = -1;
attendance.date = DateTime.Now;
}
}
rootView.FindViewById<TextView> (Resource.Id.b1fTradenetText).Text = tnDict [pharmacy.tradenet];//@"Аптечная Сеть";
rootView.FindViewById<TextView> (Resource.Id.b1fCityText).Text = territory.baseCity;
rootView.FindViewById<TextView> (Resource.Id.b1fPharmacyNameText).Text = pharmacy.shortName;
rootView.FindViewById<TextView> (Resource.Id.b1fPharmacyAddressText).Text = pharmacy.address;
rootView.FindViewById<TextView> (Resource.Id.b1fCategoryInOTCText).Text = pharmacy.category_otc;
rootView.FindViewById<TextView> (Resource.Id.b1fLastAttendanceText).Text = pharmacy.prev == DateTime.MinValue ? String.Empty : pharmacy.prev.ToString (@"d");
rootView.FindViewById<TextView> (Resource.Id.b1fNextAttendanceText).Text = pharmacy.next == DateTime.MinValue ? String.Empty : pharmacy.next.ToString (@"d");
rootView.FindViewById<TextView> (Resource.Id.b1fAllAttendanciesText).Text = AttendanceManager.GetStatistics(pharmacy.id);
categoryNetSpinner = rootView.FindViewById<Spinner> (Resource.Id.b1fCategoryNetSpinner);
ArrayAdapter adapter = new ArrayAdapter (Activity, Android.Resource.Layout.SimpleSpinnerItem, (from item in netCategories select item.key).ToArray<string>());
adapter.SetDropDownViewResource(Resource.Layout.SpinnerItem);
categoryNetSpinner.Adapter = adapter;
categoryNetSpinner.ItemSelected += (object sender, AdapterView.ItemSelectedEventArgs e) => {
attendance.category_net = netCategories[e.Position].id;
};
// SetValue
for (int i = 0; i < netCategories.Count; i++) {
if (netCategories [i].id == attendance.category_net) {
categoryNetSpinner.SetSelection (i);
}
}
telephoneEdit = rootView.FindViewById<EditText> (Resource.Id.b1fTelephoneEdit);
telephoneEdit.Text = attendance.telephone;
purchaserFIOEdit = rootView.FindViewById<EditText> (Resource.Id.b1fPurchaserFIOEdit);
purchaserFIOEdit.Text = attendance.purchaserFIO;
promosEdit = rootView.FindViewById<EditText> (Resource.Id.b1fPromosEdit);
promosButton = rootView.FindViewById<Button> (Resource.Id.b1fPromosButton);
promosButton.Click += (object sender, EventArgs e) => {
bool[] checkedItems = new bool[promos.Count];
if (attendance.promos != null) {
for (int i = 0; i < promos.Count; i++) {
if(attendance.promos.Contains(promos[i].id)){
checkedItems[i] = true;
tempPromos.Add(promos[i].id);
}
}
}
string[] items = (from promo
in promos
orderby promo.id
select promo.name).ToArray<string>();
AlertDialog.Builder builder;
builder = new AlertDialog.Builder(Activity);
builder.SetTitle("Выбор ПРОМО-матералов");
builder.SetCancelable(false);
builder.SetMultiChoiceItems(items, checkedItems, MultiListClicked);
builder.SetPositiveButton(@"Сохранить",
delegate {
attendance.promos = tempPromos.ToArray<int>();
builder.Dispose();
RefreshPromos();
}
);
builder.SetNegativeButton(@"Отмена", delegate { builder.Dispose(); });
builder.Show();
};
RefreshPromos();
//.........这里部分代码省略.........
示例5: DownloadLanguagePackDialog
public Dialog DownloadLanguagePackDialog(Context context)
{
if (AvailableDownloadedLanguages == null)
{
AvailableDownloadedLanguages = GetAvailableLanguages().ToArray();
}
// Clear array, reset the queue
downloadQueue = new List<string>();
string[] available = AvailableDownloadedLanguages;
bool[] toDownload = IsLanguagesDownloaded(available);
string[] availableToDownload = available;
var builder = new AlertDialog.Builder(context);
builder.SetIcon(Resource.Drawable.Icon);
builder.SetTitle("Download Language Packs");
builder.SetCancelable(false);
builder.SetMultiChoiceItems(availableToDownload, toDownload, (sender, e) =>
{
int index = e.Which;
toDownload[index] = e.IsChecked;
});
builder.SetPositiveButton("Ok", (sender, e) =>
{
DownloadLanguagesFromDialog(AvailableDownloadedLanguages, toDownload);
});
builder.SetNegativeButton("Cancel", delegate
{
});
return builder.Create();
}