本文整理汇总了C#中Android.App.AlertDialog.Builder.SetMessage方法的典型用法代码示例。如果您正苦于以下问题:C# AlertDialog.Builder.SetMessage方法的具体用法?C# AlertDialog.Builder.SetMessage怎么用?C# AlertDialog.Builder.SetMessage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Android.App.AlertDialog.Builder
的用法示例。
在下文中一共展示了AlertDialog.Builder.SetMessage方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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();
}
示例2: of_update
/// <summary>
/// 检查更新(自动)
/// </summary>
/// <param name="a"></param>
private void of_update(object a)
{
Activity activity;
activity = a as Activity;
if (!stopUpdate)
{
System.Threading.Thread.Sleep(4000);
string ver = Update.of_update(true);
string memo = Update.as_UpdateMemo;
string ls_isall = Update.as_All;
bool lb_MustUpdate = Update.ab_MustUpdate;
int enddate = Update.ai_MustUpdateEnddate;
if (ver.Substring(0, 2) != "ER")
{
AlertDialog.Builder builder = new AlertDialog.Builder(activity);
if (ls_isall == "Y")
builder.SetTitle("软件更新提示:(本次更新需重新下载所有数据)");
else
builder.SetTitle("软件更新提示:");
if (!lb_MustUpdate)
builder.SetMessage("当前版本为" + Core._publicfuns.of_GetMySysSet("app", "vercode") + "服务器上最新版本为 " + ver + " ,确定下载更新吗?\n" + memo);
else
builder.SetMessage("当前版本为" + Core._publicfuns.of_GetMySysSet("app", "vercode") + "服务器上最新版本为 " + ver + " \n在" + enddate + "日前未更新软件将不能使用,下载完成后请按提示安装\n" + memo);
builder.SetPositiveButton("确定", delegate
{
if (ls_isall == "Y")
{
string filename = AccessDB.dbFile;
System.IO.File.Delete(filename);
}
Intent intent = new Intent();
Bundle bu = new Bundle();
bu.PutString("name", "download");
intent.PutExtras(bu);
intent.SetClass(activity, typeof(Loading));
activity.StartActivity(intent);
});
builder.SetCancelable(false);
//过期未更新(不显示取消按钮)
if (lb_MustUpdate)
{
if (int.Parse(DateTime.Now.ToString("yyyyMMdd")) < enddate)
builder.SetNegativeButton("取消", delegate { stopUpdate = true; return; });
}
else
builder.SetNegativeButton("取消", delegate { stopUpdate = true; return; });
activity.RunOnUiThread(() =>
{
builder.Show();
});
}
}
}
示例3: ShowMessage
/// <summary>
/// Shows a dialog with title and message. Contains only an OK button.
/// </summary>
/// <param name="title">Title to display.</param>
/// <param name="message">Text to display.</param>
public async Task ShowMessage(string title, string message)
{
var builder = new AlertDialog.Builder(CurrentActivity);
builder.SetTitle(title);
builder.SetMessage(message);
builder.Show();
}
示例4: Display
public void Display (string body, string title, GoalsAvailable availableGoal, string cancelButtonTitle, string acceptButtonTitle = "", Action<GoalsAvailable, int> action = null)
{
EditText goalTextBox = new EditText (Forms.Context);
AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder (Forms.Context);
alertDialogBuilder.SetTitle (title);
alertDialogBuilder.SetMessage (body);
alertDialogBuilder.SetView (goalTextBox);
goalTextBox.InputType = Android.Text.InputTypes.NumberFlagSigned;
var inputFilter = new Android.Text.InputFilterLengthFilter (7);
var filters = new Android.Text.IInputFilter[1];
filters [0] = inputFilter;
goalTextBox.SetFilters (filters);
goalTextBox.InputType = Android.Text.InputTypes.ClassNumber;
alertDialogBuilder.SetPositiveButton ("OK", (senderAlert, args) => {
if(action != null)
{
int goalValue;
int.TryParse(goalTextBox.Text, out goalValue);
action.Invoke(availableGoal, goalValue);
}
} );
alertDialogBuilder.SetNeutralButton ("CANCEL", (senderAlert, args) => {
} );
alertDialogBuilder.Show ();
}
示例5: refreshRanking
private void refreshRanking()
{
var task = Task<List<TournamentRankingModel>>.Factory.StartNew(() => ServerData.getTournamentRanking(Session.Instance().selectedTournament.Id));
task.ContinueWith(x =>
{
try
{
if (x.Exception != null) throw x.Exception.InnerException;
ranking = task.Result;
if(ranking.Count > 0)
{
notStarted.Visibility = ViewStates.Gone;
Session.Instance().selectedTournament.Open = false;
populateTable ();
}
}
catch (WebException e)
{
var builder = new AlertDialog.Builder(this);
builder.SetMessage("Er is iets mis met de verbinding, probeer het later opnieuw.");
builder.SetCancelable(false);
builder.SetPositiveButton("OK", delegate { });
builder.Show();
}
},
TaskScheduler.FromCurrentSynchronizationContext());
}
示例6: 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();
}
示例7: 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));
}
}
示例8: 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();
}
示例9: 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);
}
}
示例10: 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 ();
}
示例11: 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();
}
示例12: OnStart
protected override void OnStart ()
{
base.OnStart ();
InitService ();
var button1 = FindViewById<Button> (Resource.Id.buttonCalc);
button1.Click += (sender, e) => {
if (IsBound) {
var text1 = FindViewById<EditText> (Resource.Id.value1);
var text2 = FindViewById<EditText> (Resource.Id.value2);
var result = FindViewById<TextView> (Resource.Id.result);
int v1;
int v2;
int v3;
if(Int32.TryParse (text2.Text, out v2) && Int32.TryParse (text1.Text, out v1)) {
v3 = Service.Add (v1, v2);
} else {
v3 = 0;
var builder = new AlertDialog.Builder(this);
builder.SetMessage("Spaces or special character are not allowed");
builder.SetNeutralButton("OK", (source, eventArgs) => {});
builder.Show();
}
result.Text = v3.ToString ();
} else {
Log.Warn (Tag, "The AdditionService is not bound");
}
};
}
示例13: OnResume
protected override async void OnResume()
{
base.OnResume ();
Title = DataHolder.Current.CurrentCity.Name;
// Load pollutions
pollutionService = new PollutionService(Settings.ApiBaseUrl);
var pollutions = await pollutionService.GetPollutionForCity(DataHolder.Current.CurrentCity.Zip);
if (pollutions == null)
{
// An error occured
var builder = new AlertDialog.Builder(this);
builder.SetTitle(GetString(Resource.String.error_header));
builder.SetMessage(GetString(Resource.String.pollution_error_body));
builder.SetPositiveButton (GetString (Android.Resource.String.Ok), (senderAlert, args) => {});
builder.Show();
} else {
DataHolder.Current.CurrentPollutions = pollutions;
}
// Initialize tabs
AddPollutionDayTab(Resources.GetString(Resource.String.tab_today), 0);
AddPollutionDayTab(Resources.GetString(Resource.String.tab_tomorrow), 1);
AddPollutionDayTab(Resources.GetString(Resource.String.tab_aftertomorrow), 2);
// Hide loading indicator
var loading = FindViewById<ProgressBar> (Resource.Id.pbLoading);
loading.Visibility = ViewStates.Gone;
}
示例14: OnCreate
protected override void OnCreate(Bundle bundle)
{
base.OnCreate(bundle);
SetContentView(Resource.Layout.Page_Dialog);
var yesNoDialogbutton = FindViewById<Button>(Resource.Id.YesNoDialogButton);
yesNoDialogbutton.Click += delegate
{
var builder = new AlertDialog.Builder(this);
builder.SetMessage(Resource.String.knigts_dialog_title);
builder.SetPositiveButton(Resource.String.yes, (s, e) => { });
builder.SetNegativeButton(Resource.String.no, (s, e) => { }).Create();
builder.Show();
};
var alertDialogButton = FindViewById<Button>(Resource.Id.AlertDialogButton);
alertDialogButton.Click += delegate { ShowDialog(AlertDialog); };
var listDialogButton = FindViewById<Button>(Resource.Id.ListDialogButton);
listDialogButton.Click += delegate { ShowDialog(ListDialog); };
var multiChoiceDialogButton = FindViewById<Button>(Resource.Id.MultiChoiceDialogButton);
multiChoiceDialogButton.Click += delegate { ShowDialog(MultiChoiceDialog); };
var customViewDialogButton = FindViewById<Button>(Resource.Id.CustomViewDialogButton);
customViewDialogButton.Click += delegate { ShowDialog(CustomViewDialog); };
var fragmentDialogsButton = FindViewById<Button>(Resource.Id.FragmentDialogsButton);
fragmentDialogsButton.Click += delegate
{
var intent = new Intent(this, typeof (DialogFragmentActivity));
intent.AddFlags(ActivityFlags.ClearTop);
StartActivity(intent);
};
}
示例15: ShowQuestion
public static AlertDialog ShowQuestion(this Activity activity, string title, string message, string positiveButton, string negativeButton, Action positive, Action negative)
{
AlertDialog dialog = null;
var builder = new AlertDialog.Builder(activity);
builder.SetTitle(title);
builder.SetMessage(message);
builder.SetPositiveButton(positiveButton, (s, e) =>
{
dialog.Cancel();
dialog.Dismiss();
if (positive != null)
positive();
});
builder.SetNegativeButton(negativeButton, (s, e) =>
{
dialog.Cancel();
dialog.Dismiss();
if (negative != null)
negative();
});
dialog = builder.Show();
return dialog;
}