Esempio n. 1
0
        private void okButton_Click(object sender, EventArgs e)
        {
            string         path           = MS539_final_project_roderick_devalcourt.Properties.Settings.Default.DefaultPath;
            string         fileName       = MS539_final_project_roderick_devalcourt.Properties.Settings.Default.FileName;
            bool           result         = false;
            WriteFileLogic writeFileLogic = null;
            string         pathFileName   = "";

            ResetErrors();
            result = checkInputs();
            if (result == true)
            {
                //MessageBox.Show("Form would be saved at this point...");
                writeFileLogic = new WriteFileLogic();

                writeFileLogic.personallyIdentifiableInformation = new PersonallyIdentifiableInformation(personallyIdentifiableInformation);

                foreach (BloodGlucose bloodGlucose1 in readFileLogic.listBloodGlucose)
                {
                    writeFileLogic.listBloodGlucose.Add(new BloodGlucose(bloodGlucose1));
                }
                foreach (PulseAndOxygen pulseAndOxygen1 in readFileLogic.listPulseAndOxygen)
                {
                    writeFileLogic.listPulseAndOxygen.Add(new PulseAndOxygen(pulseAndOxygen1));
                }
                writeFileLogic.PathName = path;
                writeFileLogic.FileName = fileName;
                pathFileName            = writeFileLogic.GetFormattedFileName();
                writeFileLogic.WriteFile();

                this.Close();
            }
        }
        private void btnWrite_Click(object sender, EventArgs e)
        {
            StringBuilder  stringBuilder    = null;
            string         messageText      = "";
            Exception      exceptionDetails = null;
            string         path             = tbPath.Text;
            string         fileName         = tbFileName.Text;
            string         pathFileName     = "";
            WriteFileLogic writeFileLogic   = null;

            try
            {
                if (logicBase != null)
                {
                    if ((string.IsNullOrEmpty(path) == false) && (string.IsNullOrEmpty(fileName) == false))
                    {
                        writeFileLogic = new WriteFileLogic();
                        if (writeFileLogic != null)
                        {
                            ResetListBox();
                            writeFileLogic.PathName = path;
                            writeFileLogic.FileName = fileName;
                            pathFileName            = writeFileLogic.GetFormattedFileName();

                            writeFileLogic.personallyIdentifiableInformation = logicBase.personallyIdentifiableInformation;
                            writeFileLogic.listBloodGlucose   = logicBase.listBloodGlucose;
                            writeFileLogic.listPulseAndOxygen = logicBase.listPulseAndOxygen;

                            this.Cursor = Cursors.WaitCursor;

                            writeFileLogic.WriteFile();
                        }
                    }
                }
            }
            catch (Exception exception)
            {
                stringBuilder    = new StringBuilder();
                exceptionDetails = exception;

                while (exceptionDetails != null)
                {
                    messageText = "\r\nMessage: " + exceptionDetails.Message + "\r\nSource: " + exceptionDetails.Source + "\r\nStack Trace: " + exceptionDetails.StackTrace + "\r\n----------\r\n";

                    stringBuilder.Append(messageText);

                    exceptionDetails = exceptionDetails.InnerException;
                }

                messageText = stringBuilder.ToString();

                listBox1.Items.Add(messageText);
            }
            finally
            {
                this.Cursor = Cursors.Default;
            }
        }
        private void addButton_Click(object sender, EventArgs e)
        {
            string             path           = MS539_final_project_roderick_devalcourt.Properties.Settings.Default.DefaultPath;
            string             fileName       = MS539_final_project_roderick_devalcourt.Properties.Settings.Default.FileName;
            pulseAndOxygenForm dlg            = null;
            PulseAndOxygen     pulseAndOxygen = null;
            WriteFileLogic     writeFileLogic = null;
            string             pathFileName   = "";

            dlg = new pulseAndOxygenForm();
            dlg.ShowDialog(this);
            if (dlg.DialogResult == DialogResult.OK)
            {
                this.Cursor = Cursors.WaitCursor;
                //save here
                pulseAndOxygen        = new PulseAndOxygen(dlg.pulseAndOxygen);
                pulseAndOxygen.PII_ID = readFileLogic.personallyIdentifiableInformation.Id;

                writeFileLogic = new WriteFileLogic();

                writeFileLogic.listPulseAndOxygen.Add(pulseAndOxygen);

                writeFileLogic.personallyIdentifiableInformation = new PersonallyIdentifiableInformation(readFileLogic.personallyIdentifiableInformation);

                foreach (BloodGlucose bloodGlucose1 in readFileLogic.listBloodGlucose)
                {
                    writeFileLogic.listBloodGlucose.Add(new BloodGlucose(bloodGlucose1));
                }
                foreach (PulseAndOxygen pulseAndOxygen1 in readFileLogic.listPulseAndOxygen)
                {
                    writeFileLogic.listPulseAndOxygen.Add(new PulseAndOxygen(pulseAndOxygen1));
                }
                writeFileLogic.PathName = path;
                writeFileLogic.FileName = fileName;
                pathFileName            = writeFileLogic.GetFormattedFileName();
                writeFileLogic.WriteFile();
                LoadChart();
                this.Cursor = Cursors.Default;
            }
        }