Exemplo n.º 1
0
        private void save_button_click(object sender, EventArgs e)
        {
            recording_time.Enabled = false;
            saveButton.Hide();
            notesReformatted        = notesBox.Text.Replace(",", ".");
            experimenterReformatted = expBox.Text.Replace(",", ".");

            CsvFiles.openTrainingReview($"{chosenRat}");
            CsvFiles.trainingCsv.Write(
                $"{name_to_session[chosenRat]},{DateTime.Now},{run_time},{this.lapNum.Text},{expBox.Text},{notesBox.Text}\n");
            CsvFiles.openLTwriter();
            foreach (var ratname in name_to_age.Keys)
            {
                if (ratname == chosenRat)
                {
                    name_to_session[ratname]++;
                }
                CsvFiles.LTwriter.Write($"{ratname},{name_to_age[ratname]},{name_to_session[ratname]}\n");
            }
            CsvFiles.closeWriter();
            CsvFiles.closeTraining();
            if (!Directory.Exists(
                    $@"C:\Users\sahanasrivathsa\Documents\Barnes Lab\LTtraining\ScreenShots\{chosenRat}"))
            {
                Directory.CreateDirectory(
                    $@"C:\Users\sahanasrivathsa\Documents\Barnes Lab\LTtraining\ScreenShots\{chosenRat}");
            }
            var bmpScreenCapture = new Bitmap(Width, Height);

            DrawToBitmap(bmpScreenCapture, new Rectangle(0, 0, bmpScreenCapture.Width, bmpScreenCapture.Height));
            bmpScreenCapture.Save(
                $@"C:\Users\sahanasrivathsa\Documents\Barnes Lab\LTtraining\ScreenShots\{chosenRat}\LTscreenshot_{chosenRat}_Session{name_to_session[chosenRat]}.gif",
                ImageFormat.Gif);
            saved = true;
        }
Exemplo n.º 2
0
        public LinearTrackGui()
        {
            CsvFiles.openLTreader();
            serialPort.BaudRate        = 9600;
            serialPort.PortName        = "COM5";
            serialPort.ReadTimeout     = 10000;
            serialPort.Encoding        = Encoding.UTF8;
            serialPort.DiscardNull     = true;
            serialPort.WriteBufferSize = 10000;
            serialPort.Open();

            serialPort.DiscardInBuffer();
            serialPort.DiscardOutBuffer();
            while (!CsvFiles.LTreader.EndOfStream)
            //this reads the LTtraining.csv file and makes a dictionary for the ages and for the session number
            {
                var line = CsvFiles.LTreader.ReadLine();
                var vals = line.Split(',');
                name_to_age.Add(vals[0], vals[1]);
                name_to_session.Add(vals[0], int.Parse(vals[2]));
                ratName.Add(vals[0]);
            }
            CsvFiles.closeLTreader();
            mNetComClient = new MNetCom.MNetComClient();

            InitializeComponent();
            reminderWindow = new NLXReminder(this);
            confirm();
            //reminderWindow.Show();
            //this.Focus();

            //if (recordingStatus == false) { ephys.Hide(); }

            foreach (var rat in ratName)
            {
                this.ratSelection.Items.Add(rat);
            }
            this.ratSelection.Items.Add("New Rat");

            rat_datelabel.Text = DateTime.Now.ToShortDateString();
            rat_timelabel.Text = DateTime.Now.ToShortTimeString();
        }