本文整理汇总了C#中Android.App.AlertDialog.Builder类的典型用法代码示例。如果您正苦于以下问题:C# AlertDialog.Builder类的具体用法?C# AlertDialog.Builder怎么用?C# AlertDialog.Builder使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
AlertDialog.Builder类属于Android.App命名空间,在下文中一共展示了AlertDialog.Builder类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: OnCreate
protected override void OnCreate(Bundle bundle)
{
base.OnCreate (bundle);
RequestedOrientation = global::Android.Content.PM.ScreenOrientation.Landscape;
// Set our view from the "main" layout resource
SetContentView (Resource.Layout.Main);
SignaturePadView signature = FindViewById<SignaturePadView> (Resource.Id.signatureView);
// Get our button from the layout resource,
// and attach an event to it
Button btnSave = FindViewById<Button> (Resource.Id.btnSave);
btnSave.Click += delegate {
if (signature.IsBlank)
{//Display the base line for the user to sign on.
AlertDialog.Builder alert = new AlertDialog.Builder (this);
alert.SetMessage ("No signature to save.");
alert.SetNeutralButton ("Okay", delegate { });
alert.Create ().Show ();
}
points = signature.Points;
};
btnSave.Dispose ();
Button btnLoad = FindViewById<Button> (Resource.Id.btnLoad);
btnLoad.Click += delegate {
if (points != null)
signature.LoadPoints (points);
};
btnLoad.Dispose ();
}
开发者ID:mamta-bisht,项目名称:VS2013Roadshow,代码行数:32,代码来源:Activity1.cs
示例2: OnCreate
protected override void OnCreate(Bundle bundle)
{
base.OnCreate (bundle);
// Set our view from the "main" layout resource
SetContentView ( Resource.Layout.Main );
// Resources
Button Button1 = FindViewById <Button> (Resource.Id.Button1);
Button Button2 = FindViewById <Button> (Resource.Id.Button2);
Button Button3 = FindViewById <Button> (Resource.Id.Button3);
// Resource CallBacks
Button1.Click += delegate {
StartActivity ( typeof ( Game ) );
Finish (); };
Button2.Click += delegate {
StartActivity ( typeof ( Instructions ) );
Finish (); };
Button3.Click += delegate {
AlertDialog.Builder MessageBox = new AlertDialog.Builder ( this );
MessageBox.SetNegativeButton ( "OK", delegate {} );
MessageBox.SetMessage ("Xamarin Studio\n-Hussain Al-Homedawy.");
MessageBox.Show (); };
}
开发者ID:hussain-alhomedawy,项目名称:Tic-Tac-Toe-for-the-Android-OS,代码行数:27,代码来源:MainActivity.cs
示例3: Login
public void Login(object sender, EventArgs e)
{
EditText Email = FindViewById<EditText>(Resource.Id.Email);
EditText Password = FindViewById<EditText>(Resource.Id.Password);
TextView tex1 = FindViewById<TextView>(Resource.Id.text1);
TextView tex2 = FindViewById<TextView>(Resource.Id.text2);
EmailSend = Email.Text;
PasswordSend = Password.Text;
ConnectDatabase data;
string HashText = null;
if (EmailSend == "" || PasswordSend == "" || EmailSend.Length < 5 || PasswordSend.Length < 5)
{
AlertDialog.Builder alert = new AlertDialog.Builder(this);
alert.SetMessage("Invalid Username or Password");
alert.SetTitle("Error");
alert.SetCancelable(true);
alert.SetPositiveButton("OK", (EventHandler<DialogClickEventArgs>)null);
alert.Show();
}
else
{
StartActivity(typeof(StartPageActivity));
data = new ConnectDatabase(EmailSend, PasswordSend);
HashText = data.GetHash;
tex1.Text = EmailSend;
tex2.Text = HashText;
}
}
开发者ID:Alexander144,项目名称:PJ3100Gruppe20GIT,代码行数:32,代码来源:MainActivity.cs
示例4: 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();
}
开发者ID:Danil410,项目名称:VkApiXamarin,代码行数:35,代码来源:MainActivity.cs
示例5: OnOptionsItemSelected
public override bool OnOptionsItemSelected(IMenuItem item)
{
switch (item.ItemId)
{
case Resource.Id.actionNew:
string default_game_name = "Game";
AlertDialog.Builder alert1 = new AlertDialog.Builder(this.Activity);
EditText input = new EditText(this.Activity);
input.Text = default_game_name;
alert1.SetTitle("Game Name");
alert1.SetView(input);
alert1.SetPositiveButton("OK", delegate { AddGame(input.Text); });
alert1.SetNegativeButton("Cancel", (s, e) => { });
alert1.Show();
_adapter.NotifyDataSetChanged();
return true;
case Resource.Id.actionRefresh:
GameData.Service.RefreshCache();
_adapter.NotifyDataSetChanged();
return true;
default:
return base.OnOptionsItemSelected(item);
}
}
开发者ID:quanb,项目名称:SimpleScoreBoard,代码行数:26,代码来源:GamesFragment.cs
示例6: OnLogin
private void OnLogin(bool p_isLogedIn)
{
if (p_isLogedIn == false)
{
RunOnUiThread(() => {
AlertDialog.Builder l_alert = new AlertDialog.Builder(this);
l_alert.SetMessage("Connection failed...");
l_alert.SetNegativeButton("Cancel", delegate { });
Console.WriteLine("Failed to connect");
l_alert.Show();
});
}
else
{
if (m_checkBox.Checked == true)
{
m_dataManager.StoreData<string>("login", m_login.Text);
m_dataManager.StoreData<string>("password", m_password.Text);
}
else
{
m_dataManager.RemoveData("login");
m_dataManager.RemoveData("password");
}
m_dataManager.StoreData<bool>("loginCheckBox", m_checkBox.Checked);
Console.WriteLine("success to connect");
StartActivity(typeof(ChatActivity));
}
}
开发者ID:Naphtaline,项目名称:EpiMessenger,代码行数:29,代码来源:MainActivity.cs
示例7: AskForString
public void AskForString(string message, string title, System.Action<string> returnString)
{
var activity = Mvx.Resolve<IMvxAndroidCurrentTopActivity> ().Activity;
var builder = new AlertDialog.Builder(activity);
builder.SetIcon(Resource.Drawable.ic_launcher);
builder.SetTitle(title ?? string.Empty);
builder.SetMessage(message);
var view = View.Inflate(activity, Resource.Layout.dialog_add_member, null);
builder.SetView(view);
var textBoxName = view.FindViewById<EditText>(Resource.Id.name);
builder.SetCancelable(true);
builder.SetNegativeButton(Resource.String.cancel, delegate { });//do nothign on cancel
builder.SetPositiveButton(Resource.String.ok, delegate
{
if (string.IsNullOrWhiteSpace(textBoxName.Text))
return;
returnString(textBoxName.Text.Trim());
});
var alertDialog = builder.Create();
alertDialog.Show();
}
开发者ID:rferolino,项目名称:MeetupManager,代码行数:27,代码来源:MessageDialog.cs
示例8: GetFavoriteGameList
public List<Game> GetFavoriteGameList(Context Context, string AccountIdentifier)
{
XmlDocument doc = new XmlDocument ();
List<Game> gamesList = new List<Game>();
try
{
doc.Load("http://thegamesdb.net/api/User_Favorites.php?=accountid=" + AccountIdentifier);
XmlNodeList nodes = doc.DocumentElement.SelectNodes("/Favorites");
foreach (XmlNode node in nodes)
{
if(node.SelectSingleNode("Game") != null)
{
gamesList.Add(GetGame(Context, node.SelectSingleNode("Game").Value));
}
}
return gamesList;
}
catch
{
var errorDialog = new AlertDialog.Builder(Context).SetTitle("Oops!").SetMessage("There was a problem getting Favorites, please try again later.").SetPositiveButton("Okay", (sender1, e1) =>
{
}).Create();
errorDialog.Show();
return gamesList;
}
}
开发者ID:nickpeppers,项目名称:TheGameDB,代码行数:32,代码来源:GamesDBService.cs
示例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;
}
开发者ID:mokth,项目名称:merpV2Production,代码行数:28,代码来源:TraderDialog.cs
示例10: 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);
}
开发者ID:Cheesebaron,项目名称:MeetupManager,代码行数:25,代码来源:LoginView.cs
示例11: OnCreate
protected override void OnCreate(Bundle bundle)
{
base.OnCreate(bundle);
this.Window.AddFlags(WindowManagerFlags.Fullscreen);
// Create your application here
ActionBar.NavigationMode = ActionBarNavigationMode.Tabs;
SetContentView(Resource.Layout.MainTabLayout);
AddTab(Resource.String.tabMain, new MainTabFragment(this));
AddTab(Resource.String.tabCreate, new CreateTabFragment(this));
AddTab(Resource.String.tabSettings, new SettingsTabFragment(this));
//testing tab for layouts - not used
//AddTab(Resource.String.tabSettings, new TestTabFragment(this));
LoadPreferences();
if (gVar.apiKey_ == "")
{
var dlgNoApi = new AlertDialog.Builder(this);
dlgNoApi.SetMessage(Resource.String.noAPI);
dlgNoApi.SetNegativeButton(Resource.String.ok, delegate
{
ActionBar.SetSelectedNavigationItem(2);
});
dlgNoApi.Show();
}
}
开发者ID:coldlink,项目名称:challonger,代码行数:28,代码来源:MainActivityTab.cs
示例12: 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);
}
开发者ID:mokth,项目名称:merpCS,代码行数:33,代码来源:MainActivity.cs
示例13: Dial
private void Dial()
{
var book = new Xamarin.Contacts.AddressBook(this);
book.RequestPermission().ContinueWith(t =>
{
if (!t.Result)
{
Console.WriteLine("Permission denied by user or manifest");
return;
}
var validContacts = book.Where(a => a.Phones.Any(b => b.Number.Any())).ToList();
var totalValidContacts = validContacts.Count;
if (totalValidContacts < 1)
{
var alert = new AlertDialog.Builder(this);
alert.SetTitle("No valid Contacts Found");
alert.SetMessage("No valid Contacts Found");
}
var rnd = new Random();
Contact contact = null;
while (contact == null)
{
contact = validContacts.Skip(rnd.Next(0, totalValidContacts)).FirstOrDefault();
}
var urlNumber = Android.Net.Uri.Parse("tel:" + contact.Phones.First().Number);
var intent = new Intent(Intent.ActionCall);
intent.SetData(urlNumber);
this.StartActivity(intent);
}, TaskScheduler.FromCurrentSynchronizationContext());
}
开发者ID:TerribleDev,项目名称:DrunkDial,代码行数:30,代码来源:MainActivity.cs
示例14: ForgotPassword
public async void ForgotPassword(View view)
{
ProgressDialog dialog = DialogHelper.CreateProgressDialog("Please wait...", this);
dialog.Show();
EditText StudentId = FindViewById<EditText>(Resource.Id.forgotStudentId);
AuthService ForgotPasswordService = new AuthService();
GenericResponse Response = await ForgotPasswordService.ForgotPassword(StudentId.Text);
dialog.Hide();
if (Response.Success)
{
AlertDialog.Builder builder = new AlertDialog.Builder(this, Resource.Style.LightDialog);
builder.SetTitle("Password Reset Sent");
builder.SetMessage("Please check your emails to reset your password");
builder.SetCancelable(false);
builder.SetPositiveButton("OK", delegate { Finish(); });
builder.Show();
}
else
{
DialogHelper.ShowDialog(this, Response.Message, Response.Title);
}
}
开发者ID:paul-pagnan,项目名称:helps,代码行数:25,代码来源:ForgotPasswordActivity.cs
示例15: 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();
}
开发者ID:vishwanathsrikanth,项目名称:azureinsightmob,代码行数:7,代码来源:ExceptionHandler.cs
示例16: ShowDialog
public static void ShowDialog(Context context, string message, string title)
{
var builder = new AlertDialog.Builder(context);
builder.SetMessage(message);
builder.SetTitle(title);
builder.Create().Show();
}
开发者ID:paul-pagnan,项目名称:helps,代码行数:7,代码来源:DialogHelper.cs
示例17: OnCreate
protected override void OnCreate(Bundle bundle)
{
base.OnCreate(bundle);
RequestWindowFeature(WindowFeatures.NoTitle);
SetContentView(Resource.Layout.GetMain);
Button back = FindViewById<Button>(Resource.Id.GetMian_cancel);
ListView list = FindViewById<ListView>(Resource.Id.GetMian_items);
Button save = FindViewById<Button>(Resource.Id.GetMian_save);
OnBind();
save.Click += delegate
{
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.SetTitle("提示:");
builder.SetMessage("确认同步订单吗?");
builder.SetNegativeButton("确定", delegate
{
string msg = Sync.syncOrder();
AlertDialog.Builder bd = new AlertDialog.Builder(this);
bd.SetTitle("提示:");
bd.SetMessage(msg);
bd.SetNegativeButton("确定", delegate { });
bd.Show();
});
builder.Show();
};
back.Click += delegate
{
Intent intent = new Intent();
intent.SetClass(this, typeof(Index));
StartActivity(intent);
Finish();
};
new Core.Menu(this);
}
开发者ID:eatage,项目名称:AppTest.bak,代码行数:35,代码来源:GetMian.cs
示例18: OnCreateDialog
public override Dialog OnCreateDialog(Bundle savedInstanceState)
{
editText = new EditText (Activity);
var builder = new AlertDialog.Builder (Activity);
builder.SetTitle ("Add Task")
.SetView (editText)
.SetPositiveButton ("Go", (e, v) => {
ViewModel.SelectedTask.Title = editText.Text;
if (ViewModel.SelectedTask.CreateDateTime == new DateTime ()) {
ViewModel.SelectedTask.CreateDateTime = DateTime.Now;
}
ViewModel.SelectedTask.LastModifiedDateTime = DateTime.Now;
ViewModel.CommitTask ();
ViewModel.StartSelectedTask ();
})
.SetNeutralButton("Save", (e, v) => {
ViewModel.SelectedTask.Title = editText.Text;
if (ViewModel.SelectedTask.CreateDateTime == new DateTime ()) {
ViewModel.SelectedTask.CreateDateTime = DateTime.Now;
}
ViewModel.SelectedTask.LastModifiedDateTime = DateTime.Now;
ViewModel.CommitTask ();
ViewModel.UnselectTask();
})
.SetNegativeButton("Cancel", (e, v) => { ViewModel.UnselectTask(); });
return builder.Create ();
}
开发者ID:ruly-rudel,项目名称:ruly,代码行数:30,代码来源:AddTaskFragment.cs
示例19: Display
public bool Display (string body, string cancelButtonTitle, string acceptButtonTitle = "", Action action = null, bool negativeAction = false)
{
AlertDialog.Builder alert = new AlertDialog.Builder (Forms.Context);
alert.SetTitle ("Alert");
alert.SetMessage (body);
alert.SetNeutralButton (cancelButtonTitle, (senderAlert, args) => {
});
if (acceptButtonTitle != "") {
if (!negativeAction) {
alert.SetPositiveButton (acceptButtonTitle, (senderAlert, args) => {
if (action != null) {
action.Invoke ();
}
});
} else {
alert.SetNegativeButton (acceptButtonTitle, (senderAlert, args) => {
if (action != null) {
action.Invoke ();
}
});
}
}
((Activity)Forms.Context).RunOnUiThread (() => {
alert.Show ();
});
return true;
}
开发者ID:MobileFit,项目名称:CoachV2,代码行数:32,代码来源:CustomDialogService.cs
示例20: OnCreate
protected override void OnCreate(Bundle bundle)
{
base.OnCreate (bundle);
// Set our view from the "main" layout resource
SetContentView (Resource.Layout.Main);
// Get our button from the layout resource,
// and attach an event to it
Button button = FindViewById<Button> (Resource.Id.loginButton);
button.Click += delegate {
//set alert for executing the task
var alert = new AlertDialog.Builder (this);
alert.SetTitle ("Login Popup");
alert.SetPositiveButton ("OK", (senderAlert, args) => {
});
alert.SetMessage ("Logged In");
//run the alert in UI thread to display in the screen
RunOnUiThread (() => {
alert.Show ();
});
};
}
开发者ID:paulpatarinski,项目名称:XamUITest_Examples,代码行数:29,代码来源:MainActivity.cs
注:本文中的Android.App.AlertDialog.Builder类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论