本文整理汇总了C#中Android.App.AlertDialog.Builder.SetItems方法的典型用法代码示例。如果您正苦于以下问题:C# AlertDialog.Builder.SetItems方法的具体用法?C# AlertDialog.Builder.SetItems怎么用?C# AlertDialog.Builder.SetItems使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Android.App.AlertDialog.Builder
的用法示例。
在下文中一共展示了AlertDialog.Builder.SetItems方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnCreate
protected override void OnCreate (Bundle savedInstanceState)
{
base.OnCreate (savedInstanceState);
SetContentView (Resource.Layout.activity_events);
base.debugTextView = (EditText)FindViewById (Resource.Id.debug_output_field_events);
selectEventButton = (Button)FindViewById (Resource.Id.select_event_button);
sendEventButton = (Button)FindViewById (Resource.Id.send_event_button);
EventHandler<DialogClickEventArgs> handler = (s, o) => {
// save off selected event
selectEventButton.Text = items [o.Which];
lastSelectedEvent = items [o.Which];
sendEventButton.Enabled = true;
};
selectEventButton.Click += (sender, e) => {
AlertDialog.Builder builder = new AlertDialog.Builder (this);
builder.SetTitle ("Select Event");
builder.SetItems (items, handler);
builder.Show();
};
// set up click listener for when event is sent
sendEventButton.Click += (sender, e) => {
tapjoyEvent = new TJEvent(this, lastSelectedEvent, null, eventCallback);
tapjoyEvent.EnableAutoPresent(true);
tapjoyEvent.Send();
};
}
示例2: ShowEditSelectionDialog
public Task<ModifyOperation> ShowEditSelectionDialog()
{
tcs = new TaskCompletionSource<ModifyOperation>();
var builder = new AlertDialog.Builder(Mvx.Resolve<IMvxAndroidCurrentTopActivity>().Activity);
builder.SetTitle(Strings.ChooseLabel);
builder.SetItems(itemsForEditList.ToArray(), OnSelectItemForCreation);
builder.SetNegativeButton(Strings.CancelLabel, (d, t) => (d as Dialog).Dismiss());
builder.Show();
return tcs.Task;
}
示例3: CreateDialog
protected override Dialog CreateDialog(Context context)
{
var setting = Cell as SelectionSetting;
var builder = new AlertDialog.Builder(context);
builder.SetTitle(setting.Title);
var options = setting.Options;
builder.SetItems(options.Values.ToArray<string>(), new SelectionApplier {
Values = options.Keys.ToList<string>(),
Setting = setting
});
return builder.Create();
}
示例4: ShowListPopup
public static void ShowListPopup(Context context, int titleId, int itemArray, Action<int> callback)
{
var themeId = Settings.DarkTheme ? Resource.Style.AlertThemeDark : Resource.Style.AlertThemeLight;
var builder = new AlertDialog.Builder(new ContextThemeWrapper(context, themeId));
builder.SetTitle(titleId);
builder.SetIcon(Resource.Drawable.ic_launcher);
builder.SetItems(itemArray, (sender, args) => callback(args.Which));
builder.SetCancelable(true);
builder.SetNegativeButton(Resource.String.cancel, delegate { });
var alertDialog = builder.Create();
alertDialog.Show();
}
示例5: ActionSheet
public override void ActionSheet(ActionSheetConfig config)
{
var array = config
.Options
.Select(x => x.Text)
.ToArray();
var dlg = new AlertDialog
.Builder(this.getTopActivity())
.SetCancelable(false)
.SetTitle(config.Title);
dlg.SetItems(array, (sender, args) => config.Options[args.Which].Action.TryExecute());
if (config.Destructive != null)
dlg.SetNegativeButton(config.Destructive.Text, (sender, e) => config.Destructive.Action.TryExecute());
if (config.Cancel != null)
dlg.SetNeutralButton(config.Cancel.Text, (sender, e) => config.Cancel.Action.TryExecute());
Utils.RequestMainThread(() => dlg.Show());
}
示例6: OnElementChanged
protected override void OnElementChanged(ElementChangedEventArgs<Page> e)
{
base.OnElementChanged(e);
var page = e.NewElement as MainPage;
if (page != null) {
MessagingCenter.Subscribe(page, "KillActionSheet", (MainPage sender) => {
if (actionSheet != null) actionSheet.Dismiss();
});
MessagingCenter.Subscribe(page, "DisplayCustomAndroidActionSheet", (MainPage sender, CustomAndroidActionSheetArguments args) => {
var builder = new AlertDialog.Builder (Forms.Context);
builder.SetTitle(args.Title);
var items = args.Buttons.ToArray();
builder.SetItems(items, (sender2, args2) => args.Result.TrySetResult(items[args2.Which]));
if (args.Cancel != null)
builder.SetPositiveButton(args.Cancel, delegate {
args.Result.TrySetResult(args.Cancel);
});
if (args.Destruction != null)
builder.SetNegativeButton(args.Destruction, delegate {
args.Result.TrySetResult(args.Destruction);
});
actionSheet = builder.Create();
builder.Dispose();
actionSheet.SetCanceledOnTouchOutside(true);
actionSheet.CancelEvent += (sender3, ee) => args.SetResult(null);
actionSheet.Show();
});
}
}
示例7: OnOptionsItemSelected
public override bool OnOptionsItemSelected (IMenuItem item)
{
//Show a list of theme choices to pick from
var adBuilder = new AlertDialog.Builder (this);
adBuilder.SetTitle ("Change Theme");
var themeNames = FlatUI.FlatUI.GetThemeNames ();
adBuilder.SetItems (themeNames, (sender, e) =>
{
var newThemeName = themeNames[e.Which];
var newTheme = FlatUI.FlatUI.GetTheme(newThemeName);
ChangeTheme(newTheme);
});
adBuilder.Create ().Show ();
return true;
}
示例8: OnCreateView
//.........这里部分代码省略.........
float revealPercent = MainActivity.IsLandscapeWide( ) ? PrivatePrimaryNavBarConfig.Landscape_RevealPercentage_Android : PrivatePrimaryNavBarConfig.Portrait_RevealPercentage_Android;
// setup the width of the springboard area and campus selector
ProfileContainer = view.FindViewById<LinearLayout>( Resource.Id.springboard_profile_image_container );
ProfileContainer.LayoutParameters.Width = (int) ( displayWidth * revealPercent );
// setup the textView for rendering the user's name when they're logged in "Welcome: Jered"
ProfilePrefix = view.FindViewById<TextView>( Resource.Id.profile_prefix );
ProfilePrefix.SetTypeface( Rock.Mobile.PlatformSpecific.Android.Graphics.FontManager.Instance.GetFont( ControlStylingConfig.Font_Light ), TypefaceStyle.Normal );
ProfilePrefix.SetTextSize( Android.Util.ComplexUnitType.Dip, ControlStylingConfig.Large_FontSize );
ProfilePrefix.SetTextColor( Rock.Mobile.UI.Util.GetUIColor( ControlStylingConfig.Springboard_InActiveElementTextColor ) );
ProfilePrefix.Text = SpringboardStrings.LoggedIn_Prefix;
ProfilePrefix.Measure( 0, 0 );
ProfileName = view.FindViewById<TextView>( Resource.Id.profile_name );
ProfileName.SetTextColor( Rock.Mobile.UI.Util.GetUIColor( ControlStylingConfig.Springboard_InActiveElementTextColor ) );
ProfileName.SetTypeface( Rock.Mobile.PlatformSpecific.Android.Graphics.FontManager.Instance.GetFont( ControlStylingConfig.Font_Bold ), TypefaceStyle.Normal );
ProfileName.SetTextSize( Android.Util.ComplexUnitType.Dip, ControlStylingConfig.Large_FontSize );
ProfileName.SetMaxLines( 1 );
ProfileName.Ellipsize = Android.Text.TextUtils.TruncateAt.End;
CampusContainer = view.FindViewById<View>( Resource.Id.campus_container );
CampusContainer.LayoutParameters.Width = (int) ( displayWidth * revealPercent );
CampusContainer.SetBackgroundColor( Rock.Mobile.UI.Util.GetUIColor( ControlStylingConfig.Springboard_BackgroundColor ) );
View seperator = view.FindViewById<View>( Resource.Id.end_seperator );
seperator.SetBackgroundColor( Rock.Mobile.UI.Util.GetUIColor( ControlStylingConfig.BG_Layer_Color ) );
// setup the bottom campus / settings selector
CampusText = CampusContainer.FindViewById<TextView>( Resource.Id.campus_selection_text );
CampusText.Ellipsize = Android.Text.TextUtils.TruncateAt.End;
CampusText.SetTextColor( Rock.Mobile.UI.Util.GetUIColor( ControlStylingConfig.Springboard_InActiveElementTextColor ) );
CampusText.SetTypeface( Rock.Mobile.PlatformSpecific.Android.Graphics.FontManager.Instance.GetFont( ControlStylingConfig.Font_Regular ), TypefaceStyle.Normal );
CampusText.SetTextSize(Android.Util.ComplexUnitType.Dip, ControlStylingConfig.Small_FontSize );
CampusText.SetSingleLine( );
TextView settingsIcon = CampusContainer.FindViewById<TextView>( Resource.Id.campus_selection_icon );
settingsIcon.SetTypeface( Rock.Mobile.PlatformSpecific.Android.Graphics.FontManager.Instance.GetFont( PrivateControlStylingConfig.Icon_Font_Primary ), TypefaceStyle.Normal );
settingsIcon.SetTextColor( Rock.Mobile.UI.Util.GetUIColor( ControlStylingConfig.Springboard_InActiveElementTextColor ) );
settingsIcon.SetTextSize( Android.Util.ComplexUnitType.Dip, PrivateSpringboardConfig.CampusSelectSymbolSize );
settingsIcon.Text = PrivateSpringboardConfig.CampusSelectSymbol;
// set the campus text to whatever their profile has set for viewing.
CampusText.Text = string.Format( SpringboardStrings.Viewing_Campus, RockGeneralData.Instance.Data.CampusIdToName( RockMobileUser.Instance.ViewingCampus ) ).ToUpper( );
// setup the campus selection button.
Button campusSelectionButton = CampusContainer.FindViewById<Button>( Resource.Id.campus_selection_button );
campusSelectionButton.Click += (object sender, EventArgs e ) =>
{
// build an alert dialog containing all the campus choices
AlertDialog.Builder builder = new AlertDialog.Builder( Activity );
Java.Lang.ICharSequence [] campusStrings = new Java.Lang.ICharSequence[ RockGeneralData.Instance.Data.Campuses.Count ];
for( int i = 0; i < RockGeneralData.Instance.Data.Campuses.Count; i++ )
{
campusStrings[ i ] = new Java.Lang.String( App.Shared.Network.RockGeneralData.Instance.Data.Campuses[ i ].Name );
}
// launch the dialog, and on selection, update the viewing campus text.
builder.SetItems( campusStrings, delegate(object s, DialogClickEventArgs clickArgs)
{
Rock.Mobile.Threading.Util.PerformOnUIThread( delegate
{
// get the ID for the campus they selected
string campusTitle = campusStrings[ clickArgs.Which ].ToString( );
RockMobileUser.Instance.ViewingCampus = RockGeneralData.Instance.Data.CampusNameToId( campusTitle );
// build a label showing what they picked
RefreshCampusSelection( );
});
});
builder.Show( );
};
Billboard = new NotificationBillboard( displayWidth, Rock.Mobile.PlatformSpecific.Android.Core.Context );
Billboard.SetLabel( SpringboardStrings.TakeNotesNotificationIcon,
PrivateControlStylingConfig.Icon_Font_Primary,
ControlStylingConfig.Small_FontSize,
SpringboardStrings.TakeNotesNotificationLabel,
ControlStylingConfig.Font_Light,
ControlStylingConfig.Small_FontSize,
ControlStylingConfig.TextField_ActiveTextColor,
ControlStylingConfig.Springboard_Element_SelectedColor,
delegate
{
// find the Notes task, activate it, and tell it to jump to the read page.
foreach( SpringboardElement element in Elements )
{
if ( element.Task as Droid.Tasks.Notes.NotesTask != null )
{
ActivateElement( element );
PerformTaskAction( PrivateGeneralConfig.TaskAction_NotesRead );
}
}
} );
Billboard.Hide( );
return view;
}
示例9: InternalSetPage
void InternalSetPage(Page page)
{
if (!Forms.IsInitialized)
throw new InvalidOperationException("Call Forms.Init (Activity, Bundle) before this");
if (_canvas != null)
{
_canvas.SetPage(page);
return;
}
var busyCount = 0;
MessagingCenter.Subscribe(this, Page.BusySetSignalName, (Page sender, bool enabled) =>
{
busyCount = Math.Max(0, enabled ? busyCount + 1 : busyCount - 1);
if (!Forms.SupportsProgress)
return;
SetProgressBarIndeterminate(true);
UpdateProgressBarVisibility(busyCount > 0);
});
UpdateProgressBarVisibility(busyCount > 0);
MessagingCenter.Subscribe(this, Page.AlertSignalName, (Page sender, AlertArguments arguments) =>
{
AlertDialog alert = new AlertDialog.Builder(this).Create();
alert.SetTitle(arguments.Title);
alert.SetMessage(arguments.Message);
if (arguments.Accept != null)
alert.SetButton((int)DialogButtonType.Positive, arguments.Accept, (o, args) => arguments.SetResult(true));
alert.SetButton((int)DialogButtonType.Negative, arguments.Cancel, (o, args) => arguments.SetResult(false));
alert.CancelEvent += (o, args) => { arguments.SetResult(false); };
alert.Show();
});
MessagingCenter.Subscribe(this, Page.ActionSheetSignalName, (Page sender, ActionSheetArguments arguments) =>
{
var builder = new AlertDialog.Builder(this);
builder.SetTitle(arguments.Title);
string[] items = arguments.Buttons.ToArray();
builder.SetItems(items, (sender2, args) => { arguments.Result.TrySetResult(items[args.Which]); });
if (arguments.Cancel != null)
builder.SetPositiveButton(arguments.Cancel, delegate { arguments.Result.TrySetResult(arguments.Cancel); });
if (arguments.Destruction != null)
builder.SetNegativeButton(arguments.Destruction, delegate { arguments.Result.TrySetResult(arguments.Destruction); });
AlertDialog dialog = builder.Create();
builder.Dispose();
//to match current functionality of renderer we set cancelable on outside
//and return null
dialog.SetCanceledOnTouchOutside(true);
dialog.CancelEvent += (sender3, e) => { arguments.SetResult(null); };
dialog.Show();
});
_canvas = new Platform(this);
if (_application != null)
_application.Platform = _canvas;
_canvas.SetPage(page);
_layout.AddView(_canvas.GetViewGroup());
}
示例10: SpinnerAnsprechpartner_Touch
void SpinnerAnsprechpartner_Touch(object sender, View.TouchEventArgs e)
{
if (e.Event.Action == MotionEventActions.Up)
{
if (_stateFragment._ansprechpartnern.Count > 0)
{
// If there are Ansprechpartner, just show as default
AlertDialog.Builder builder = new AlertDialog.Builder(_activity);
builder.SetIconAttribute(Android.Resource.Attribute.AlertDialogIcon);
builder.SetTitle(_activity.Resources.GetString(Resource.String.SelectAnsprechpartner));
builder.SetItems(BusinessLayer.Ansprechpartner.ConvertToStringList(_stateFragment._ansprechpartnern,
_activity.BaseContext.Resources.Configuration.Locale.Language.ToUpper()), delegate(object senderDlg, DialogClickEventArgs eDlg)
{
_spinnerAnsprechpartner.SetSelection(eDlg.Which);
_stateFragment.SpinnerItemSelected(eDlg.Which);
});
builder.SetPositiveButton(Android.Resource.String.Ok, delegate(object o, DialogClickEventArgs ea)
{
builder = null;
});
builder.Create();
builder.Show();
}
else
{
// If there is no Ansprechpartner just show a Dialog messaging "There is no Contact"
AlertDialog.Builder builder = new AlertDialog.Builder(_activity);
builder.SetIconAttribute(Android.Resource.Attribute.AlertDialogIcon);
builder.SetTitle(_activity.Resources.GetString(Resource.String.SelectAnsprechpartner));
builder.SetItems(new string[]{_activity.GetString(Resource.String.NoAnsprechpartner)}, delegate(object senderDlg, DialogClickEventArgs eDlg)
{
});
builder.SetPositiveButton(Android.Resource.String.Ok, delegate(object o, DialogClickEventArgs ea)
{
builder = null;
});
builder.Create();
builder.Show();
}
}
}
示例11: SpinnerLand_Touch
void SpinnerLand_Touch(object sender, View.TouchEventArgs e)
{
if (e.Event.Action == MotionEventActions.Up)
{
builder = new AlertDialog.Builder(_activity);
builder.SetIconAttribute(Android.Resource.Attribute.AlertDialogIcon);
builder.SetTitle(_activity.Resources.GetString(Resource.String.SelectCountry));
builder.SetItems(BusinessLayer.Country.ConvertToStringList(BusinessLayer.UtilityClasses.countries,
_activity.BaseContext.Resources.Configuration.Locale.Language.ToUpper()), delegate(object senderDlg, DialogClickEventArgs eDlg)
{
_spinnerLand.SetSelection(eDlg.Which);
});
builder.SetPositiveButton(Android.Resource.String.Ok, delegate(object o, DialogClickEventArgs ea) { builder = null; });
builder.Create();
builder.Show();
}
}
示例12: PlayerView
public PlayerView(Player player, TitleDatabase database, MainActivity activity)
{
this.player = player;
this.database = database;
this.activity = activity;
this.load_button = activity.FindViewById<Button>(Resource.Id.SelectButton);
this.play_button = activity.FindViewById<Button>(Resource.Id.PlayButton);
this.stop_button = activity.FindViewById<Button>(Resource.Id.StopButton);
this.rescan_button = activity.FindViewById<Button>(Resource.Id.RescanButton);
this.seekbar = activity.FindViewById<SeekBar>(Resource.Id.SongSeekbar);
this.title_text_view = activity.FindViewById<TextView>(Resource.Id.SongTitleTextView);
this.timeline_text_view = activity.FindViewById<TextView>(Resource.Id.TimelineTextView);
PlayerEnabled = false;
var ifs = IsolatedStorageFile.GetUserStoreForApplication ();
if (!ifs.FileExists ("songdirs.txt"))
load_button.Enabled = false;
load_button.Click += delegate
{
var db = new AlertDialog.Builder (activity);
db.SetTitle ("Select Music Folder");
List<string> dirlist = new List<string> ();
if (ifs.FileExists ("history.txt"))
dirlist.Add (from_history_tag);
using (var sr = new StreamReader (ifs.OpenFile ("songdirs.txt", FileMode.Open)))
foreach (var s in sr.ReadToEnd ().Split ('\n'))
if (!String.IsNullOrEmpty (s))
dirlist.Add (s);
var dirs = dirlist.ToArray ();
db.SetItems (dirs, delegate (object o, DialogClickEventArgs e) {
string dir = dirs [(int) e.Which];
ProcessFileSelectionDialog (dir, delegate (string mus) {
player.SelectFile (mus);
player.Play ();
});
});
var dlg = db.Show ();
};
play_button.Click += delegate {
try {
if (player.IsPlaying) {
player.Pause ();
} else {
player.Play ();
}
} catch (Exception ex) {
play_button.Text = ex.Message;
}
};
stop_button.Click += delegate {
player.Stop ();
};
rescan_button.Click += delegate {
var db = new AlertDialog.Builder(activity);
db.SetMessage ("Scan music directories. This operation takes a while.");
db.SetPositiveButton ("OK", delegate {
CreateSongDirectoryList ();
load_button.Enabled = true;
});
db.SetCancelable (true);
db.SetNegativeButton ("Cancel", delegate {});
db.Show ();
};
}
示例13: OnMapCenterButtonClick
void OnMapCenterButtonClick (object sender, EventArgs args)
{
string[] items = new string[] {GetString(Resource.String.menu_screen_map_location_mylocation), GetString(Resource.String.menu_screen_map_location_game)};
// Show selection dialog for location
AlertDialog.Builder builder = new AlertDialog.Builder(ctrl);
builder.SetTitle(Resource.String.menu_screen_map_location_header);
builder.SetItems(items.ToArray(), delegate(object s, DialogClickEventArgs e) {
if (e.Which == 0) {
_followLocation = true;
FocusOnLocation();
}
if (e.Which == 1) {
_followLocation = false;
FocusOnGame();
}
});
AlertDialog alert = builder.Create();
alert.Show();
}
示例14: ProcessFileSelectionDialog
void ProcessFileSelectionDialog(string dir, Action<string> action)
{
var l = new List<string> ();
if (dir == from_history_tag) {
l.AddRange (player.GetPlayHistory ());
} else {
if (Directory.Exists (dir))
foreach (var file in Directory.GetFiles (dir, "*.ogg"))
l.Add (file);
}
var db = new AlertDialog.Builder(activity);
if (l.Count == 0)
db.SetMessage ("No music files there");
else {
db.SetTitle ("Select Music File");
var files = (from f in l select database.GetTitle (f, (int) new FileInfo (f).Length) ?? Path.GetFileName (f)).ToArray ();
db.SetItems (files, delegate (object o, DialogClickEventArgs e) {
int idx = (int) e.Which;
title_text_view.Text = files [idx];
action (l [idx]);
});
}
db.Show().Show();
}
示例15: OnVibratePatternClick
private async void OnVibratePatternClick(object sender, EventArgs e)
{
using (var builder = new AlertDialog.Builder(Activity))
{
VibrationType[] values = VibrationType.Values();
string[] names = new string[values.Length];
for (int i = 0; i < names.Length; i++)
{
names[i] = values[i].ToString();
}
builder.SetItems(names, (dialog, args) =>
{
mSelectedVibrationType = values[args.Which];
((Dialog) dialog).Dismiss();
RefreshControls();
});
builder.SetTitle("Select vibration type:");
builder.Show();
}
}