public IMessage Deserialize(EnumMsgType msgType, string version, string body) { string[] propArr = body.Split(new[] { '|' }); return(new IESMessage { MsgTag = { MsgType = msgType, Version = version }, ID = propArr[0], DeviceID = propArr[1] }); }
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { EnumMsgType msg = (EnumMsgType)value; BitmapImage bitmap = null; var basePath = System.AppDomain.CurrentDomain.SetupInformation.ApplicationBase; switch (msg) { case EnumMsgType.Info: bitmap = new BitmapImage(new Uri(basePath + @"images\infomation.png", UriKind.Absolute)); break; case EnumMsgType.Warning: bitmap = new BitmapImage(new Uri(basePath + @"images\warning.png", UriKind.Absolute)); break; case EnumMsgType.Error: bitmap = new BitmapImage(new Uri(basePath + @"images\error.png", UriKind.Absolute)); break; default: break; } return(bitmap); }
public IMessage Deserialize(EnumMsgType msgType, string version, string body) { string[] propArr = body.Split(new[] { '|' }); return(new LIVEMessage { MsgTag = { MsgType = msgType, Version = version }, MsgBody = propArr[0] }); }
/// <summary> /// 注册相应类型的回调 /// </summary> /// <param name="handler">回调函数</param> /// <param name="msgType">消息类型</param> public void Register(NotifyHandler handler, EnumMsgType msgType) { try { //判断消息类型是否存在,为消息类型添加回调函数 if (_callbackDic.ContainsKey(msgType)) { _callbackDic[msgType].Add(handler); } else { _callbackDic[msgType] = new List <NotifyHandler> { handler }; } Logger.WriteInfoFmt(Log.ReceiverRegister, "消息类型:{0}", new object[] { msgType.ToString() }); } catch (Exception ex) { Logger.WriteError(Log.ReceiverRegister, "注册消息接收组件时出现异常", ex); } }
public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { EnumMsgType msg = (EnumMsgType)value; SolidColorBrush brush = null; switch (msg) { case EnumMsgType.Info: brush = new SolidColorBrush(Color.FromRgb(0, 0, 255)); break; case EnumMsgType.Warning: brush = new SolidColorBrush(Color.FromRgb(255, 229, 0)); break; case EnumMsgType.Error: brush = new SolidColorBrush(Color.FromRgb(255, 0, 0)); break; default: break; } return(brush);; }
public MessageModel(DateTime time, EnumMsgType type, string content) { MsgTime = time; MsgType = type; MsgContent = content; }
public MessageModel(EnumMsgType type, string content) { MsgTime = DateTime.Now; MsgType = type; MsgContent = content; }
private string GetTopColor(EnumMsgType msgType) { switch (msgType) { case EnumMsgType.Success: return "#33CC33"; case EnumMsgType.Fail: return "#CC3333"; case EnumMsgType.Warning: return "#FFCC66"; default: return "#FF0000"; } }
private void ShowMessage(EnumMsgType MsgType, string Msg) { this.uC_Output1.MsgCollect.Add(new MessageModel(MsgType, Msg)); }