Exemplo n.º 1
0
        /// <summary>
        /// Called when the whole program first loads
        /// </summary>
        private void VirtualLabToplevel_Load(object	sender,	System.EventArgs e)
        {
            // Display a "WELCOME SCREEN" allowing the user to chose the program type
            WelcomeScreen ws = new WelcomeScreen();
            DialogResult dResult = ws.ShowDialog();
            switch (dResult)
            {

                case DialogResult.Yes:  // practice mode
                    programMode = ProgramMode.Practice;
                    this.Text += " Practice Mode";
                    break;
                case DialogResult.No:	// evaluation mode
                    programMode = ProgramMode.Eval;
                    resultsShow.Visible = false;
                    pplotShowHide.Enabled = false;
                    this.Text += " Evaluation Mode";
                    pplotShowHide.Enabled = false;
                    break;
            }

            if (dResult != DialogResult.Cancel)
            {

                // get student parameters
                si.stName = ws.stName;
                si.stID = ws.stID;
                si.stCourse = ws.stCourse;
                si.stEmail = ws.stEmail;
                si.stProf = ws.stProf;

                // show the students name in title (if available
                if (si.stName != string.Empty)
                    Text += "                                             Clinician: " + si.stName;

                // construct and show children
                admtr = new Audiometer(
                    new Audiometer.presentationDelegate(presFunc),
                    new Audiometer.stateChangedDelegate(stChang));
                admtr.MdiParent = this;
                admtr.Show();
                admtr.Location = new Point(0, 0);
                admtr.Size = new Size(661, 460);

                // Patient Window
                //ptwind = new PatientWindow(pt); //Changes made 04/12/2011
                ptwind = new PatientWindow();
                ptwind.MdiParent = this;
                ptwind.Show();
                ptwind.Location = new Point(0, admtr.Height);
                ptwind.Size = new Size(400, 450);

                adgrm = new Audiogram();
                adgrm.vltl = this;
                adgrm.patient = pt; // delete me
                adgrm.MdiParent = this;
                adgrm.Show();
                adgrm.Location = new Point(admtr.Width,0);
                adgrm.SpAudInput.MdiParent = this;
                adgrm.SpAudInput.Location = new Point(750, 496);

                pplot = new Plateau_Plot.Plateau_Plot();
                pplot.MdiParent = this;
                pplot.Show();
                pplot.Location = new Point(adgrm.Width, adgrm.Height);
                pplot.Visible = false;

                // SRT
                srtWind = new SRT.SRT(
                    new SRT.SRT.ResponseDelegate(DoResponse),
                    new SRT.SRT.DoneDelegate(EnableSpeechMenu));
                srtWind.MdiParent = this;
                srtWind.Location = new Point(750, 496);
                srtWind.Hide();

                // WI
                wiWind = new WI.WI(
                    new WI.WI.DoneDelegate(EnableSpeechMenu),
                    new WI.WI.ResponseDelegate(DoResponse));
                wiWind.MdiParent = this;
                wiWind.Location = new Point(750, 496);
                wiWind.Hide();

                // show form
                this.Visible = true;
                WindowState = System.Windows.Forms.FormWindowState.Maximized;
                prevState = admtr.ameterSettings;
            } // end if ( dResult != Cancel )
        }
Exemplo n.º 2
0
        private void presFunc(int testCh)
        {
            // defaults
            //testEar_IA = 0;
            /* assign previous state */
            prevState = admtr.ameterSettings;
            /* handle presentation button */
            if (pt.validPatient)
            {
                int	patResp	= -1;
                Audiometer.channelSettings TestChannel;
                Audiometer.channelSettings MaskedChannel;

                switch (testCh)
                {
                    case 1:
                        TestChannel = admtr.Channel1;
                        MaskedChannel = admtr.Channel2;
                        break;
                    case 2:
                        TestChannel = admtr.Channel2;
                        MaskedChannel = admtr.Channel1;
                        break;
                    default:
                        // just to have a default, should never execute
                        TestChannel = admtr.Channel1;
                        MaskedChannel = admtr.Channel2;
                        break;
                }
                if ( (testCh == 1 && admtr.Channel1.stim == Audiometer.StimulusType.Tone) ||
                    (testCh == 2 &&	admtr.Channel2.stim == Audiometer.StimulusType.Tone))
                {
                    // test is a pure tone test
                    // wait for the tone to finish playing
                    Thread.Sleep(500);
                    patResp = pureToneTest(TestChannel, MaskedChannel);
                }

                if (programMode == ProgramMode.Eval)
                    evalOutput.CheckMinimum(FrequencyToIndex(admtr.ameterSettings.frequency), TestChannel, MaskedChannel);

                // play	patient	response
                ptwind.ShowAnimation(patResp, pt.returnPatientType());

                // plateau plot
                if (pplot.Visible &&
                    (patResp == (int)ResponseType.LeftUnsure || patResp == (int)ResponseType.RightUnsure))
                {
                    int minY;
                    // if testing using an air conduction method
                    if (TestChannel.stim == Audiometer.StimulusType.Tone &&
                        (TestChannel.trans == Audiometer.TransducerType.Insert ||
                        TestChannel.trans == Audiometer.TransducerType.Phone))
                    {
                        // set the minimum Y axis value to the air conduction threshold -5
                        minY = pt.GetPath().AC_Thresh_Val(admtr.ameterSettings.frequency, TestChannel.route) - 5;
                    }
                    // if testing using a bone conduction method
                    else if (TestChannel.stim == Audiometer.StimulusType.Tone &&
                        TestChannel.trans == Audiometer.TransducerType.Bone)
                    {
                        // set the minimum Y axis value to the bone conduction threshold -5
                        minY = pt.GetPath().BC_Thresh_Val(admtr.ameterSettings.frequency, TestChannel.route) - 5;
                    }
                    else // Future developers may need to include more coding for other types of tests.
                        minY = 0;

                    pplot.Set_Min_Threshold(minY);
                    pplot.SetYAxisLabels();

                    // plot the point
                    pplot.PlotDataPt(MaskedChannel.volume, TestChannel.volume);
                }
            }
        }
Exemplo n.º 3
0
        private void stChang(bool newTest)
        {
            // handle settings changed
            // regardless, the plateau plot should be cleared
            pplot.ClearAll();

            if (newTest && pt.validPatient)
            {
                // this should trigger test complete logic when the time comes
                if (programMode == (int)ProgramMode.Practice)
                {
                    string tType = string.Empty;
                    // check which channel is presentation channel
                    if ((admtr.Channel1.stim == Audiometer.StimulusType.Tone) ||
                        (admtr.Channel2.stim == Audiometer.StimulusType.Tone))
                    {
                        tType = "Pure Tone Test";
                    }
                    if ((admtr.Channel1.stim == Audiometer.StimulusType.Speech) ||
                        (admtr.Channel2.stim == Audiometer.StimulusType.Speech))
                    {
                        if (tType.Equals(string.Empty))
                        {
                            tType = "Speech Test";
                        }
                        else
                        {
                            tType = "Error";
                        }
                    }

                    if (tType != string.Empty)
                    {
                        ri.storePureToneResults(adgrm, pt);
                        saveTestResults();
                    }
                    else
                    {
                        MessageBox.Show("It doesn't appear that you've performed a pure tone test");
                        return;
                    }

                    if (programMode == (int)ProgramMode.Practice)
                    {
                        // instant gratification
                        MessageBox.Show(ri.pureToneResults, "Feedback");
                    }
                }
            }

            /* assign previous state */
            prevState = admtr.ameterSettings;
        }