Esempio n. 1
0
        public void ActivateRun()
        {
            string hName   = "";
            string dirName = "c://data//";

            hName = run_name;
            RunName rn = new RunName();

            rn.ShowDialog();

            //hName += "_ch" + this.chan.ToString();
            //hName += "_" + DateTime.Now.Year.ToString("0000");
            //hName += DateTime.Now.Month.ToString("00");
            //hName += DateTime.Now.Day.ToString("00");
            //hName += "_" + DateTime.Now.Hour.ToString("00");
            //hName += DateTime.Now.Minute.ToString("00");
            //hName += DateTime.Now.Second.ToString("00");
            created     = DateTime.Now;
            hName       = run_name;//PP.myRun.run_name;
            hName       = dirName + hName + ".data";
            OutFileName = hName;
            try
            {
                using (sw = new StreamWriter(OutFileName, true))
                {
                    sw.WriteLine("-- START OF RUN -- " + DateTime.Now.ToString());

                    using (StreamWriter sw1 = File.AppendText("c:\\data\\run_list.txt"))
                    {
                        sw1.WriteLine(this.num.ToString() + " ACTIVE at: " + DateTime.Now);
                        sw1.WriteLine(this.num.ToString() + " Name: " + hName);
                    }

                    using (StreamWriter sw2 = File.AppendText("c:\\data\\run_param.txt"))
                    {
                        sw2.WriteLine(this.num.ToString() + " " + rn.textEbeam.Text + " " + rn.textIbeam.Text + " " + rn.BIASVtextBox.Text + " " + rn.GainTextBox.Text + " " + rn.comboPID.Text + " " + rn.textAngle.Text + " " + rn.textXpos.Text + " " + rn.textZpos.Text + " " + rn.textTemp.Text);
                    }

                    //If all goes well above, we are good to go for taking data.
                    UpdateStatus("RUN STARTED");
                    TCP_receiver.SaveEnabled = true;
                    ACTIVE = true;
                }
            }
            catch (Exception e)
            {
                System.Console.Write("Caught Exception {0} in Program.cs!", e);
            }
        }
Esempio n. 2
0
        public void ActivateRun()
        {
            string hName   = "";
            string dirName = "c://data//";

            hName = run_name;
            RunName rn = new RunName();

            rn.ShowDialog();

            //hName += "_ch" + this.chan.ToString();
            //hName += "_" + DateTime.Now.Year.ToString("0000");
            //hName += DateTime.Now.Month.ToString("00");
            //hName += DateTime.Now.Day.ToString("00");
            //hName += "_" + DateTime.Now.Hour.ToString("00");
            //hName += DateTime.Now.Minute.ToString("00");
            //hName += DateTime.Now.Second.ToString("00");
            created     = DateTime.Now;
            hName       = PP.myRun.run_name;
            hName       = dirName + hName + ".data";
            OutFileName = hName;
            if (sw == null)
            {
                try
                {
                    sw = new StreamWriter(OutFileName, true);
                    StreamWriter sw1 = File.AppendText("c:\\data\\run_list2.txt");
                    sw1.WriteLine(this.num.ToString() + " ACTIVE at: " + DateTime.Now);
                    sw1.WriteLine(this.num.ToString() + " Name: " + hName);
                    sw1.Close();
                    sw1 = null;
                }
                catch { }
            }

            if (!File.Exists("c:\\data\\run_param.txt"))
            {
                File.CreateText("c:\\data\\run_param.txt");
            }
            StreamWriter sw2 = File.AppendText("c:\\data\\run_param.txt");

            sw2.WriteLine(this.num.ToString() + " " + rn.textEbeam.Text + " " + rn.textIbeam.Text + " " + rn.BIASVtextBox.Text + " " + rn.GainTextBox.Text + " " + rn.comboPID.Text + " " + rn.textAngle.Text + " " + rn.textXpos.Text + " " + rn.textZpos.Text + " " + rn.textPressure.Text);
            sw2.Close();
            sw2 = null;

            TCP_reciever.SaveEnabled = true;
            ACTIVE = true;
        }