Beispiel #1
0
        public static bool VerifyConfig(ExperimentConfiguration config)
        {
            bool success = true;

            if (Verify_Project(config.project.ProjectID))
            {
                if (Verify_Method(config.method.MethodID))
                {
                    if (Verify_PlateType(config.plateType.PlateTypeID))
                    {
                        if (Verify_Mask(config.mask.MaskID))
                        {
                            if (Verify_RuntimeAnalysis(config.numFoFrames, config.controlSubtWells,
                                                       config.dynamicRatioNum.ExperimentIndicatorID, config.dynamicRatioDen.ExperimentIndicatorID))
                            {
                                if (Verify_ReportSetup(config.writeWaveguideReport, config.waveguideReportLocation,
                                                       config.writeExcelReport, config.excelReportLocation))
                                {
                                }
                                else
                                {
                                    success = false;
                                }
                            }
                            else
                            {
                                success = false;
                            }
                        }
                        else
                        {
                            success = false;
                        }
                    }
                    else
                    {
                        success = false;
                    }
                }
                else
                {
                    success = false;
                }
            }
            else
            {
                success = false;
            }

            return(success);
        }
Beispiel #2
0
        private void SaveExperimentConfigurationPB_Click(object sender, RoutedEventArgs e)
        {
            Microsoft.Win32.SaveFileDialog saveFileDialog = new Microsoft.Win32.SaveFileDialog();
            saveFileDialog.Filter           = "XML Settings file (*.xml)|*.xml";
            saveFileDialog.InitialDirectory = Directory.GetCurrentDirectory();
            if (saveFileDialog.ShowDialog() == true)
            {
                // get configuration
                ExperimentConfiguration config = new ExperimentConfiguration();

                config.controlSubtWells = VM.ExpParams.controlSubtractionWellList; // ObservableCollection<Tuple<int, int>>

                if (DynamicRatioNumeratorComboBox.SelectedIndex == -1)
                {
                    config.dynamicRatioNum = null;
                }
                else
                {
                    config.dynamicRatioNum = VM.ExpParams.dynamicRatioNumerator; // ExperimentIndicatorContainer
                }
                if (DynamicRatioDenominatorComboBox.SelectedIndex == -1)
                {
                    config.dynamicRatioDen = null;
                }
                else
                {
                    config.dynamicRatioDen = VM.ExpParams.dynamicRatioDenominator; // ExperimentIndicatorContainer
                }
                config.excelReportFilename = "<Determined at Runtime>";
                config.excelReportLocation = GlobalVars.Instance.DefaultExcelReportFileDirectory;
                config.mask                    = VM.ExpParams.mask;      // MaskContainer
                config.method                  = VM.ExpParams.method;    // MethodContainer
                config.numFoFrames             = VM.ExpParams.numFoFrames;
                config.plateType               = VM.ExpParams.plateType; // PlateTypeContainer
                config.project                 = VM.ExpParams.project;   // ProjectContainer
                config.waveguideReportFilename = "<Determined at Runtime>";
                config.waveguideReportLocation = GlobalVars.Instance.DefaultWaveGuideReportFileDirectory;
                config.writeExcelReport        = VM.ExpParams.writeExcelReport;
                config.writeWaveguideReport    = VM.ExpParams.writeWaveguideReport;

                ExperimentConfiguration.WriteSettingsFile(saveFileDialog.FileName, config);
            }
        }
Beispiel #3
0
        public static bool Build_ConfigureExperiment_Message(ExperimentConfiguration config, out byte[] message)
        {
            bool success = true;

            message = null;

            string configStr;

            success = ExperimentConfiguration.ConvertToXmlString(config, out configStr);

            if (success)
            {
                try
                {
                    byte[] payloadBytes = Encoding.ASCII.GetBytes(configStr);

                    short  messageType      = (short)WGMessageType.CONFIG_EXPERIMENT;
                    byte[] messageTypeBytes = BitConverter.GetBytes(messageType);

                    short  payloadSize      = (short)payloadBytes.Length;
                    byte[] payloadSizeBytes = BitConverter.GetBytes(payloadSize);

                    message = new byte[4 + payloadSize];

                    Buffer.BlockCopy(messageTypeBytes, 0, message, 0, messageTypeBytes.Length);
                    Buffer.BlockCopy(payloadSizeBytes, 0, message, messageTypeBytes.Length, payloadSizeBytes.Length);
                    Buffer.BlockCopy(payloadBytes, 0, message, messageTypeBytes.Length + payloadSizeBytes.Length, payloadBytes.Length);
                }
                catch (Exception)
                {
                    success = false;
                    message = null;
                }
            }

            return(success);
        }
Beispiel #4
0
        public bool SetConfiguration(ExperimentConfiguration config)
        {
            bool success = true;

            // run on UI thread
            Application.Current.Dispatcher.Invoke(new Action(() => {
                RefreshProjectList();

                bool projectOK   = false;
                bool methodOK    = false;
                bool plateTypeOK = false;
                bool maskOK      = false;

                // load project
                foreach (ProjectContainer pc in VM.ProjectList)
                {
                    if (pc.ProjectID == config.project.ProjectID)
                    {
                        ProjectComboBox.SelectedItem = pc;
                        projectOK = true;

                        // load method
                        foreach (MethodContainer m in VM.MethodList)
                        {
                            if (m.MethodID == config.method.MethodID)
                            {
                                MethodComboBox.SelectedItem = m;
                                methodOK = true;

                                // load plate type
                                foreach (PlateTypeContainer ptc in VM.PlateTypeList)
                                {
                                    if (ptc.PlateTypeID == config.plateType.PlateTypeID)
                                    {
                                        PlateTypeComboBox.SelectedItem = ptc;
                                        plateTypeOK = true;

                                        // load mask
                                        foreach (MaskContainer mask in VM.MaskList)
                                        {
                                            if (mask.MaskID == config.mask.MaskID)
                                            {
                                                MaskComboBox.SelectedItem = mask;
                                                maskOK = true;

                                                // set Fo Frames
                                                VM.ExpParams.numFoFrames = config.numFoFrames;

                                                // set control subtraction wells
                                                VM.ExpParams.controlSubtractionWellList = config.controlSubtWells;
                                                WellSelection.Init(mask.Rows, mask.Cols, config.controlSubtWells);

                                                // set dynamic ratio
                                                foreach (ExperimentIndicatorContainer eic in VM.ExpParams.indicatorList)
                                                {
                                                    if (eic.Description == config.dynamicRatioNum.Description)
                                                    {
                                                        DynamicRatioNumeratorComboBox.SelectedItem = eic;
                                                    }
                                                    if (eic.Description == config.dynamicRatioDen.Description)
                                                    {
                                                        DynamicRatioDenominatorComboBox.SelectedItem = eic;
                                                    }
                                                }


                                                break;
                                            }
                                        }

                                        break;
                                    }
                                }

                                break;
                            }
                        }

                        break;
                    }
                }

                success = (projectOK && methodOK && plateTypeOK && maskOK);
            }));



            return(success);
        }
Beispiel #5
0
        async private void M_tcpServer_DataReceived(object sender, Message e)
        {
            WaveguideMessage message;

            byte[] packet;
            if (WaveguideMessageUtil.ParseMessage(e.Data, out message))
            {
                m_commandMessageCount++;
                m_timestamp = DateTime.Now.ToString();

                switch (message.messageType)
                {
                case Waveguide.WGMessageType.GET_STATUS:
                    if (WaveguideMessageUtil.Build_Status_Message(GlobalVars.Instance.Status, GlobalVars.Instance.Status.ToString(), out packet))
                    {
                        e.Reply(packet);
                    }
                    break;

                case Waveguide.WGMessageType.CONFIG_EXPERIMENT:
                    ExperimentConfiguration config;
                    PostMessage("Configuration Message Received");
                    // Waveguide must be in ONLINE or READY state to accept a config command
                    if (GlobalVars.Instance.Status == WGStatus.ONLINE || GlobalVars.Instance.Status == WGStatus.READY)
                    {
                        if (ExperimentConfiguration.ParseConfigurationPayload(message.payloadBytes, out config))
                        {
                            if (MyExperimentConfigurator.SetConfiguration(config))
                            {
                                // Set Status to Ready
                                GlobalVars.Instance.Status = WGStatus.READY;

                                // send response
                                if (WaveguideMessageUtil.Build_Status_Message(GlobalVars.Instance.Status, GlobalVars.Instance.Status.ToString(), out packet))
                                {
                                    e.Reply(packet);
                                }
                            }
                            else
                            {
                                GlobalVars.Instance.Status = WGStatus.ONLINE;

                                PostMessage("Configuration Message Format Error");
                                if (WaveguideMessageUtil.Build_Status_Message(WGStatus.MESSAGE_FAILED__MESSAGE_FORMAT_ERROR,
                                                                              "Failed to parse message", out packet))
                                {
                                    e.Reply(packet);
                                }
                            }
                        }
                        else
                        {
                            // received bad configuration data

                            GlobalVars.Instance.Status = WGStatus.ONLINE;

                            if (WaveguideMessageUtil.Build_Status_Message(WGStatus.MESSAGE_FAILED__MESSAGE_FORMAT_ERROR,
                                                                          "Failed to parse message", out packet))
                            {
                                e.Reply(packet);
                                PostMessage("Configuration Message Parse Error");
                            }
                        }
                    }
                    else
                    {
                        if (WaveguideMessageUtil.Build_Status_Message(WGStatus.MESSAGE_FAILED__INCORRECT_MODE,
                                                                      "Current Waveguide mode = " + GlobalVars.Instance.Status.ToString() +
                                                                      "\nIt must be in ONLINE or READY mode in order to accept a configuration command",
                                                                      out packet))
                        {
                            e.Reply(packet);
                            PostMessage("Configuration Message No Accepted.  Waveguide not in correct mode.");
                        }
                    }
                    break;

                case Waveguide.WGMessageType.START_EXPERIMENT:
                    // Waveguide must be in "Ready" state in order to Start an experiment
                    PostMessage("Start Message Received");
                    if (GlobalVars.Instance.Status == WGStatus.READY)
                    {
                        GlobalVars.Instance.Status = WGStatus.RUNNING;
                        if (WaveguideMessageUtil.Build_Status_Message(GlobalVars.Instance.Status, GlobalVars.Instance.Status.ToString(), out packet))
                        {
                            e.Reply(packet);
                        }


                        // Start Experiment!
                        MyExperimentConfigurator.StartExperiment();

                        // wait for camera temperature
                        bool overridden = false;
                        Application.Current.Dispatcher.Invoke(
                            () =>
                        {
                            // Code to run on the GUI thread.
                            TemperatureMonitorDialog tdlg = new TemperatureMonitorDialog(m_imager.m_camera);

                            tdlg.ShowDialog();

                            overridden = tdlg.WasOverridden();

                            if (overridden)
                            {
                                MyRunExperimentControl.VM.CameraTemperatureTarget = MyRunExperimentControl.VM.CameraTemperatureActual;
                            }
                        });


                        await Task.Delay(2000);      // give time for RunExperimentControl to enable run


                        // run vworks protocol
                        MyRunExperimentControl.Run();
                    }
                    else
                    {
                        if (WaveguideMessageUtil.Build_Status_Message(WGStatus.MESSAGE_FAILED__INCORRECT_MODE,
                                                                      "Current Waveguide mode = " + GlobalVars.Instance.Status.ToString() +
                                                                      "\nIt must be in READY mode in order to accept a Start command",
                                                                      out packet))
                        {
                            e.Reply(packet);
                        }
                    }
                    break;

                case Waveguide.WGMessageType.STOP_EXPERIMENT:
                    PostMessage("Stop Message Received");
                    if (GlobalVars.Instance.Status == WGStatus.RUNNING)
                    {
                        GlobalVars.Instance.Status = WGStatus.READY;
                        if (WaveguideMessageUtil.Build_Status_Message(GlobalVars.Instance.Status, GlobalVars.Instance.Status.ToString(), out packet))
                        {
                            e.Reply(packet);
                        }
                    }
                    else
                    {
                        if (WaveguideMessageUtil.Build_Status_Message(WGStatus.MESSAGE_FAILED__INCORRECT_MODE,
                                                                      "Current Waveguide mode = " + GlobalVars.Instance.Status.ToString() +
                                                                      "\nIt must be in RUNNING mode in order to accept a Stop command",
                                                                      out packet))
                        {
                            e.Reply(packet);
                        }
                    }
                    break;

                case Waveguide.WGMessageType.STATUS:
                    break;
                }
            }
            else
            {
                //m_vm.status = WGStatus.ERROR;
                if (WaveguideMessageUtil.Build_Status_Message(WGStatus.MESSAGE_FAILED__MESSAGE_FORMAT_ERROR,
                                                              "Error Parsing Message", out packet))
                {
                    e.Reply(packet);
                }
            }
        }
Beispiel #6
0
        public static bool ConvertToXmlString(ExperimentConfiguration config, out string xmlString)
        {
            bool success = true;

            xmlString = "";

            try
            {
                XmlDocument xmlDoc = new XmlDocument();

                XmlDeclaration xmlDec = xmlDoc.CreateXmlDeclaration("1.0", null, null);
                xmlDec.Encoding = "utf-8";

                XmlNode rootNode = xmlDoc.CreateElement("settings");
                xmlDoc.AppendChild(rootNode);

                xmlDoc.InsertBefore(xmlDec, rootNode);

                XmlNode mainNode = xmlDoc.CreateElement("main");
                rootNode.AppendChild(mainNode);

                XmlNode      settingNode;
                XmlAttribute keyAttribute;
                XmlAttribute valAttribute;

                // ProjectID
                settingNode        = xmlDoc.CreateElement("add");
                keyAttribute       = xmlDoc.CreateAttribute("key");
                keyAttribute.Value = "ProjectID";
                valAttribute       = xmlDoc.CreateAttribute("value");
                valAttribute.Value = config.project.ProjectID.ToString();
                settingNode.Attributes.Append(keyAttribute);
                settingNode.Attributes.Append(valAttribute);
                mainNode.AppendChild(settingNode);

                // MethodID
                settingNode        = xmlDoc.CreateElement("add");
                keyAttribute       = xmlDoc.CreateAttribute("key");
                keyAttribute.Value = "MethodID";
                valAttribute       = xmlDoc.CreateAttribute("value");
                valAttribute.Value = config.method.MethodID.ToString();
                settingNode.Attributes.Append(keyAttribute);
                settingNode.Attributes.Append(valAttribute);
                mainNode.AppendChild(settingNode);

                // PlateTypeID
                settingNode        = xmlDoc.CreateElement("add");
                keyAttribute       = xmlDoc.CreateAttribute("key");
                keyAttribute.Value = "PlateTypeID";
                valAttribute       = xmlDoc.CreateAttribute("value");
                valAttribute.Value = config.plateType.PlateTypeID.ToString();
                settingNode.Attributes.Append(keyAttribute);
                settingNode.Attributes.Append(valAttribute);
                mainNode.AppendChild(settingNode);

                // MaskID
                settingNode        = xmlDoc.CreateElement("add");
                keyAttribute       = xmlDoc.CreateAttribute("key");
                keyAttribute.Value = "MaskID";
                valAttribute       = xmlDoc.CreateAttribute("value");
                valAttribute.Value = config.mask.MaskID.ToString();
                settingNode.Attributes.Append(keyAttribute);
                settingNode.Attributes.Append(valAttribute);
                mainNode.AppendChild(settingNode);

                // NumFoFrames
                settingNode        = xmlDoc.CreateElement("add");
                keyAttribute       = xmlDoc.CreateAttribute("key");
                keyAttribute.Value = "NumFoFrames";
                valAttribute       = xmlDoc.CreateAttribute("value");
                valAttribute.Value = config.numFoFrames.ToString();
                settingNode.Attributes.Append(keyAttribute);
                settingNode.Attributes.Append(valAttribute);
                mainNode.AppendChild(settingNode);

                // ControlWells
                settingNode        = xmlDoc.CreateElement("add");
                keyAttribute       = xmlDoc.CreateAttribute("key");
                keyAttribute.Value = "ControlWells";
                valAttribute       = xmlDoc.CreateAttribute("value");
                valAttribute.Value = ConvertWellListToString(config.controlSubtWells);
                settingNode.Attributes.Append(keyAttribute);
                settingNode.Attributes.Append(valAttribute);
                mainNode.AppendChild(settingNode);

                // DynamicRatioNumerator Description
                settingNode        = xmlDoc.CreateElement("add");
                keyAttribute       = xmlDoc.CreateAttribute("key");
                keyAttribute.Value = "DynamicRatioNumerator";
                valAttribute       = xmlDoc.CreateAttribute("value");
                valAttribute.Value = config.dynamicRatioNum.Description;
                settingNode.Attributes.Append(keyAttribute);
                settingNode.Attributes.Append(valAttribute);
                mainNode.AppendChild(settingNode);

                // DynamicRatioDenominator Description
                settingNode        = xmlDoc.CreateElement("add");
                keyAttribute       = xmlDoc.CreateAttribute("key");
                keyAttribute.Value = "DynamicRatioDenominator";
                valAttribute       = xmlDoc.CreateAttribute("value");
                valAttribute.Value = config.dynamicRatioDen.Description;
                settingNode.Attributes.Append(keyAttribute);
                settingNode.Attributes.Append(valAttribute);
                mainNode.AppendChild(settingNode);

                // WaveguideReportLocation
                settingNode        = xmlDoc.CreateElement("add");
                keyAttribute       = xmlDoc.CreateAttribute("key");
                keyAttribute.Value = "WaveguideReportLocation";
                valAttribute       = xmlDoc.CreateAttribute("value");
                valAttribute.Value = config.waveguideReportLocation;
                settingNode.Attributes.Append(keyAttribute);
                settingNode.Attributes.Append(valAttribute);
                mainNode.AppendChild(settingNode);

                // ExcelReportLocation
                settingNode        = xmlDoc.CreateElement("add");
                keyAttribute       = xmlDoc.CreateAttribute("key");
                keyAttribute.Value = "ExcelReportLocation";
                valAttribute       = xmlDoc.CreateAttribute("value");
                valAttribute.Value = config.excelReportLocation;
                settingNode.Attributes.Append(keyAttribute);
                settingNode.Attributes.Append(valAttribute);
                mainNode.AppendChild(settingNode);

                // CreateWaveguideReport
                settingNode        = xmlDoc.CreateElement("add");
                keyAttribute       = xmlDoc.CreateAttribute("key");
                keyAttribute.Value = "CreateWaveguideReport";
                valAttribute       = xmlDoc.CreateAttribute("value");
                valAttribute.Value = config.writeWaveguideReport.ToString();
                settingNode.Attributes.Append(keyAttribute);
                settingNode.Attributes.Append(valAttribute);
                mainNode.AppendChild(settingNode);

                // CreateExcelReport
                settingNode        = xmlDoc.CreateElement("add");
                keyAttribute       = xmlDoc.CreateAttribute("key");
                keyAttribute.Value = "CreateExcelReport";
                valAttribute       = xmlDoc.CreateAttribute("value");
                valAttribute.Value = config.writeExcelReport.ToString();
                settingNode.Attributes.Append(keyAttribute);
                settingNode.Attributes.Append(valAttribute);
                mainNode.AppendChild(settingNode);

                xmlString = xmlDoc.OuterXml;
            }
            catch (Exception)
            {
                success = false;
            }

            return(success);
        }
Beispiel #7
0
        public static bool ParseConfigurationPayload(byte[] payloadBytes, out ExperimentConfiguration config)
        {
            bool success = true;

            config = new ExperimentConfiguration();

            try
            {
                string payloadString = System.Text.Encoding.ASCII.GetString(payloadBytes);

                XmlDocument xmlDoc = new XmlDocument();
                xmlDoc.LoadXml(payloadString);

                foreach (XmlNode node1 in xmlDoc.DocumentElement.ChildNodes)
                {
                    if (node1.Name == "main")
                    {
                        foreach (XmlNode node2 in node1)
                        {
                            if (node2.Name == "add")
                            {
                                string attr  = node2.Attributes["key"].Value;
                                string value = node2.Attributes["value"].Value;

                                switch (attr)
                                {
                                case "ProjectID":
                                    config.project.ProjectID = Convert.ToInt32(value);
                                    break;

                                case "MethodID":
                                    config.method.MethodID = Convert.ToInt32(value);
                                    break;

                                case "PlateTypeID":
                                    config.plateType.PlateTypeID = Convert.ToInt32(value);
                                    break;

                                case "MaskID":
                                    config.mask.MaskID = Convert.ToInt32(value);
                                    break;

                                case "NumFoFrames":
                                    config.numFoFrames = Convert.ToInt32(value);
                                    break;

                                case "ControlWells":
                                    config.controlSubtWells = ParseWellListString(value);
                                    break;

                                case "DynamicRatioNumerator":
                                    config.dynamicRatioNum.Description = value;
                                    break;

                                case "DynamicRatioDenominator":
                                    config.dynamicRatioDen.Description = value;
                                    break;

                                case "WaveguideReportLocation":
                                    config.waveguideReportLocation = value;
                                    break;

                                case "ExcelReportLocation":
                                    config.excelReportLocation = value;
                                    break;

                                case "CreateWaveguideReport":
                                    config.writeWaveguideReport = Convert.ToBoolean(value);
                                    break;

                                case "CreateExcelReport":
                                    config.writeExcelReport = Convert.ToBoolean(value);
                                    break;
                                }
                            }
                        }
                    }
                }

                //WriteSettingsFile("tempSettings.xml", payloadBytes);

                //ReadSettingsFile("tempSettings.xml", out config);

                //File.Delete("tempSettings.xml");
            }
            catch (Exception ex)
            {
                success = false;
                Debug.Print(ex.Message);
            }



            return(success);
        }
Beispiel #8
0
        public static bool WriteSettingsFile(string filename, ExperimentConfiguration config)
        {
            bool success = true;

            try
            {
                var settings = new List <KeyValuePair <string, string> >();

                var xmlSettings = new Settings(filename);

                if (config.project != null)
                {
                    settings.Add(new KeyValuePair <string, string>("ProjectID", config.project.ProjectID.ToString()));
                }

                if (config.method != null)
                {
                    settings.Add(new KeyValuePair <string, string>("MethodID", config.method.MethodID.ToString()));
                }

                if (config.plateType != null)
                {
                    settings.Add(new KeyValuePair <string, string>("PlateTypeID", config.plateType.PlateTypeID.ToString()));
                }

                if (config.mask != null)
                {
                    settings.Add(new KeyValuePair <string, string>("MaskID", config.mask.MaskID.ToString()));
                }

                settings.Add(new KeyValuePair <string, string>("NumFoFrames", config.numFoFrames.ToString()));

                if (config.controlSubtWells != null)
                {
                    settings.Add(new KeyValuePair <string, string>("ControlWells", ConvertWellListToString(config.controlSubtWells)));
                }

                if (config.dynamicRatioNum != null)
                {
                    settings.Add(new KeyValuePair <string, string>("DynamicRatioNumerator", config.dynamicRatioNum.Description));
                }

                if (config.dynamicRatioDen != null)
                {
                    settings.Add(new KeyValuePair <string, string>("DynamicRatioDenominator", config.dynamicRatioDen.Description));
                }


                settings.Add(new KeyValuePair <string, string>("WaveguideReportLocation", config.waveguideReportLocation));
                settings.Add(new KeyValuePair <string, string>("ExcelReportLocation", config.excelReportLocation));
                settings.Add(new KeyValuePair <string, string>("CreateWaveguideReport", config.writeWaveguideReport.ToString()));
                settings.Add(new KeyValuePair <string, string>("CreateExcelReport", config.writeExcelReport.ToString()));

                xmlSettings.SetValues("main", settings);
            }
            catch (Exception ex)
            {
                success = false;
                System.Windows.MessageBox.Show("Error writing settings file: " + filename + "\n\n" + ex.Message, "File Error",
                                               MessageBoxButton.OK, MessageBoxImage.Error);
            }

            return(success);
        }
Beispiel #9
0
        /////////////////////////////////////////////////////////////////////////////////////////////////
        /////////////////////////////////////////////////////////////////////////////////////////////////
        /////////////////////////////////////////////////////////////////////////////////////////////////


        public static bool ReadSettingsFile(string filename, out ExperimentConfiguration config)
        {
            bool success = true;

            config = new ExperimentConfiguration();

            if (File.Exists(filename))
            {
                try
                {
                    var xmlSettings = new Settings(filename);

                    IList <KeyValuePair <string, string> > settings = new List <KeyValuePair <string, string> >();

                    settings = xmlSettings.GetValues("main");

                    foreach (KeyValuePair <string, string> kvp in settings)
                    {
                        switch (kvp.Key)
                        {
                        case "ProjectID":
                            config.project.ProjectID = Convert.ToInt32(kvp.Value);
                            break;

                        case "MethodID":
                            config.method.MethodID = Convert.ToInt32(kvp.Value);
                            break;

                        case "PlateTypeID":
                            config.plateType.PlateTypeID = Convert.ToInt32(kvp.Value);
                            break;

                        case "MaskID":
                            config.mask.MaskID = Convert.ToInt32(kvp.Value);
                            break;

                        case "NumFoFrames":
                            config.numFoFrames = Convert.ToInt32(kvp.Value);
                            break;

                        case "ControlWells":
                            config.controlSubtWells = ParseWellListString(kvp.Value);
                            break;

                        case "DynamicRatioNumerator":
                            config.dynamicRatioNum.Description = kvp.Value;
                            break;

                        case "DynamicRatioDenominator":
                            config.dynamicRatioDen.Description = kvp.Value;
                            break;

                        case "WaveguideReportLocation":
                            config.waveguideReportLocation = kvp.Value;
                            break;

                        case "ExcelReportLocation":
                            config.excelReportLocation = kvp.Value;
                            break;

                        case "CreateWaveguideReport":
                            config.writeWaveguideReport = Convert.ToBoolean(kvp.Value);
                            break;

                        case "CreateExcelReport":
                            config.writeExcelReport = Convert.ToBoolean(kvp.Value);
                            break;
                        }
                    }
                }
                catch (Exception ex)
                {
                    success = false;
                    MessageBox.Show("Error reading settings file: " + filename + "\n\n" + ex.Message, "File Error",
                                    MessageBoxButton.OK, MessageBoxImage.Error);
                }
            }
            else
            {
                success = false;
                MessageBox.Show("File does not exists: " + filename, "File Error",
                                MessageBoxButton.OK, MessageBoxImage.Error);
            }

            return(success);
        }