コード例 #1
0
 /// <summary>
 /// 构造方法
 /// </summary>
 public MsgModel(bool result, MsgType type, string content)
 {
     this.Result  = result;
     this.Type    = type;
     this.Title   = MsgModel.GetDefaultTitle(type);
     this.Content = content;
 }
コード例 #2
0
            /// <summary>
            /// 扩展取2个MsgModel并集的方法(不支持MsgType=Info类型的计算)
            /// <para>[Result属性:取逻辑与][AutoClose属性:只要其中一个为true,结果为true][MsgType属性:自动运算]</para>
            /// <para>[Title和Content属性:根据MsgType自动设置,可修改][Extend和Javascript属性:忽略]</para>
            /// </summary>
            public static MsgModel operator +(MsgModel msg1, MsgModel msg2)
            {
                MsgModel msgModel = new MsgModel
                {
                    Result    = (msg1.Result && msg2.Result),
                    AutoClose = (msg1.AutoClose || msg2.AutoClose),
                    Type      = MsgModel.ReBuildMsgType(msg1.Type, msg2.Type)
                };

                msgModel.Title = MsgModel.GetDefaultTitle(msgModel.Type);
                MsgModel.SetMsgModelContent(msg1, msg2, msgModel);
                return(msgModel);
            }