MONO MessageBox 类
MessageBox类,负责提示各种消息.
using System;
using Android.App;
using Android.Content;
namespace Box
{
public class MessageBox
{
private static AlertDialog.Builder CreateDialog(Context ctx, string title, string message)
{
AlertDialog.Builder dlg = new AlertDialog.Builder(ctx); return dlg.SetTitle(title).SetMessage(message);
}
public static void Show(Context ctx,string title, string message)
{
AlertDialog.Builder dlg = new AlertDialog.Builder(ctx);
dlg.SetTitle(title);
dlg.SetMessage(message);
dlg.SetPositiveButton("确定", delegate { });
//.SetPositiveButton("确定", delegate { MessageBox.Show(this, "提示", "恭喜你点确定了,退出");Finish(); }).SetNegativeButton("取消", delegate { MessageBox.Show(this, "提示", "恭喜你点取消"); }).Show();
dlg.Show(); }
public static void ShowErrorMessage(Context ctx, Exception ex)
{
Show(ctx, "错误", ex.Message);
}
public static void Alert(Context ctx, string message)
{
CreateDialog(ctx, "提示", message).SetIcon(Android.Resource.Drawable.IcDialogAlert).SetPositiveButton("确定", delegate { }).Show();
}
public static void Confirm(Context ctx, string title, string message, EventHandler<DialogClickEventArgs> okHandler, EventHandler<DialogClickEventArgs> cancelHandler)
{
CreateDialog(ctx, title, message).SetPositiveButton("确定", okHandler).SetNegativeButton("取消", cancelHandler).Show();
}
public static void Confirm(Context ctx, string title, string message,string OKName,string CancelName, EventHandler<DialogClickEventArgs> okHandler, EventHandler<DialogClickEventArgs> cancelHandler)
{
CreateDialog(ctx, title, message).SetPositiveButton(OKName, okHandler).SetNegativeButton(CancelName, cancelHandler).Show();
}
}
}
MONO MessageBox 类的更多相关文章
- 操作messageBox类
我们经常操作messagebox类,有时候我们又分不清一些参数,下面是一些操作messageBox的常用方法: public static class ClsMsg { public static v ...
- 一个ASP.NET中使用的MessageBox类
/// <summary> /// 自定义信息对话框 /// </summary> public class MessageBox { /// <summary> ...
- java翻译到mono C#实现系列(1) 重写返回键按下的事件
今天看到群里的朋友问怎么按下返回键的时候提示信息,百度了下,就参考网上一个java版示例做了.没啥技术含量,就权当丰富下mono for android的小代码. 直接在mono新建的APP上修改的. ...
- [转载]C#中MessageBox.Show用法以及VB.NET中MsgBox用法
一.C#中MessageBox.Show用法 MessageBox.Show (String) 显示具有指定文本的消息框. 由 .NET Compact Framework 支持. MessageBo ...
- C#中MessageBox用法大全
我们在程序中经常会用到MessageBox. MessageBox.Show()共有21中重载方法.现将其常见用法总结如下: 1.MessageBox.Show("Hello~~~~&quo ...
- c# MessageBox 用法大全
我们在程序中经常会用到MessageBox. 1.MessageBox.Show("Hello~~~~"); 最简单的,只显示提示信息. 2.MessageBox.Show(&qu ...
- 模拟MessageBox
原文:<模拟MessageBox> Posted on 2014/01/07 ======================================================= ...
- WPF小知识,MessageBox的多种用法
我们在程序中经常会用到MessageBox. 现将其常见用法总结如下: 1.MessageBox.Show("Hello~~~~"); 最简单的,只显示提示信息. 2.Messag ...
- C# winform 中MessageBox用法大全(附效果图) (转载+说明)
声明:这篇文章是转载的转载的,由于原作者的博客被关闭 我就不再列出了,提前先说明下,if语句中的判断有些太长,建议提前声明一个变量, DialogResult MsgBoxResult; ...
随机推荐
- 8.7 正确使用索引(no)
一 索引未命中 并不是说我们创建了索引就一定会加快查询速度,若想利用索引达到预想的提高查询速度的效果,我们在添加索引时,必须遵循以下问题 1 范围问题,或者说条件不明确,条件中出现这些符号或关键字:& ...
- 20155316 2016-2017-2 《Java程序设计》第6周学习总结
教材学习内容总结 IO操作的目标 从数据源当中读取数据,以及将数据写入到数据目的地当中: I/O的来源地与目的地多种多样 I/O的流向:输入流.输出流.参照物 IO的分类方法 输入流\输出流: 字节流 ...
- javadoc tags
Where Tags Can Be Used The following sections describe where the tags can be used. Note that these t ...
- ZOJ2201 No Brainer 2017-04-16 19:21 54人阅读 评论(0) 收藏
No Brainer Time Limit: 2 Seconds Memory Limit: 65536 KB Zombies love to eat brains. Yum. Input ...
- java并发编程实战:第十一章----性能和可伸缩性
线程的最主要目的是提高程序的运行性能,但性能的提升会导致复杂性的提升,又会导致安全性和活跃性的风险 一.对性能的思考 提升性能意味着用更少的资源做更多地事情.要想通过并发来获得更好的性能,就要更有效地 ...
- LNMP详细介绍
1>Nginx概述: 很多人对apache非常熟悉,Nginx与Apache类似,属于WEB容器,同时也是一款高性能的HTTP和反向代理软件,它们之间最大的差别是Apache的处理速 ...
- tomcat-java_opts设置说明
The JAVA_OPTS environment variable can be used to specify additional arguments to the JVM JBoss will ...
- Windbg and resources leaks in .NET applications 资源汇总
Windows Forms Leaks 1.http://blogs.msdn.com/b/tess/archive/2008/02/04/net-debugging-demos-informatio ...
- Postgresql 9.6 搭建 异步流复制 和 同步流复制 详细教程
Basic Replication If you’re feeling overwhelmed, try setting up a slave to see how easy it is! We’ll ...
- .NET中的异常处理机制(一)
1.异常处理的总体指导思想 学习C#中的异常处理机制,大概要了解以下几点: 首先,我们需要知道的事所有具体异常都是继承自System.Exception基类的. 其次,要熟悉FCL类库内置好的一些异常 ...