Ejemplo n.º 1
0
        //Helpers--------------------------------------------------------------------------------------------------------------//
        #region Helpers

        //readAppSettings from xmlFile, show message box is exception thrown
        private bool readAppSettingsFromXml()
        {
            var settingsLoaded = false;

            try
            {
                appSettings.ReadFromXML();

                appPort.PortName = appSettings.ComPortName;
                appPort.BaudRate = appSettings.ComBaudRate;
                appPort.Parity   = appSettings.ComParity;
                appPort.DataBits = appSettings.ComDataBits;
                appPort.StopBits = appSettings.ComStopBits;
                appPort.NewLine  = appSettings.ComNewLine;

                settingsLoaded = true;
            }
            catch (Exception exception)
            {
                MessageBox.Show("Error loading settings: " + exception.GetBaseException().Message, "Error",
                                MessageBoxButton.OK, MessageBoxImage.Exclamation);
            }
            return(settingsLoaded);
        }