Beispiel #1
0
        public void OutputText(string tabName, string text)
        {
            int index      = TabPanel.TabPages.IndexOfKey(tabName);
            var page       = TabPanel.TabPages[index];
            var foundArray = page.Controls.Find("OutputBox", false);

            if (foundArray.Count() == 0)
            {
                return;
            }
            var outputBox = (TextBox)foundArray[0];

            if (outputBox.InvokeRequired)
            {
                var callback = new OutputTextCallback(OutputText);
                if (MainForm.Instance.IsDisposed)
                {
                    return;
                }
                Invoke(callback, new object[] { tabName, text });
                return;
            }

            text = text.Replace("\n", "\r\n");

            string currentTime = DateTime.Now.ToShortTimeString();

            outputBox.AppendText($"{currentTime} | {text}\r\n");
        }
Beispiel #2
0
        public void OutputText(string tabName, string text)
        {
            var page = Tools.FindTabPage(TabPanel, tabName);

            if (page == null)
            {
                return;
            }
            var foundArray = page.Controls.Find("OutputBox", false);

            if (foundArray.Count() == 0)
            {
                return;
            }

            var outputBox = foundArray[0] as TextBox;

            if (outputBox.InvokeRequired)
            {
                if (Instance.IsDisposed)
                {
                    return;
                }

                var callback = new OutputTextCallback(OutputText);
                this.Invoke(callback, tabName, text);
                return;
            }

            text = text.Replace("\n", "\r\n");

            var currentTime = DateTime.Now.ToShortTimeString();

            outputBox.AppendText($"{currentTime} | {text}\r\n");
        }
 private void OutputText(string text)
 {
     // InvokeRequired required compares the thread ID of the
     // calling thread to the thread ID of the creating thread.
     // If these threads are different, it returns true.
     if (appOutput.InvokeRequired)
     {
         OutputTextCallback d = new OutputTextCallback(OutputText);
         Invoke(d, new object[] { text });
     }
     else
     {
         appOutput.Text = text;
     }
 }
 // Log the stuff!
 public void OutputText(string text)
 {
     // InvokeRequired required compares the thread ID of the
     // calling thread to the thread ID of the creating thread.
     // If these threads are different, it returns true.
     if (OutputBox.InvokeRequired)
     {
         OutputTextCallback d = new OutputTextCallback(OutputText);
         Invoke(d, new object[] { text });
     }
     else
     {
         OutputBox.AppendText(text + "\r\n");
     }
 }