Exemplo n.º 1
0
        private void AddPluginMessageFromThread(string message, string plugin, bool error = false, Exception ex = null)
        {
            PluginMessage pm = new PluginMessage();

            pm.Message = message;
            if (ex != null)
            {
                pm.Message += " Exception Detail: " + ex.Format();
            }
            pm.PluginName = plugin;
            pm.Received   = DateTime.Now;
            pm.Error      = error;
            AddPluginMessageFromThread(pm);
        }
Exemplo n.º 2
0
        private void AddPluginMessageFromThread(PluginMessage message)
        {
            Action <PluginMessage> method = pm =>
            {
                //to help keep memory down, lets not let more than 500 items go into the list.
                if (lvMessages.Items.Count >= 500)
                {
                    lvMessages.Items.Clear();
                }

                lvMessages.Items.Add(pm);
                lvMessages.Tag = pm;
                SetSelectedItem(lvMessages);
                lblPluginMessage.Content = pm.PluginName + " (" + pm.ReceivedDisplay + "): " + ((pm.Error) ? "ERROR! " : "") + pm.Message;
            };

            Dispatcher.Invoke(method, message);
        }