Exemplo n.º 1
0
        //private void Start_RXthread()
        //{
        //    if (RX_backgroundWorker.IsBusy != true) {  }
        //}
        private void save_Record()
        {
            if (RXbox.Lines.Length > 2096)
            {
                if (this.RXbox.Text == "")
                {
                    return;
                }

                {
                    // Save the contents of the RichTextBox into the file.

                    DateTime ct       = DateTime.Now;
                    string   timeinfo = ct.Month.ToString() + ct.Day.ToString() + "_" + ct.Hour.ToString() + ct.Minute.ToString() + ct.Second.ToString();
                    timeinfo = Directory.GetCurrentDirectory() + "\\" + timeinfo + ".txt";
                    StreamWriter sw = new StreamWriter(timeinfo, true);
                    //向创建的文件中写入内容
                    sw.Write(RXbox.Text);
                    //关闭当前文件写入流
                    sw.Close();
                    RXbox.Clear();
                    //MessageBox.Show("文件已成功保存");
                }
            }
        }
Exemplo n.º 2
0
        private void button5_Click(object sender, EventArgs e)
        {
            {
                // Save the contents of the RichTextBox into the file.

                DateTime ct       = DateTime.Now;
                string   timeinfo = ct.Month.ToString() + ct.Day.ToString() + "_" + ct.Hour.ToString() + ct.Minute.ToString() + ct.Second.ToString();
                timeinfo = Directory.GetCurrentDirectory() + "\\" + "Log" + timeinfo + ".txt";
                StreamWriter sw = new StreamWriter(timeinfo, false);
                //向创建的文件中写入内容
                sw.WriteLine("test");
                //关闭当前文件写入流
                sw.Close();
                RXbox.Clear();
                //MessageBox.Show("文件已成功保存");
            }
        }
Exemplo n.º 3
0
 //清空接收区
 private void clear_button_Click(object sender, EventArgs e)
 {
     RXbox.Clear();
 }