Example #1
0
        private void LogDataInSilently(DataSet data)
        {
            string time       = data.timestamp.ToString("[HH:mm:ss.fff] ");
            string dataString = "";

            for (int i = 0; i < data.data.Length; i++)
            {
                dataString += string.Format("{0:X2} ", data.data[i]);
            }
            TextViewDataIn.AppendTextWithHightlight(time, Color.Orange);
            TextViewDataIn.AppendTextWithHightlight($"[{data.portName}] ", Color.ForestGreen);
            TextViewDataIn.AppendTextWithHightlight($"{dataString}\n", Color.White);
        }
Example #2
0
        public void LogEvent(string tag, string text, EventType eventType)
        {
            int    maxLines = int.Parse(Resources.MainResources.MaxLogEventLines);
            string time     = DateTime.Now.ToString("[HH:mm:ss.fff] ");

            TextViewEvents.LimitLines(maxLines);

            Color textColor = Color.White;

            switch (eventType)
            {
            case EventType.Info:
                textColor = Color.White;
                break;

            case EventType.Warning:
                textColor = Color.Yellow;
                break;

            case EventType.Error:
                textColor = Color.OrangeRed;
                break;
            }
            //to make sure there is an one-line spacer

            /*if (text.EndsWith("\n"))
             *  text += "\n";
             * else
             *  text += "\n\n";*/

            text += "\n";

            TextViewEvents.AppendTextWithHightlight(time, Color.Orange);
            TextViewEvents.AppendTextWithHightlight("[" + tag + "] ", Color.ForestGreen);
            TextViewEvents.AppendTextWithHightlight(text, textColor);

            TextViewEvents.ScrollToEnd();
        }
Example #3
0
        public void LogDataOut(string portName, byte[] data)
        {
            int    maxLines = int.Parse(Resources.MainResources.MaxLogDataLines);
            string time     = DateTime.Now.ToString("[HH:mm:ss.fff] ");
            //TextViewDataOut.AppendTextWithHightlight(time, Color.Orange);
            //TextViewDataOut.AppendTextWithHightlight($"[{portName}] ", Color.ForestGreen);
            //TextViewDataOut.AppendTextWithHightlight($"{data}\n", Color.White);
            //TextViewDataOut.LimitLines(maxLines);
            //TextViewDataOut.ScrollToEnd();


            string dataString = "";

            for (int i = 0; i < data.Length; i++)
            {
                dataString += string.Format("{0:X2} ", data[i]);
            }
            TextViewDataOut.AppendTextWithHightlight(time, Color.Orange);
            TextViewDataOut.AppendTextWithHightlight($"[{portName}] ", Color.ForestGreen);
            TextViewDataOut.AppendTextWithHightlight($"{dataString}\n", Color.White);
            TextViewDataOut.LimitLines(maxLines);
            TextViewDataOut.ScrollToEnd();
        }