public void ResponseEntry(TraceLine info)
        {
            if (InvokeRequired)
            {
                Invoke(new TraceMedia.ReceiveRespone(ResponseEntry), new object[] { info });
            }
            else if (info.Command == 0)
            {
                m_Updating = true;

                if (onModule.Checked)
                {
                    TreeNode attach = traceTreeView.Nodes[info.Module];

                    if (attach == null)
                    {
                        attach = traceTreeView.Nodes.Add(info.Module);
                        attach.Name = info.Module;
                    }

                    TreeNode item = attach.Nodes[info.Category];

                    if (item == null)
                    {
                        // Add this category to this node
                        item = attach.Nodes.Add(info.Category);
                        item.Name = info.Category;
                    }

                    item.Checked = info.Active;
                }
                else
                {
                    TreeNode attach = traceTreeView.Nodes[info.Category];

                    if (attach == null)
                    {
                        attach = traceTreeView.Nodes.Add(info.Category);
                        attach.Name = info.Category;
                    }

                    TreeNode item = attach.Nodes[info.Module];

                    if (item == null)
                    {
                        // Add this category to this node
                        item = attach.Nodes.Add(info.Module);
                        item.Name = info.Module;
                    }

                    item.Checked = info.Active;
                }

                m_Updating = false;
            }
            else if (info.Command == 1)
            {
                TraceMedia.Instance.RequestOverview(new TraceMedia.ReceiveRespone(ResponseEntry));
            }
        }
        public void SetText(TraceLine info)
        {
            if (InvokeRequired)
            {
                Invoke(new TraceMedia.ReceiveTraceLine(SetText), new object[] { info });
            }
            else
            {
                DataGridViewRow addedRow = logWindow.Rows[logWindow.Rows.Add()];

                addedRow.Cells[0].Value = info.Time.ToString("HH:mm.ss.fff");
                addedRow.Cells[1].Value = info.ClassName;
                addedRow.Cells[2].Value = info.LineNumber.ToString();
                addedRow.Cells[3].Value = System.IO.Path.GetFileName(info.FileName);
                addedRow.Cells[4].Value = info.Message;
            }
        }
Beispiel #3
0
        private void worker()
        {
            System.Net.IPEndPoint remoteNode = new System.Net.IPEndPoint (m_RemoteNode.Address, m_RemoteNode.Port);

            while (m_Running == true)
            {
                try
                {
                    byte[] stream = m_Reader.Receive(ref remoteNode);

                    TraceLine newInfo = new TraceLine(stream);

                    if ((newInfo.IsTraceLine)  && (m_TraceLineCallback != null))
                    {
                        // It's on a different thread, so use Invoke.
                        m_TraceLineCallback (newInfo);
                    }
                    else if ((newInfo.IsResponseLine) && (m_ResponseCallback != null) && (newInfo.SequenceNumber == m_Sequence))
                    {
                        // It's on a different thread, so use Invoke.
                        m_ResponseCallback ( newInfo );
                    }
                }
                catch(Exception)
                {
                }
            }
        }