internal void displayMessage(string message, MessageTypes type = MessageTypes.Default) { int oldText = outputBox.TextLength; outputBox.AppendText("\n" + message); if (type != MessageTypes.Default) { outputBox.SelectionStart = oldText; outputBox.SelectionLength = message.Length; } switch (type) { case MessageTypes.Error: outputBox.SelectionColor = Color.Red; break; case MessageTypes.Alert: outputBox.SelectionColor = Color.Blue; break; case MessageTypes.Complete: outputBox.SelectionColor = Color.Green; break; default: break; } }
/// <summary> /// Add the given message to the log. /// </summary> private void Log(MessageTypes type, string member, IMetadataScope scope, string msg) { if (IsDisposed) return; if (InvokeRequired) { Invoke(new Action<MessageTypes, string, IMetadataScope, string>(Log), type, member, scope, msg); } else { if ((type >= MessageTypes.MissingFirst) && (type <= MessageTypes.MissingLast)) { MemberNode node; if (!nodes.TryGetValue(member, out node)) { node = new MemberNode(member, scope, type); node.ImageIndex = (int) type; nodes.Add(member, node); tvList.Nodes.Add(node); } node.Messages.Add(msg); if (node == tvList.SelectedNode) { tvUsedIn.Nodes.Add(new TreeNode(msg)); } } else { tvLog.Nodes.Add(new TreeNode(msg) { ImageIndex = (int) type }); } miCopy.Enabled = (tvList.Nodes.Count > 0); } }
public Message(MessageTypes type, string body) { Content = body; Type = type; Tag = string.Empty; ByteLength = 0; }
public Packet(int source, int dest, MessageTypes type, string msg) { From = source; To = dest; Intention = type; Data = msg; }
public static byte[] sendmessage(MessageTypes type, string msg) { byte[] data = new byte[SIZE]; if (sendmessage(type, msg, ref data)) return data; return new byte[0]; }
public override void Send(MessageTypes type, byte[] data, object messageBag) { var local = CurrentSocket(); if (local != null) { try { byte[] msg = null; if (messageBag != null) { var msgTrack = new MessageTrackingObject(messageBag); messageTracker.TryAdd(msgTrack.MessageGuid, msgTrack); msg = Message.CreateMessageByte(data, type, msgTrack.MessageGuid); } else { msg = Message.CreateMessageByte(data, type); } local.BeginSend(msg, 0, msg.Length, SocketFlags.None, new AsyncCallback(this.EndSend), local); } catch (SocketException) { Close(); } } }
public Message(MessageTypes type, string content, int len) { Content = content; Type = type; Tag = string.Empty; ByteLength = len; }
public static ResponseType SendMessage(string title, string message, MessageTypes type, Exception ex) { MessageEventArgs e = new MessageEventArgs(); e.title = title; e.message = message; e.type = type; if(ex!=null) e.exception = ex; else e.exception = null; ICommunicationReceiver receiver = getReceiver(); if(receiver==null) return ResponseType.Cancel; if(receiver.context!=null) { receiver.context.Send(new SendOrPostCallback(delegate(object state) { MessageEventHandler handler = receiver.sendMessage; if(handler!=null) { handler(e); } }),null); } else { receiver.sendMessage(e); } waitForResponse(e); ProgressHandler.progress_state = ProgressState.Normal; return e.response; }
protected static ResponseType SendMessage(string title, string message, MessageTypes type, Exception ex, bool suppressable) { MessageEventArgs e = new MessageEventArgs(); e.type = type; e.exception = ex; e.title = title; e.message = message; e.Suppressable = suppressable; ICommunicationReceiver receiver = getReceiver(); if (receiver == null) return ResponseType.Cancel; if (receiver.ThreadBridge != null) { receiver.ThreadBridge.Send(delegate() { MessageEventHandler handler = receiver.sendMessage; if (handler != null) { handler(e); } }); } else { receiver.sendMessage(e); } waitForResponse(e); ProgressHandler.state = ProgressState.Normal; return e.response; }
public MessageModel(MessageTypes messageType, string text) { if (String.IsNullOrWhiteSpace(text)) throw new ArgumentException(nameof(text)); MessageType = messageType; Text = text; }
public SupportedMessage(ConnectorSupportedMessagesPanel parent, IMessageAdapter adapter, MessageTypes type) { _parent = parent; _adapter = adapter; Type = type; Name = type.GetDisplayName(); }
public static bool sendmessage(MessageTypes type, string msg, ref byte[] data) { try { System.Text.ASCIIEncoding encoding = new System.Text.ASCIIEncoding(); byte[] message = encoding.GetBytes(msg); int size = HEADERSIZE + message.Length; data = new byte[size]; byte[] sizebyte = BitConverter.GetBytes(size); byte[] typebyte = BitConverter.GetBytes((int)type); Array.Copy(sizebyte, 0, data, LENGTHOFFSET, sizebyte.Length); Array.Copy(typebyte, 0, data, TYPEOFFSET, typebyte.Length); Array.Copy(message, 0, data, HEADERSIZE, message.Length); } #if DEBUG catch (Exception ex) { Console.WriteLine("error processing: " + type.ToString() + " msg: " + msg + " err: " + ex.Message + ex.StackTrace); return false; } #else catch (Exception) { } #endif return true; }
public MessageBox(MessageTypes type, string title, string message, Exception e, bool suppressable, AViewWindow owner, IEmailSource email_source) : this(title, message, suppressable, owner, email_source) { switch (type) { case MessageTypes.Error: if (e != null) { exceptionExpander.Visibility = System.Windows.Visibility.Visible; exceptionText.Text = recurseExceptions(e); if (e.GetType() == typeof(CommunicatableException)) { submitButton.Visibility = System.Windows.Visibility.Visible; } else { submitButton.Visibility = System.Windows.Visibility.Visible; } } closeButton.Visibility = System.Windows.Visibility.Visible; errorIcon.Visibility = System.Windows.Visibility.Visible; break; case MessageTypes.Info: okButton.Visibility = System.Windows.Visibility.Visible; infoIcon.Visibility = System.Windows.Visibility.Visible; break; case MessageTypes.Warning: okButton.Visibility = System.Windows.Visibility.Visible; warningIcon.Visibility = System.Windows.Visibility.Visible; break; } }
public Task<ClientConnectionResult> ConnectAsync(Target target, MessageTypes messageTypes) { if (target == null) throw new ArgumentNullException ("target"); var tcs = new TaskCompletionSource<ClientConnectionResult>(); this.connected = true; if (this.provider.IsRunning) { this.provider.Connect (this); if (this.connected) { OnConnected (new ClientConnectionEventArgs (this)); tcs.SetResult (new ClientConnectionResult (ConnectionResult.Success, null)); } } else { OnDisconnected (new DisconnectedEventArgs (this, ConnectionResult.ConnectionFailed)); tcs.SetResult (new ClientConnectionResult (ConnectionResult.ConnectionFailed, null)); } return tcs.Task; }
long tl_newUnknownRequest(MessageTypes t, string msg) { v("message: " + t.ToString() + " data: " + msg); switch (t) { case MessageTypes.DOMREQUEST: { string client = string.Empty; int depth = 0; if (Book.ParseDOMRequest(msg, ref depth, ref client)) { debug("depth set to: " + depth + " by client: " + client); tickdepth = depth; } break; } case MessageTypes.DAYHIGH: { decimal price = 0; highs.TryGetValue(msg, out price); return WMUtil.pack(price); } case MessageTypes.DAYLOW: { decimal price = 0; lows.TryGetValue(msg, out price); return WMUtil.pack(price); } } return (long)MessageTypes.UNKNOWN_MESSAGE; }
///<summary> ///constructor ///</summary> ///<param name="dispatchTime"></param> ///<param name="sender"></param> ///<param name="receiver"></param> ///<param name="msg"></param> public Telegram( float dispatchTime, uint sender, uint receiver, MessageTypes msg) : this(dispatchTime, sender, receiver, msg, null) { }
long s_newUnknownRequest(MessageTypes t, string msg) { if (t == MessageTypes.LOOPBACKSERVER) { return SPECIAL; } return 0; }
long tl_newUnknownRequest(MessageTypes t, string msg) { switch (t) { default: break; } return (long)MessageTypes.FEATURE_NOT_IMPLEMENTED; }
public MessageEvent(String messageString, DateTime messageTime, int messageVerbosity = 0, MessageTypes messageType = MessageTypes.Routine, MessageCategories messageCategory = MessageCategories.Unspecified) { myString = messageString; myTime = messageTime; verbosity = messageVerbosity; this.messageType = messageType; this.messageCategory = messageCategory; }
void TLClient_WM_gotFeatures(MessageTypes[] messages) { lock (_rfl) { _rfl.Clear(); foreach (MessageTypes mt in messages) _rfl.Add(mt); } }
public GenericMessage(MessageTypes type, long source, long dest, long msgid, string request, string response) { Type = type; Source = source; Dest = dest; Request = request; Response = response; ID = msgid; }
public GenericMessage(MessageTypes type, string request) { Type = type; Request = request; Source = 0; Dest = 0; Response = string.Empty; ID = 0; }
void TLClient_WM_gotFeatures(MessageTypes[] messages) { lock (RequestFeatureList) { RequestFeatureList.Clear(); foreach (MessageTypes mt in messages) RequestFeatureList.Add(mt); } }
public Overhead(AEntity parent, MessageTypes msgType, string text) : base(parent.Serial, parent.Map) { Parent = parent; MessageType = msgType; Text = text; m_TimePersist = 5000; }
public QueueMessage(MessageTypes type, IDictionary<string, string> payload, Guid? correlationId = null) { this.MessageType = type; this.Payload = payload; if (correlationId.HasValue && correlationId.Value != Guid.Empty) { this.CorrelationId = correlationId.Value; } }
/// <summary> /// Push a message to clients. /// </summary> /// <param name="messageType">The message type.</param> /// <param name="name">The message sender name.</param> /// <param name="message">The message to push.</param> public void PushMessage(MessageTypes messageType, string name, string message) { var command = new EnvironmentMessage().ToPostUrl(); var client = new RestClient(Host); var request = new RestRequest(command, Method.POST); request.AddParameter("messageType", messageType); request.AddParameter("name", name); request.AddParameter("message", message); client.ExecuteAsync(request, response => {}); }
private void AddMessage(string message, MessageTypes type) { var messages = new List<MessageForView>(); if (TempData["MessagesForView"] != null) messages = (List<MessageForView>)TempData["MessagesForView"]; messages.Add(new MessageForView { MessageType = type, Message = message }); TempData["MessagesForView"] = messages; }
public AsciiMessagePacket(PacketReader reader) : base(0x1C, "Ascii Message") { m_serial = reader.ReadInt32(); m_graphic = reader.ReadInt16(); m_type = (MessageTypes)reader.ReadByte(); m_hue = reader.ReadInt16(); m_font = reader.ReadInt16(); m_name = reader.ReadString(30); m_text = reader.ReadString(); }
public AsciiMessagePacket(PacketReader reader) : base(0x1C, "Ascii Message") { Serial = reader.ReadInt32(); Model = reader.ReadInt16(); MsgType = (MessageTypes)reader.ReadByte(); Hue = reader.ReadUInt16(); Font = reader.ReadInt16(); SpeakerName = reader.ReadString(30).Trim(); Text = reader.ReadString(); }
public static byte[] CreateMessageByte(byte[] data, MessageTypes type, Guid messageGuid) { var ret = new byte[data.Length + 22]; ret[0] = Convert.ToByte((int)type); var dataSize = BitConverter.GetBytes(data.Length); ret[ret.Length - 1] = 0xFF; Buffer.BlockCopy(dataSize, 0, ret, 1, 4); Buffer.BlockCopy(messageGuid.ToByteArray(), 0, ret, 5, 16); Buffer.BlockCopy(data, 0, ret, 21, data.Length); return ret; }
public Command(Guid messageId, MessageTypes messageType) : base(messageId, messageType) { }
public MessageObject(MessageTypes messageTypes, string text) { Text = text; MessageType = messageTypes; }
long tl_newUnknownRequest(MessageTypes t, string msg) { return((long)MessageTypes.FEATURE_NOT_IMPLEMENTED); }
/// <summary> /// Initialize <see cref="BaseChangeMessage{TMessage,TField}"/>. /// </summary> /// <param name="type">Message type.</param> protected BaseChangeMessage(MessageTypes type) : base(type) { }
public Request(int target, int sender, HostLoadInfo hostLoad, MessageTypes requestType) : base(target, sender, requestType) { CurrentHostLoadInfo = hostLoad; }
/// <summary> /// Initialize <see cref="CandleMessage"/>. /// </summary> /// <param name="type">Message type.</param> protected CandleMessage(MessageTypes type) : base(type) { }
/// <summary> /// Registers a call-back method, with a parameter, to be invoked when a specific message is broadcast. /// </summary> /// <param name="message">The message to register for.</param> /// <param name="callback">The call-back to be called when this message is broadcasted.</param> public void Register <T>(MessageTypes message, Action <T> callback) { this.Register(message, callback, typeof(T)); }
/// <summary> /// When your class is listening for a message with a particular method, the DeRegister method will /// remove your delagte from the collection - so this particular listener will no lionger receive this particular message /// </summary> /// <param name="message"></param> /// <param name="callback"></param> public void DeRegister(MessageTypes message, Delegate callback) { _messageToActionsMap.RemoveAction(message, callback.Target, callback.GetMethodInfo()); }
/// <summary> /// Initializes a new instance of the <see cref="SecurityMessage"/>. /// </summary> /// <param name="type">Message type.</param> protected SecurityMessage(MessageTypes type) : base(type) { }
/// <summary> /// Инициализировать <see cref="BaseConnectionMessage"/>. /// </summary> /// <param name="type">Тип сообщения.</param> protected BaseConnectionMessage(MessageTypes type) : base(type) { }
public void GetMessage(out Int64 ID, out MessageTypes MessageType, out string Message, out Int64 Number) { Channel.GetMessage(out ID, out MessageType, out Message, out Number); }
public Event(Guid messageId, MessageTypes messageType) : base(messageId, messageType) { }
/// <summary> /// Registers a call-back method, with no parameter, to be invoked when a specific message is broadcast. /// </summary> /// <param name="message">The message to register for.</param> /// <param name="callback">The call-back to be called when this message is broadcasted.</param> public void Register(MessageTypes message, Action callback) { this.Register(message, callback, null); }
void rmv_SendMessageEvent(MessageTypes type, long source, long dest, long msgid, string request, ref string response) { _bf.TLSend(type, source, dest, msgid, request, ref response); }
/// <summary> /// AddLoadMessage creates a message that will be returned on the next page load. /// </summary> /// <param name="message">The message you wish to display.</param> /// <param name="messageType">Type of the message.</param> public void Add([NotNull] string message, MessageTypes messageType) { this.LoadStringList.Add(new MessageNotification(message, messageType)); }
/// <summary> /// Allow View Models to send message.show request to subscribed view. /// </summary> /// <remarks> /// Highly coupled with <see cref="MessageManager"/>. /// </remarks> public void OnMessageRequest(string message, MessageTypes type) { MessageRequest?.Invoke(this, new MessageEventArgs(message, type)); }
/// <summary> /// AddLoadMessageSession creates a message that will be returned on the next page. /// </summary> /// <param name="message">The message you wish to display.</param> /// <param name="messageType">Type of the message.</param> public void AddSession([NotNull] string message, MessageTypes messageType) { // add it too the session list... this.SessionLoadString.Add(new MessageNotification(message, messageType)); }
private void ShowMessage(string message, MessageTypes type) { ShowMessage(message, type, null); }
public MessageEventArgs(string message, MessageTypes type) { Message = message; Type = type; }