zoukankan      html  css  js  c++  java
  • 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();
            }
        }  
    }
  • 相关阅读:
    bisect in Python
    1385. 两个数组间的距离值
    面试题 04.08. 首个共同祖先
    Python关键字yield
    1237. 找出给定方程的正整数解
    响应式文字
    java环境变量设置
    小 div在大 div中左右上下居中
    清除浮动
    jQuery 图片等比缩放
  • 原文地址:https://www.cnblogs.com/laxknight/p/3327746.html
Copyright © 2011-2022 走看看