private static string createMsg(int taskId, string message, msgType type, string className, string functionName) { string msgTime = DateTime.Now.ToString("yyyy-MM-dd_HH_mm_ss"); string msgTaskId = ""; if (taskId != EMPTY_TASK_ID) msgTaskId = String.Format("[s#{0}] ", taskId); string typeStr = ""; if (type == msgType.Error) typeStr = "ERROR"; else if (type == msgType.Warning) typeStr = "WARNING"; string combinedMessage = ""; if (className != "" && functionName != "") combinedMessage = String.Format("{0}! ({1}::{2})", message, className, functionName); else combinedMessage = String.Format("{0}!", message); if (typeStr != "") combinedMessage = String.Format("{0} {1}:: {2}: {3}\n", msgTime, msgTaskId, typeStr, combinedMessage); else combinedMessage = String.Format("{0}{1} ({2})\n", msgTaskId, combinedMessage, msgTime); return combinedMessage; }
public ProtectionStatus(msgType msgType, string name, string admName = null, bool isdebug = false) { MsgType = msgType; Name = name; Enabler = admName; isDebug = isdebug; }
public static DialogResult showMessage(msgType mt, string msg) { DialogResult returnMsg = DialogResult.Ignore; switch (mt) { case msgType.error: MessageBox.Show(msg, msgHeader, MessageBoxButtons.OK, MessageBoxIcon.Error); break; case msgType.exclamation: MessageBox.Show(msg, msgHeader, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); break; case msgType.question: returnMsg = MessageBox.Show(msg, msgHeader, MessageBoxButtons.YesNo, MessageBoxIcon.Question); break; case msgType.information: returnMsg = MessageBox.Show(msg, msgHeader, MessageBoxButtons.OK, MessageBoxIcon.Information); break; } return(returnMsg); }
// Log based on error type public static void Log(string msg, msgType tp = msgType.error) { string prefix = ""; switch (tp) { case (msgType.error): prefix = "[ERROR] :: "; break; case (msgType.warning): prefix = "[WARNING] :: "; break; case (msgType.info): prefix = "[info] :: "; break; default: break; } string date = DateTime.Now.ToString("dd-MM-yy || HH:mm:ss "); File.AppendAllText("ehmpt.log", date + prefix + msg + Environment.NewLine); }
public static void writeMsgToConsole(int taskId, string message, msgType type, string className = "", string functionName = "", bool writeToLog = false) { string displayMsg = createMsg(taskId, message, type, className, functionName); Console.WriteLine(displayMsg); if (writeToLog) writeMsgToFileLog(taskId, message, type, className, functionName); }
private void MsgEvenDeal(msgType type, object msg) { if (richTextBox1.Lines.Length >= 200) { richTextBox1.Clear(); } richTextBox1.AppendText(msg.ToString()); }
public bubble(string kMessage, string urlPic, string urlSticker, int Mess_Type, string kTime, msgType messageType) { InitializeComponent(); // Define this.kMessage = kMessage; this.urlPic = urlPic; this.urlSticker = urlSticker; this.Mess_Type = Mess_Type; this.kTime = kTime; this.messageType = messageType; lb_message.Text = kMessage; if (urlSticker == "") { this.Width = lb_message.Width + 20; } else { this.Width = picture_sticker.Width + 20; } lb_message.Top = 10; lb_message.Left = 10; lb_time.Text = kTime; SetHeight(); if (messageType.ToString() == "In") { // Incoming message //this.BackColor = Color.FromArgb(0, 164, 147); gradientPanel.GradientBottomLeft = gradientPanel.GradientTopLeft = Panel_Color_Bubble.LeftColor; gradientPanel.GradientBottomRight = gradientPanel.GradientTopRight = Panel_Color_Bubble.RightColor; lb_message.TextAlign = ContentAlignment.MiddleRight; } else { // Message from me //this.BackColor = Color.Gray; gradientPanel.GradientBottomLeft = gradientPanel.GradientTopLeft = gradientPanel.GradientBottomRight = gradientPanel.GradientTopRight = Color.FromArgb(241, 240, 240); lb_message.TextAlign = ContentAlignment.MiddleLeft; lb_message.ForeColor = Color.Black; } /*int isPicture = 0;*/ if (urlSticker != "") { isPicture = 1; gradientPanel.Visible = false; this.BackColor = Color.White; picture_sticker.ImageLocation = "../../Resources\\" + urlSticker; picture_sticker.Visible = true; } /*SetHeight(isPicture);*/ }
/// <summary> /// show a message box with multiple buttons as options /// </summary> /// <param name="msg">Message.</param> /// <param name="msgOptions">Message options.</param> public void showMessageOptions(string msg, List <string> msgOptions, ReturnFromMsgBox r, string title = "Attention") { displayMsg = msg; this.msgOptions = msgOptions; returnFromMsgBox = r; displayTitle = title; currMsgType = msgType.msgBoxOptions; show = true; }
public void showTextMessageBox(string msg, ReturnFromMsgBox r, string defaultTxt = "enter text here", string title = "Attention") { displayMsg = msg; displayTitle = title; returnFromMsgBox = r; currMsgType = msgType.textInput; stringToReturn = defaultTxt; show = true; }
public void showMessage(string msg, ReturnFromMsgBox r = null, string title = "Attention") { displayMsg = msg; displayTitle = title; returnFromMsgBox = r; currMsgType = msgType.msgBox; show = true; Debug.Log("Message: " + msg); }
public void showTextMessageBox(string msg, ReturnFromMsgBox r, string defaultTxt="enter text here", string title="Attention") { displayMsg = msg; displayTitle = title; returnFromMsgBox = r; currMsgType = msgType.textInput; stringToReturn = defaultTxt; show = true; }
/// <summary> /// show a message box with multiple buttons as options /// </summary> /// <param name="msg">Message.</param> /// <param name="msgOptions">Message options.</param> public void showMessageOptions(string msg, List<string> msgOptions, ReturnFromMsgBox r, string title="Attention") { displayMsg = msg; this.msgOptions = msgOptions; returnFromMsgBox = r; displayTitle = title; currMsgType = msgType.msgBoxOptions; show = true; }
public void showMessage(string msg, ReturnFromMsgBox r=null, string title="Attention") { displayMsg = msg; displayTitle = title; returnFromMsgBox = r; currMsgType = msgType.msgBox; show = true; Debug.Log("Message: " + msg); }
///*************************************************** /// public static void SendMessage(string remoteMachineId, object content, msgType msgtype) { websocketMsgTemp <object> data = new websocketMsgTemp <object>(); data.senderId = MachineLogic.localMachine().machineId; data.receiverId = remoteMachineId; data.msgType = msgtype; data.content = content; wsclient.Send(JsonConvert.SerializeObject(data)); }
public void showMsg(string msg,msgType type) { switch (type) { case msgType.Error: errorLbl.ForeColor = Color.Red;break; case msgType.Warning: errorLbl.ForeColor = Color.Yellow; break; case msgType.Info: errorLbl.ForeColor = Color.BlueViolet; break; } errorLbl.Text = msg; errorLbl.Visibility = ElementVisibility.Visible; }
public static Offset <ServerMessage> CreateServerMessage(FlatBufferBuilder builder, msgType type = msgType.RoomStateUpdate, msg data_type = msg.NONE, int dataOffset = 0) { builder.StartObject(3); ServerMessage.AddData(builder, dataOffset); ServerMessage.AddDataType(builder, data_type); ServerMessage.AddType(builder, type); return(ServerMessage.EndServerMessage(builder)); }
public void SendColorRes(msgType cres)//zwrotka na zmianę koloru { if (server) { PlayerL sss = new PlayerL(); sss.Lista = plData.getList(); sss.type = cres; Message m = response(sss); Message ms = new Message(); ss.sendMSG(m); } }
public TextBubble(string msg, msgType type) { InitializeComponent(); message.Text = msg; setHeight(); if (type.ToString() == "Out") { this.bubble.Location = new Point(457 - (bubble.Width + 20), 0); this.bubble.FillColor = System.Drawing.Color.FromArgb(((int)(((byte)(250)))), ((int)(((byte)(48)))), ((int)(((byte)(90))))); this.bubble.FillColor2 = System.Drawing.Color.FromArgb(((int)(((byte)(128)))), ((int)(((byte)(36)))), ((int)(((byte)(206))))); } }
/// <summary> /// Write to console with predefined header /// </summary> /// <param name="msg">The message to display</param> /// <param name="msgtype">the type of message to display</param> /// <param name="newline">End with a new line?</param> /// <param name="log">Log the message to log file?</param> public static void Write(string msg, msgType msgtype = msgType.standard, bool newline = true, bool log = true) { switch (msgtype) { case msgType.standard: { Console.ForegroundColor = ConsoleColor.White; Console.Write("[INFO] :: "); if (log) io.Log(msg); break; } case msgType.system: { Console.ForegroundColor = ConsoleColor.Blue; Console.Write("[SYSTEM] :: "); if (log) io.Log(msg); break; } case msgType.warning: { Console.ForegroundColor = ConsoleColor.Yellow; Console.Write("[WARNING] :: "); if (log) io.Log(msg); main.warn_count++; break; } case msgType.error: { // Errors are not logged because we log the full errors. Console.ForegroundColor = ConsoleColor.Red; Console.Write("[ERROR] :: "); main.err_count++; break; } default: { break; } } if (newline) Console.WriteLine(msg); else Console.Write(msg); Console.ForegroundColor = ConsoleColor.White; }
public Message preparesMSG(msgType m) { PlayerL player = new PlayerL(pl); player.type = m; /*if (m == msgType.colorUpd)//do testów * { * player.Lista[0].playerID = "test"; * player.Lista[0].iPadd = "127.0.1.0";// na potrzeby testów * player.Lista[0].Color = kolor; * }*/ Message msg1 = SRL.Serialize(player); // w msg.Data jest obiekt do wysłania return(msg1); }
public static byte[] BuildMessage(msgType type, string stringData) { var fbb = new FlatBufferBuilder(1024); switch (type) { case msgType.SocketCreateOrJoinRoom: var cjString = fbb.CreateString(stringData); var cjRoomOffset = StringData.CreateStringData(fbb, cjString); ServerMessage.StartServerMessage(fbb); ServerMessage.AddType(fbb, msgType.SocketCreateOrJoinRoom); ServerMessage.AddDataType(fbb, msg.StringData); ServerMessage.AddData(fbb, cjRoomOffset.Value); var builtMessage = ServerMessage.EndServerMessage(fbb); fbb.Finish(builtMessage.Value); return(fbb.SizedByteArray()); } return(null); }
private void fireToFocused(UIControl control, Game g, msgType type, object args) { control.fireEvent(g, type, args); //fire to every focused child in the control and recursively fire. int l = control.p_Children.Count; for (int c = 0; c < l; c++) { UIControl child = control.p_Children[c]; if (child.p_Focus) { fireToFocused( child, g, type, args); } } }
public static void writeMsgToFileLog(int taskId, string message, msgType type, string className, string functionName) { string appDir = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); string fileName = Path.Combine(appDir, logFileName); string displayMsg = createMsg(taskId, message, type, className, functionName); try { lock (fileLock) { using (StreamWriter file = new StreamWriter(fileName, true)) { file.WriteLine(displayMsg); } } } catch (IOException e) { writeMsgToConsole(e.ToString(), msgType.Error, "TwitterStreamingDacq.StreamLogger", "writeMsgToFileLog", false); } }
//Creating the screenshots public static void Log(string sMessage, msgType msgtype) { try { CreateFolder(); logStream = new StreamWriter(filePath, true); switch (msgtype) { case msgType.Message: logStream.WriteLine(DateTime.Now.ToString() + " " + sMessage + "<br>"); break; case msgType.Warning: logStream.WriteLine(DateTime.Now.ToString() + " <font color='yellow'>" + sMessage + "</font><br>"); break; case msgType.Error: logStream.WriteLine(DateTime.Now.ToString() + " <font color='red'><b>" + sMessage + "</b></font><br>"); break; case msgType.Passed: logStream.WriteLine("{0} <font color='green'><b>{1}</b></font><br>", DateTime.Now.ToString(), sMessage); break; } } catch (Exception ex) { Log("Error -" + ex.Message, msgType.Error); } finally { if (logStream != null) { logStream.Flush(); logStream.Dispose(); } } }
public FileBubble(string fileName, byte[] file, msgType type) { InitializeComponent(); string[] fileInfo = getFileInfo(fileName); FileName = fileInfo[0] + fileInfo[1].ToLower(); Files = file; if (type.ToString() == "Out") { this.pnlBubble.Location = new Point(457 - (pnlBubble.Width + 20), 0); } if (fileInfo[1].Equals(".JPG") || fileInfo[1].Equals(".JPEG") || fileInfo[1].Equals(".PNG") || fileInfo[1].Equals(".GIF")) { this.picture.Size = new Size(230, 130); this.picture.Location = new Point(10, 10); this.picture.Image = ChatAppUtils.ByteToImage(Files); this.fileName.Visible = false; this.fileSize.Visible = false; } else { this.fileName.Text = FileName; this.fileSize.Text = getFileSize(Files); } }
public message(String msgContent, msgType type, String path = null) { this.msgContent = msgContent; this.type = type; this.path = path; }
public toolMessage(msgType _msgType) { InitializeComponent(); // Add any initialization after the InitializeComponent() call. bool _btnClose = false; bool _btnYes = false; bool _btnNo = false; if (_msgType == msgType.msgError) { Status_Colour.Fill = Brushes.Crimson; shortMessage = "Error"; _btnClose = true; } else if (_msgType == msgType.msgApproved) { Status_Colour.Fill = Brushes.Green; shortMessage = "Approve"; _btnClose = true; //OnClose_MsgBox(); _btnYes = false; _btnNo = false; } else if (_msgType == msgType.msgAnnulled) { Status_Colour.Fill = Brushes.Crimson; shortMessage = "Annul"; //OnClose_MsgBox(); _btnClose = true; _btnYes = false; _btnNo = false; } else if (_msgType == msgType.msgQuestion) { Status_Colour.Fill = Brushes.Purple; shortMessage = "Question"; _btnYes = false; _btnNo = false; } else if (_msgType == msgType.msgSaved) { Status_Colour.Fill = Brushes.PaleGreen; shortMessage = "Saved"; _btnClose = true; //OnClose_MsgBox(); } else if (_msgType == msgType.msgDeleted) { Status_Colour.Fill = Brushes.PaleGreen; shortMessage = "Deleted"; _btnClose = true; } else if (_msgType == msgType.msgWarning) { Status_Colour.Fill = Brushes.Gold; shortMessage = "Warning"; _btnClose = true; //OnClose_MsgBox(); } if (_btnClose) { Label btnClose = new Label(); btnClose.FontWeight = FontWeights.Thin; btnClose.FontSize = 15; btnClose.Cursor = Cursors.Hand; btnClose.VerticalAlignment = VerticalAlignment.Center; btnClose.HorizontalAlignment = HorizontalAlignment.Center; dynamic LocTextExtensionClose = new LocTextExtension("Cognitivo:local:Cancel").SetBinding(btnClose, ContentProperty); btnClose.MouseUp += btnClose_MouseUp; stackQuestion.Children.Add(btnClose); } if (_btnYes | _btnNo) { Label btnYes = new Label(); btnYes.FontWeight = FontWeights.Thin; btnYes.FontSize = 15; btnYes.Cursor = Cursors.Hand; btnYes.VerticalAlignment = VerticalAlignment.Center; btnYes.HorizontalAlignment = HorizontalAlignment.Center; dynamic LocTextExtensionYes = new LocTextExtension("Cognitivo:local:Yes").SetBinding(btnYes, ContentProperty); btnYes.MouseUp += btnYes_MouseUp; stackQuestion.Children.Add(btnYes); Label btnNo = new Label(); btnNo.FontWeight = FontWeights.Thin; btnNo.FontSize = 15; btnNo.Cursor = Cursors.Hand; btnNo.VerticalAlignment = VerticalAlignment.Center; btnNo.HorizontalAlignment = HorizontalAlignment.Center; dynamic LocTextExtensionNo = new LocTextExtension("Cognitivo:local:No").SetBinding(btnNo, ContentProperty); btnNo.MouseUp += btnNo_MouseUp; stackQuestion.Children.Add(btnNo); } }
public static void showMsg(string msg,msgType type) { MainMenu.showMsg(msg,type); }
public static void AddType(FlatBufferBuilder builder, msgType type) { builder.AddSbyte(0, (sbyte)type, 0); }
private void sendMessage(Game g, msgType type, object args) { if (!p_Enabled) { return; } //no event? if (type == msgType.NONE) { return; } //key event? bool isKeyEvent = type >= msgType.KEY_DOWN; //does this event need focus? bool requireFocus = isKeyEvent || type >= msgType.MOUSE_MOVE; if (requireFocus && !p_Focus) { return; } //handle key if (isKeyEvent) { fireToFocused(this, g, type, args); return; } //is the mouse within the region of this control? Point mousePosition = g.Window.PointToClient(Cursor.Position); bool mouseHit = DoesCollide(g, mousePosition); //mouse click/down if (type == msgType.MOUSE_DOWN || type == msgType.MOUSE_CLICK) { if (mouseHit) { if (!p_Focus) { Focus(); } fireEvent(g, type, args); //send message to all children int l = p_Children.Count; for (int c = 0; c < l; c++) { p_Children[c].fireEvent( g, type, args ); } } else if (p_Focus) { RemoveFocus(); } } }
public OperatorMessage(msgType type) { Type = type; }
def Listen (msgType as System.Type, listener as MonoBehaviour):
private void showMessage(string MsgHeader, string MsgTopic, string MsgBody, string MsgSolution, msgType AlertType) { string errorMsgBody = "Please Contact AdministratorTel 02-xxx-xxxx"; if (MsgHeader.Equals(string.Empty) && MsgTopic.Equals(string.Empty) && MsgBody.Equals(string.Empty)) { (masterpage.FindControl("DialogHeader") as Label).Text = msgType.Message.ToString(); (masterpage.FindControl("DialogTopic") as Label).Text = "Haven't this ID"; (masterpage.FindControl("DialogMsg") as Label).Text = errorMsgBody; (masterpage.FindControl("ModalPopupExtender") as ModalPopupExtender).Show(); } else { if (AlertType.Equals(msgType.Message)) { (masterpage.FindControl("DivDialog") as HtmlGenericControl).Style["display"] = "inline"; (masterpage.FindControl("divSolution") as HtmlGenericControl).Style["display"] = "inline"; (masterpage.FindControl("DialogOkButton") as Button).Text = "OK"; (masterpage.FindControl("divCancel") as HtmlGenericControl).Style["display"] = "none"; (masterpage.FindControl("divOk") as HtmlGenericControl).Style["display"] = "inline"; (masterpage.FindControl("DialogHeader") as Label).Text = MsgHeader; (masterpage.FindControl("DialogTopic") as Label).Text = MsgTopic; (masterpage.FindControl("DialogMsg") as Label).Text = MsgBody; (masterpage.FindControl("ModalPopupExtender") as ModalPopupExtender).Show(); } else if (AlertType.Equals(msgType.Error)) { (masterpage.FindControl("DivDialog") as HtmlGenericControl).Style["display"] = "inline"; (masterpage.FindControl("divSolution") as HtmlGenericControl).Style["display"] = "inline"; (masterpage.FindControl("DialogCancelButton") as Button).Text = "OK"; (masterpage.FindControl("divCancel") as HtmlGenericControl).Style["display"] = "inline"; (masterpage.FindControl("divOk") as HtmlGenericControl).Style["display"] = "none"; (masterpage.FindControl("DialogHeader") as Label).Text = AlertType.ToString(); (masterpage.FindControl("DialogTopic") as Label).Text = MsgTopic; (masterpage.FindControl("DialogMsg") as Label).Text = MsgBody; (masterpage.FindControl("DialogSolution") as Label).Text = MsgSolution; (masterpage.FindControl("ModalPopupExtender") as ModalPopupExtender).Show(); StringBuilder mScript = new StringBuilder(string.Empty); mScript.AppendFormat("DialogError('{0}','{1}','{2}','{3}')", AlertType.ToString(), MsgTopic, MsgBody, errorMsgBody); ScriptManager.RegisterClientScriptBlock(HttpContext.Current.Handler as Page, (HttpContext.Current.Handler as Page).GetType(), "onload", mScript.ToString(), true); } } }
// Easier logging because im lazy public void Log(string msg, msgType msgT = msgType.Normal) { lbLog.Items.Add(msg); lbLog.SelectedIndex = lbLog.Items.Count - 1; lbLog.ScrollIntoView(lbLog.SelectedItem); }
public static void writeMsgToFileLog(string message, msgType type, string className, string functionName) { writeMsgToFileLog(EMPTY_TASK_ID, message, type, className, functionName); }
private void fireEvent(Game g, msgType type, object args) { mouseArgs mArgs = (args is mouseArgs ? args as mouseArgs : null); switch (type) { #region KeyUp case msgType.KEY_UP: if (KeyUp != null) { KeyUp(g, args as KeyEventArgs); } break; #endregion #region KeyDown case msgType.KEY_DOWN: if (KeyDown != null) { KeyDown(g, args as KeyEventArgs); } break; #endregion #region MouseMove case msgType.MOUSE_MOVE: if (MouseMove != null) { MouseMove(g, mArgs.mousePosition, mArgs.e); } break; #endregion #region MouseDown case msgType.MOUSE_DOWN: if (MouseDown != null) { MouseDown(g, mArgs.mousePosition, mArgs.e); } break; #endregion #region MouseUp case msgType.MOUSE_UP: if (MouseUp != null) { MouseUp(g, mArgs.mousePosition, mArgs.e); } break; #endregion #region MouseMove case msgType.MOUSE_SCROLL: if (MouseScroll != null) { MouseScroll(g, mArgs.mousePosition, mArgs.e); } break; #endregion } }
public static void writeMsgToConsole(string message, msgType type, string className = "", string functionName = "", bool writeToLog = false) { writeMsgToConsole(EMPTY_TASK_ID, message, type, className, functionName, writeToLog); }
public MessageTypeAttribute(msgType msgType_) { this.msgType = msgType_; }
def StopListening (msgType as System.Type, listener as MonoBehaviour):