public Message(enMessageType type, uint id) { this.type = type; this.id = id; this.route = ""; this.jsonObj = null; }
public void SendPopupMessage(string Caption, string Message, enMessageType MessageType, bool GuarantedDelivery, params string[] UserName) { syncClientCtl1.Send(new DtPopUpMessageSend(Caption, Message, null, MessageType, GuarantedDelivery, UserName)); }
public Message(enMessageType type, uint id, string route, MessageObject data, string rawString) { this.type = type; this.id = id; this.route = route; this.jsonObj = data; this.rawString = rawString; }
public DtPopUpMessageReceive(string Sender, string Caption, string Message, object MessageData, enMessageType MessageType) { this.Sender = Sender; this.Caption = Caption; this.Message = Message; this.MessageData = MessageData; this.MessageType = MessageType; }
public DtPopUpMessageSend(string Caption, string Message, object MessageData, enMessageType MessageType, bool GuarantedDelivery, params string[] UserName) { this.Caption = Caption; this.Message = Message; this.MessageData = MessageData; this.MessageType = MessageType; this.GuarantedDelivery = GuarantedDelivery; this.UserName = UserName; }
private void FormInitialize(string strMsg1, string strMsg2, enMessageType _enType, int intclosesec) { lblMsg1.Text = strMsg1; lblMsg2.Text = strMsg2; this.TopMost = true; enType = _enType; tmrSec = new System.Threading.Timer(new System.Threading.TimerCallback(SecCount), null, 1000, 1000); intCloseSec = intclosesec; switch (enType) { case enMessageType.YesNo: btnYes.Visible = true; btnNO.Visible = true; break; case enMessageType.None: //none으로 설정시 10초후에 사라 진다. btnOK.Visible = true; intCloseSec = 10; break; case enMessageType.OK: btnOK.Visible = true; break; default: btnOK.Visible = true; break; } this.Select(true, false); this.BringToFront(); }
public Message(enMessageType type, string route, MessageObject data) { this.type = type; this.route = route; this.jsonObj = data; }
public frmMessage(string strMsg1, string strMsg2, enMessageType enType, int intclosesec) { InitializeComponent(); FormInitialize(strMsg1, strMsg2, enType, intclosesec); }
public frmMessage(string strMsg1, string strMsg2, enMessageType enType) { InitializeComponent(); FormInitialize(strMsg1, strMsg2, enType, 0); }
public frmMessage(string title, string msg, enMessageType enType, int closetime = 0, DialogResult defaltResult = System.Windows.Forms.DialogResult.No, bool ShowApplyAll = false) { InitializeComponent(); _defaltResult = defaltResult; int line_qty = msg.Split(new string[] { "\r\n" }, StringSplitOptions.None).Length; int line_Height = Fnc.floatToInt(Function.form.control.Font_Control_String_Size_Get(lblMsg, control.enControl_Criteria.height, "A")); if (line_qty > 2) { //2줄 이상 this.Height += ((line_qty - 1) * line_Height); } else { //한줄일 경우 float txtWidth = Function.form.control.Font_Control_String_Size_Get(lblMsg, control.enControl_Criteria.width, msg); float line_f = txtWidth / (lblMsg.Width); float half = (txtWidth % (lblMsg.Width)) / lblMsg.Width * 0.9f * 100; line_qty = Fnc.floatToInt(line_f) + (half >= 50f ? 0 : 1); this.Height += ((line_qty - 1) * line_Height); } _closetime = closetime; int he_01 = lblTitle.Height; lblTitle.Text = title; lblMsg.Text = msg; _enType = enType; float f = Function.form.control.Font_Control_String_Size_Get(lblTitle, control.enControl_Criteria.height, msg); f = f - he_01; if (f > 3) { this.Height += int.Parse(f.ToString("F0")); } switch (enType) { case enMessageType.YesNo: btnOk.Visible = false; btnYes.Image = Function.resIcon16.ok; btnNo.Image = Function.resIcon16.delete; break; case enMessageType.YesNoCancel: btnOk.Visible = false; btnYes.Image = Function.resIcon16.ok; btnNo.Image = Function.resIcon16.delete; btnCancel.Visible = true; btnCancel.Image = Function.resIcon16.redo; break; case enMessageType.None: //none으로 설정시 10초후에 사라 진다. btnYes.Visible = false; btnNo.Visible = false; btnOk.Image = Function.resIcon16.ok; _closetime = _closetime == 0 ? 10 : _closetime; break; case enMessageType.OK: btnYes.Visible = false; btnNo.Visible = false; btnOk.Image = Function.resIcon16.ok; break; default: btnYes.Visible = false; btnNo.Visible = false; btnOk.Image = Function.resIcon16.ok; break; } chkApplyAll.Visible = ShowApplyAll; if (_closetime > 0) { tmrSec = new System.Threading.Timer(new System.Threading.TimerCallback(SecCount), null, 1000, 1000); } }
public Message Decode(byte[] buffer) { //Decode head //Get flag byte flag = buffer[0]; //Set offset to 1, for the 1st byte will always be the flag int offset = 1; //Get type from flag; enMessageType type = (enMessageType)((flag >> 1) & MSG_Type_Mask); uint id = 0; string route; if (type == enMessageType.Response) { int length; id = (uint)Decoder.DecodeUInt32(offset, buffer, out length); if (id <= 0 || !reqMap.ContainsKey(id)) { return(null); } else { route = reqMap[id]; reqMap.Remove(id); } offset += length; } else if (type == enMessageType.Push) { //Get route if ((flag & 0x01) == 1) { ushort routeId = ReadShort(offset, buffer); route = abbrs[routeId]; offset += 2; } else { byte length = buffer[offset]; offset += 1; route = Encoding.UTF8.GetString(buffer, offset, length); offset += length; } } else { return(null); } //Decode body byte[] body = new byte[buffer.Length - offset]; for (int i = 0; i < body.Length; i++) { body[i] = buffer[i + offset]; } MessageObject msg; string rawString = null; if (decodeProtos.ContainsKey(route)) { msg = protobuf.Decode(route, body); } else { rawString = Encoding.UTF8.GetString(body); msg = (MessageObject)SimpleJson.SimpleJson.DeserializeObject(rawString); } //Construct the message return(new Message(type, id, route, msg, rawString)); }
/// <summary> /// 메시지를 보여준다. /// </summary> /// <param name="strMsg1"></param> /// <param name="strMsg2"></param> /// <param name="enType"></param> /// <returns></returns> public DialogResult ShowMessage(string strMsg1, string strMsg2, enMessageType enType) { lblMsg1.Text = strMsg1; lblMsg2.Text = strMsg2; try { this.Visible = true; this.BringToFront(); this.Select(); DialogResult = DialogResult.None; switch (enType) { case enMessageType.YesNo: btnYes.Visible = true; btnNO.Visible = true; break; case enMessageType.None: //none으로 설정시 10초후에 사라 진다. btnOK.Visible = true; tmrSec = new System.Threading.Timer(new System.Threading.TimerCallback(SecCount), null, 1000, 1000); break; case enMessageType.OK: btnOK.Visible = true; break; default: btnOK.Visible = true; break; } Application.DoEvents(); while (true) { if (DialogResult != DialogResult.None) { break; } Thread.Sleep(200); } return(DialogResult); } catch { return(DialogResult); } finally { this.Visible = false; if (tmrSec != null) { tmrSec.Dispose(); Application.DoEvents(); tmrSec = null; } } }