本文整理汇总了C#中Android.App.AlertDialog.Builder.Create方法的典型用法代码示例。如果您正苦于以下问题:C# AlertDialog.Builder.Create方法的具体用法?C# AlertDialog.Builder.Create怎么用?C# AlertDialog.Builder.Create使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Android.App.AlertDialog.Builder
的用法示例。
在下文中一共展示了AlertDialog.Builder.Create方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnCreate
protected override void OnCreate(Bundle bundle)
{
base.OnCreate(bundle);
#if __ANDROID_14__
Window.RequestFeature(WindowFeatures.ActionBar);
ActionBar.SetDisplayHomeAsUpEnabled(ViewModel.CanGoBack);
#endif
SetContentView(Resource.Layout.identityproviderlistview);
_loadingToken = ViewModel.WeakSubscribe(() => ViewModel.LoadingIdentityProviders, (sender, args) =>
{
if (ViewModel.LoadingIdentityProviders)
LoadingDialog.Show();
else
LoadingDialog.Dismiss();
InvalidateOptionsMenu();
});
ViewModel.LoginError += (sender, args) =>
{
var builder = new AlertDialog.Builder(this);
builder.SetTitle("Error");
builder.SetIcon(Android.Resource.Drawable.IcDialogAlert);
builder.SetMessage(args.Message);
builder.SetPositiveButton("Dismiss", (s, e) => { });
builder.Create().Show();
};
}
开发者ID:JoseManuelLopez,项目名称:Cheesebaron.MvxPlugins,代码行数:31,代码来源:DefaultLoginIdentityProviderListView.cs
示例2: WriteLine
protected override void WriteLine(string textLine, LogEvent logEvent)
{
if (_activity == null)
return;
_activity.RunOnUiThread(() =>
{
try
{
var adBuilder = new AlertDialog.Builder(_activity);
adBuilder.SetTitle(string.Format("LogWriter: {0}", logEvent.Logger.LoggingType.Name));
adBuilder.SetMessage(textLine);
adBuilder.SetNegativeButton("OK", (s, e) =>
{
var alertDialog = s as AlertDialog;
if (alertDialog != null)
{
alertDialog.Dismiss();
alertDialog.Cancel();
}
});
adBuilder.Create().Show();
}
catch (Exception e)
{
// TODO detta måste fixas
// something went terribly wrong
}
});
}
示例3: OnCreate
protected override void OnCreate(Bundle bundle)
{
base.OnCreate (bundle);
using (var db = new SQLiteConnection (dbPath)) {
db.CreateTable<LogEntry> ();
}
// Set our view from the "main" layout resource
SetContentView (Resource.Layout.Main);
// Create our database if it does not already exist
// Get our button from the layout resource,
// and attach an event to it
Button addFood = FindViewById<Button> (Resource.Id.AddFoodButton);
addFood.Click += (object sender, EventArgs e) =>
{
AlertDialog.Builder addFoodDialogBuilder = new AlertDialog.Builder(this);
addFoodDialogBuilder.SetTitle ("I had something to eat and it was:");
addFoodDialogBuilder.SetSingleChoiceItems (choices, -1, clickFoodDialogList);
addFoodDialog = addFoodDialogBuilder.Create();
// Show the alert dialog to the user and wait for response.
addFoodDialog.Show();
};
}
示例4: OnCreate
protected override void OnCreate(Bundle bundle)
{
base.OnCreate(bundle);
String extra = Intent.GetStringExtra("User") ?? "Data not available";
var builder = new AlertDialog.Builder(this);
builder.SetTitle("Logged in");
builder.SetMessage(extra);
builder.SetPositiveButton("Ok", delegate { Finish(); });
builder.Create().Show();
// Create your application here
SetContentView(Resource.Layout.Home);
TextView textView = FindViewById<TextView>(Resource.Id.textView_Username);
textView.Text = extra;
Button goToBogdan = FindViewById<Button>(Resource.Id.button_Veres);
Button goToMiki = FindViewById<Button>(Resource.Id.button_Miki);
goToBogdan.Click += (sender, args) =>
{
var bogdan = new Intent(this, typeof(Bogdan));
StartActivity(bogdan);
};
goToMiki.Click += (sender, args) =>
{
var miki = new Intent(this, typeof(Miki));
StartActivity(miki);
};
}
示例5: OnCreateDialog
public override Dialog OnCreateDialog(Bundle savedInstanceState)
{
AlertDialog.Builder dialog = new AlertDialog.Builder(Activity)
.SetTitle(title)
.SetPositiveButton("Got it", (sender, args) => { });
LayoutInflater inflater = Activity.LayoutInflater;
View view = inflater.Inflate(Resource.Layout.VideoHelpPopup, null);
video = view.FindViewById<VideoView>(Resource.Id.helper_video);
descriptionView = view.FindViewById<TextView>(Resource.Id.helper_explanation);
descriptionView.SetText(description.ToCharArray(),0, description.Length);
if (!string.IsNullOrEmpty(videoAdd))
{
video.Prepared += VideoPrepared;
video.SetVideoURI(Uri.Parse(videoAdd));
video.Touch += VideoTouched;
video.SetZOrderOnTop(true); // Removes dimming
}
else
{
LinearLayout holder = view.FindViewById<LinearLayout>(Resource.Id.helper_videoHolder);
holder.Visibility = ViewStates.Gone;
}
dialog.SetView(view);
return dialog.Create();
}
示例6: ButtonOnClick
private void ButtonOnClick(object sender, EventArgs eventArgs)
{
var builder = new AlertDialog.Builder(this);
builder.SetMessage("This is an Alert Dialog.");
var dialog = builder.Create();
dialog.Show();
}
示例7: LoginToVk
void LoginToVk()
{
var auth = new OAuth2Authenticator (
clientId: "", // put your id here
scope: "friends,video,groups",
authorizeUrl: new Uri ("https://oauth.vk.com/authorize"),
redirectUrl: new Uri ("https://oauth.vk.com/blank.html"));
auth.AllowCancel = true;
auth.Completed += (s, ee) => {
if (!ee.IsAuthenticated) {
var builder = new AlertDialog.Builder (this);
builder.SetMessage ("Not Authenticated");
builder.SetPositiveButton ("Ok", (o, e) => { });
builder.Create().Show();
return;
}
else
{
token = ee.Account.Properties ["access_token"].ToString ();
userId = ee.Account.Properties ["user_id"].ToString ();
GetInfo();
}
};
var intent = auth.GetUI (this);
StartActivity (intent);
}
示例8: OnOptionsItemSelected
public override bool OnOptionsItemSelected(Android.Views.IMenuItem item)
{
if (ViewModel.IsBusy)
return base.OnOptionsItemSelected(item);
switch (item.ItemId)
{
case Resource.Id.menu_about:
var builder = new AlertDialog.Builder(this);
builder
.SetTitle(Resource.String.menu_about)
.SetMessage(Resource.String.about)
.SetPositiveButton(Resource.String.ok, delegate {
});
AlertDialog alert = builder.Create();
alert.Show();
return true;
case Resource.Id.menu_refresh:
ViewModel.RefreshLoginCommand.Execute(null);
return true;
}
return base.OnOptionsItemSelected(item);
}
示例9: OnCreateDialog
public override Dialog OnCreateDialog(Bundle savedInstanceState)
{
base.OnCreate(savedInstanceState);
// Begin building a new dialog.
var builder = new AlertDialog.Builder(Activity);
//Get the layout inflater
var inflater = Activity.LayoutInflater;
populate (listData);
viewdlg = SetViewDelegate;
var view = inflater.Inflate(Resource.Layout.ListCustView, null);
listView = view.FindViewById<ListView> (Resource.Id.CustList);
if (listView != null) {
adapter = new GenericListAdapter<Trader> (this.Activity, listData,Resource.Layout.ListCustDtlView, viewdlg);
listView.Adapter = adapter;
listView.ItemClick += ListView_Click;
txtSearch= view.FindViewById<EditText > (Resource.Id.txtSearch);
butSearch= view.FindViewById<Button> (Resource.Id.butCustBack);
butSearch.Text = "SEARCH";
butSearch.SetCompoundDrawables (null, null, null, null);
butSearch.Click+= ButSearch_Click;
//txtSearch.TextChanged += TxtSearch_TextChanged;
builder.SetView (view);
builder.SetPositiveButton ("CANCEL", HandlePositiveButtonClick);
}
var dialog = builder.Create();
//Now return the constructed dialog to the calling activity
return dialog;
}
示例10: showConfirmDialog
public bool showConfirmDialog(Context context, string info)
{
if (!prepareModal())
return false;
// reset choice
mChoice = false;
AlertDialog.Builder builder = new AlertDialog.Builder(context);
builder.SetMessage(info);
builder.SetCancelable(false);
builder.SetPositiveButton("OK", (object o, Android.Content.DialogClickEventArgs e) =>
{
this.mQuitModal = true;
this.mChoice = true;
builder.Dispose();
});
builder.SetNegativeButton("Cancel", (object o, Android.Content.DialogClickEventArgs e) =>
{
mQuitModal = true;
mChoice = false;
builder.Dispose(); // probably wrong
});
AlertDialog alert = builder.Create();
alert.Show();
doModal();
return mChoice;
}
示例11: OnOptionsItemSelected
public override bool OnOptionsItemSelected(IMenuItem item)
{
switch (item.ItemId)
{
case Resource.Id.mmenu_back:
BackupDatabase ();
return true;
case Resource.Id.mmenu_downdb:
var builderd = new AlertDialog.Builder(this);
builderd.SetMessage("Confirm to download database from server ? All local data will be overwritten by the downloaded data.");
builderd.SetPositiveButton("OK", (s, e) => { DownlooadDb ();;});
builderd.SetNegativeButton("Cancel", (s, e) => { /* do something on Cancel click */ });
builderd.Create().Show();
return true;
// case Resource.Id.mmenu_Reset:
// //do something
// return true;
case Resource.Id.mmenu_setting:
StartActivity (typeof(SettingActivity));
return true;
case Resource.Id.mmenu_logoff:
RunOnUiThread(() =>ExitAndLogOff()) ;
return true;
case Resource.Id.mmenu_downcompinfo:
DownloadCompInfo ();
return true;
case Resource.Id.mmenu_clear:
ClearPostedInv ();
return true;
}
return base.OnOptionsItemSelected(item);
}
示例12: HandleException
public static void HandleException(AggregateException ex, Activity activity)
{
AlertDialog.Builder builder = new AlertDialog.Builder(activity);
builder.SetTitle("One or more Error(s)");
builder.SetMessage("First:" + ex.InnerExceptions.First().Message);
builder.Create().Show();
}
示例13: GetInfo
void GetInfo()
{
// создаем xml-документ
XmlDocument xmlDocument = new XmlDocument ();
// делаем запрос на получение имени пользователя
WebRequest webRequest = WebRequest.Create ("https://api.vk.com/method/users.get.xml?&access_token=" + token);
WebResponse webResponse = webRequest.GetResponse ();
Stream stream = webResponse.GetResponseStream ();
xmlDocument.Load (stream);
string name = xmlDocument.SelectSingleNode ("response/user/first_name").InnerText;
// делаем запрос на проверку,
webRequest = WebRequest.Create ("https://api.vk.com/method/groups.isMember.xml?group_id=20629724&access_token=" + token);
webResponse = webRequest.GetResponse ();
stream = webResponse.GetResponseStream ();
xmlDocument.Load (stream);
bool habrvk = (xmlDocument.SelectSingleNode ("response").InnerText =="1");
// выводим диалоговое окно
var builder = new AlertDialog.Builder (this);
// пользователь состоит в группе "хабрахабр"?
if (!habrvk) {
builder.SetMessage ("Привет, "+name+"!\r\n\r\nТы не состоишь в группе habrahabr.Не хочешь вступить?");
builder.SetPositiveButton ("Да", (o, e) => {
// уточнив, что пользователь желает вступить, отправим запрос
webRequest = WebRequest.Create ("https://api.vk.com/method/groups.join.xml?group_id=20629724&access_token=" + token);
webResponse = webRequest.GetResponse ();
});
builder.SetNegativeButton ("Нет", (o, e) => {
});
} else {
builder.SetMessage ("Привет, "+name+"!\r\n\r\nОтлично! Ты состоишь в группе habrahabr.");
builder.SetPositiveButton ("Ок", (o, e) => {
});
}
builder.Create().Show();
}
示例14: OnCreateDialog
public override Dialog OnCreateDialog(Bundle savedInstanceState)
{
base.OnCreate(savedInstanceState);
// Build Password Dialog
var builder = new AlertDialog.Builder(Activity);
// Get Layout Inflater
var inflator = Activity.LayoutInflater;
// Inflate Layout For Password Dialog
var dialogView = inflator.Inflate(Resource.Layout.AddReminderDialogFragment, null);
// Initialize Properties
ReminderEditText = dialogView.FindViewById<EditText>(Resource.Id.editTextReminder);
// Set Positive & Negative Buttons
builder.SetView(dialogView);
builder.SetPositiveButton("Add Reminder", HandlePositiveButtonClick);
builder.SetNegativeButton("Cancel", HandleNegativeButtonClick);
// Build And Return Dialog
var dialog = builder.Create();
return dialog;
}
示例15: OnCreate
protected override void OnCreate(Bundle bundle)
{
base.OnCreate(bundle);
SetContentView(Resource.Layout.identityproviderlistview);
_loadingToken = ViewModel.WeakSubscribe(() => ViewModel.LoadingIdentityProviders, (sender, args) =>
{
if (ViewModel.LoadingIdentityProviders)
LoadingDialog.Show();
else
LoadingDialog.Dismiss();
InvalidateOptionsMenu();
});
ViewModel.LoginError += (sender, args) =>
{
var builder = new AlertDialog.Builder(this);
builder.SetTitle("Error");
builder.SetIcon(Android.Resource.Drawable.IcDialogAlert);
builder.SetMessage(args.Message);
builder.SetPositiveButton("Dismiss", (s, e) => { });
builder.Create().Show();
};
}
开发者ID:JoseManuelLopez,项目名称:Cheesebaron.MvxPlugins,代码行数:26,代码来源:DefaultLoginIdentityProviderListView.cs