コード例 #1
0
 /// <summary>
 /// Appends text to the log and autoscrolls if needed
 /// </summary>
 /// <param name="message"></param>
 private void ServerLog(string message)
 {
     ConsoleTB.Dispatcher.Invoke(new Action(() =>
     {
         ConsoleTB.AppendText(message + Environment.NewLine);
         ConsoleTB.Focus();
         ConsoleTB.CaretIndex = ConsoleTB.Text.Length;
         ConsoleTB.ScrollToEnd();
     }));
 }
コード例 #2
0
        private void button1_Click(object sender, EventArgs e)
        {
            int numt = int.Parse(NumberofT.Text);

            if (numt <= 0)                                  //error checking
            {
                ConsoleTB.Text += "Error: " + numt + " templates can not be added!\n";
                ConsoleTB.Update();
                Thread.Sleep(2000);
                Environment.Exit(0);
            }
            else
            {
                Templates = numt;
                this.Hide();
                Form1 t = new Form1(Templates);
                t.Show();
            }
        }