Ejemplo n.º 1
0
        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;
            }
        }
Ejemplo n.º 2
0
 /// <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);
     }
 }
Ejemplo n.º 3
0
 public Message(MessageTypes type, string body)
 {
     Content = body;
     Type = type;
     Tag = string.Empty;
     ByteLength = 0;
 }
Ejemplo n.º 4
0
 public Packet(int source, int dest, MessageTypes type, string msg)
 {
     From = source;
     To = dest;
     Intention = type;
     Data = msg;
 }
Ejemplo n.º 5
0
 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();
         }
     }
 }
Ejemplo n.º 7
0
 public Message(MessageTypes type, string content, int len)
 {
     Content = content;
     Type = type;
     Tag = string.Empty;
     ByteLength = len;
 }
Ejemplo n.º 8
0
        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;
        }
Ejemplo n.º 9
0
        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;

        }
Ejemplo n.º 10
0
        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();
			}
Ejemplo n.º 12
0
        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;

            
        }
Ejemplo n.º 13
0
 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;
     }
 }
Ejemplo n.º 14
0
        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;
        }
Ejemplo n.º 15
0
 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;
 }
Ejemplo n.º 16
0
 ///<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)
 {
 }
Ejemplo n.º 17
0
 long s_newUnknownRequest(MessageTypes t, string msg)
 {
     if (t == MessageTypes.LOOPBACKSERVER)
     {
         return SPECIAL;
     }
     return 0;
 }
Ejemplo n.º 18
0
 long tl_newUnknownRequest(MessageTypes t, string msg)
 {
     switch (t)
     {
         default:
             break;
     }
     return (long)MessageTypes.FEATURE_NOT_IMPLEMENTED;
 }
Ejemplo n.º 19
0
 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;
 }
Ejemplo n.º 20
0
 void TLClient_WM_gotFeatures(MessageTypes[] messages)
 {
     lock (_rfl)
     {
         _rfl.Clear();
         foreach (MessageTypes mt in messages)
             _rfl.Add(mt);
     }
 }
Ejemplo n.º 21
0
 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;
 }
Ejemplo n.º 22
0
 public GenericMessage(MessageTypes type, string request)
 {
     Type = type;
     Request = request;
     Source = 0;
     Dest = 0;
     Response = string.Empty;
     ID = 0;
 }
Ejemplo n.º 23
0
 void TLClient_WM_gotFeatures(MessageTypes[] messages)
 {
     lock (RequestFeatureList)
     {
         RequestFeatureList.Clear();
         foreach (MessageTypes mt in messages)
             RequestFeatureList.Add(mt);
     }
 }
Ejemplo n.º 24
0
        public Overhead(AEntity parent, MessageTypes msgType, string text)
            : base(parent.Serial, parent.Map)
        {
            Parent = parent;
            MessageType = msgType;
            Text = text;

            m_TimePersist = 5000;
        }
Ejemplo n.º 25
0
 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 => {});
 }
Ejemplo n.º 27
0
        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;
        }
Ejemplo n.º 28
0
 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();
 }
Ejemplo n.º 29
0
 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();
 }
Ejemplo n.º 30
0
 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;
 }
Ejemplo n.º 31
0
 public Command(Guid messageId, MessageTypes messageType) : base(messageId, messageType)
 {
 }
Ejemplo n.º 32
0
 public MessageObject(MessageTypes messageTypes, string text)
 {
     Text        = text;
     MessageType = messageTypes;
 }
Ejemplo n.º 33
0
 long tl_newUnknownRequest(MessageTypes t, string msg)
 {
     return((long)MessageTypes.FEATURE_NOT_IMPLEMENTED);
 }
Ejemplo n.º 34
0
 /// <summary>
 /// Initialize <see cref="BaseChangeMessage{TMessage,TField}"/>.
 /// </summary>
 /// <param name="type">Message type.</param>
 protected BaseChangeMessage(MessageTypes type)
     : base(type)
 {
 }
Ejemplo n.º 35
0
 public Request(int target, int sender, HostLoadInfo hostLoad, MessageTypes requestType) :
     base(target, sender, requestType)
 {
     CurrentHostLoadInfo = hostLoad;
 }
Ejemplo n.º 36
0
 /// <summary>
 /// Initialize <see cref="CandleMessage"/>.
 /// </summary>
 /// <param name="type">Message type.</param>
 protected CandleMessage(MessageTypes type)
     : base(type)
 {
 }
Ejemplo n.º 37
0
 /// <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));
 }
Ejemplo n.º 38
0
 /// <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());
 }
Ejemplo n.º 39
0
 /// <summary>
 /// Initializes a new instance of the <see cref="SecurityMessage"/>.
 /// </summary>
 /// <param name="type">Message type.</param>
 protected SecurityMessage(MessageTypes type)
     : base(type)
 {
 }
Ejemplo n.º 40
0
 /// <summary>
 /// Инициализировать <see cref="BaseConnectionMessage"/>.
 /// </summary>
 /// <param name="type">Тип сообщения.</param>
 protected BaseConnectionMessage(MessageTypes type)
     : base(type)
 {
 }
Ejemplo n.º 41
0
 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);
 }
Ejemplo n.º 42
0
 public Event(Guid messageId, MessageTypes messageType) : base(messageId, messageType)
 {
 }
Ejemplo n.º 43
0
 /// <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);
 }
Ejemplo n.º 44
0
 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);
 }
Ejemplo n.º 45
0
 /// <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));
 }
Ejemplo n.º 46
0
 /// <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));
 }
Ejemplo n.º 47
0
 /// <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));
 }
Ejemplo n.º 48
0
 private void ShowMessage(string message, MessageTypes type)
 {
     ShowMessage(message, type, null);
 }
Ejemplo n.º 49
0
 public MessageEventArgs(string message, MessageTypes type)
 {
     Message = message;
     Type    = type;
 }