6.3、表单插件,询问式,提示信息框MessageBoxOptions.YesNo原创
金蝶云社区-林荫大道cc
林荫大道cc
22人赞赏了该文章 8117次浏览 未经作者许可,禁止转载编辑于2020年07月02日 15:21:54
封面


6.2、表单插件,提示信息框,this.View.ShowErrMessage("错误信息提示")



1、注释,上一节代码



2、添加引用

using Kingdee.BOS.Core.DynamicForm;



3、询问式,提示信息框,是否  

MessageBoxOptions.YesNo


                this.View.ShowMessage("错误提示,是否继续?",
                //提示信息:是、否
                MessageBoxOptions.YesNo,
                new Action<MessageBoxResult>((result) =>
                 {
                     if (result == MessageBoxResult.Yes)
                     {
                         //如果选择的是,给备注赋值,是
                         this.View.Model.SetValue("FNote", "您选择--是");
                     }
                     else if (result == MessageBoxResult.No)
                     {
                         //如果选择的否,给备注赋值,否
                         this.View.Model.SetValue("FNote", "您选择--否");
                     }
                 }));
                //刷新一下备注
                this.View.UpdateView("FNote");



4、重新生成dll



5、最终效果,打开销售订单,点按钮,黄色弹窗,是否

image.png


image.png

-------------------------------------------------


6、是、否、取消  

MessageBoxOptions.YesNoCancel


                this.View.ShowMessage("错误提示,是否继续?",
                    //提示信息:是、否,取消
                MessageBoxOptions.YesNoCancel,
                    //通过result接收值
                new Action<MessageBoxResult>((result) =>
                {
                    if (result == MessageBoxResult.Yes)
                    {
                        //如果选择的是,给备注赋值,是
                        this.View.Model.SetValue("FNote", "您选择--是");
                    }
                    else if (result == MessageBoxResult.No)
                    {
                        //如果选择的否,给备注赋值,否
                        this.View.Model.SetValue("FNote", "您选择--否");
                    }
                    else if (result == MessageBoxResult.Cancel)
                    {
                        //如果选择的取消,给备注赋值,取消
                        this.View.Model.SetValue("FNote", "您选择--取消");
                    }
                }));


7、重新生成dll



8、最终效果,打开销售订单,点按钮,黄色弹窗,是、否、取消

image.png

image.png


image.png


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
//最基础的
using Kingdee.BOS;
//表单插件
using Kingdee.BOS.Core.Bill.PlugIn;
//说明
using System.ComponentModel;
using Kingdee.BOS.Core.DynamicForm;


namespace Kingdee.Bos.ProJect.BillMessage.Pluln
{
    //说明
    [Description("提示信息框")]
    
    //热启
    [Kingdee.BOS.Util.HotUpdate]
    
    
    //继承表单插件
    public class ClassName:AbstractBillPlugIn
    {
        //按钮点击事件
        public override void BarItemClick(BOS.Core.DynamicForm.PlugIn.Args.BarItemClickEventArgs e)
        {
            base.BarItemClick(e);
            
            
            //if条件判断,当点击YDIE_ tbGetSetValue这个按钮时候触发
            if(e.BarItemKey.Equals("YDIE_tbGetSetValue"))
            {
                //弹窗,你好
                //this.View.ShowMessage("你好");
                
                //错误信息,对话框
                //this.View.ShowErrMessage("严重错误");
                
                //this.View.ShowMessage("错误提示,是否继续?",
                //    //提示信息:是、否
                
                //MessageBoxOptions.YesNo,
                //    //通过result接收值
                
                //new Action<MessageBoxResult>((result) =>
                // {
                //     if (result == MessageBoxResult.Yes)
                //     {
                //         //如果选择的是,给备注赋值,是
                //         this.View.Model.SetValue("FNote", "您选择--是");
                //     }
                //     else if (result == MessageBoxResult.No)
                //     {
                //         //如果选择的否,给备注赋值,否
                //         this.View.Model.SetValue("FNote", "您选择--否");
                //     }
                // }));
                
                
                this.View.ShowMessage("错误提示,是否继续?",
                    //提示信息:是、否,取消
                MessageBoxOptions.YesNoCancel,
                    //通过result接收值
                new Action<MessageBoxResult>((result) =>
                {
                    if (result == MessageBoxResult.Yes)
                    {
                        //如果选择的是,给备注赋值,是
                        this.View.Model.SetValue("FNote", "您选择--是");
                    }
                    else if (result == MessageBoxResult.No)
                    {
                        //如果选择的否,给备注赋值,否
                        this.View.Model.SetValue("FNote", "您选择--否");
                    }
                    else if (result == MessageBoxResult.Cancel)
                    {
                        //如果选择的取消,给备注赋值,取消
                        this.View.Model.SetValue("FNote", "您选择--取消");
                    }
                }));
                //刷新一下备注
                this.View.UpdateView("FNote");
            }
        }
    }
}


总目录链接

https://vip.kingdee.com/article/64993872014591232




赞 22