Ejemplo n.º 1
0
 private void allDefaultsLinkLabel_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
 {
     m_settings            = new CommBaseSettings();
     m_settings.port       = Project.controllerPortSettings.port;
     m_settings.baudRate   = Project.controllerPortSettings.baudRate;
     m_settings.parity     = Parity.none;
     m_settings.autoReopen = true;
     FillValues();
 }
Ejemplo n.º 2
0
 private void allDefaultsLinkLabel_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
 {
     m_settings = new CommBaseSettings();
     m_settings.port = Project.controllerPortSettings.port;
     m_settings.baudRate = Project.controllerPortSettings.baudRate;
     m_settings.parity = Parity.none;
     m_settings.autoReopen = true;
     FillValues();
 }
Ejemplo n.º 3
0
        public DlgPortSettings()
        {
            InitializeComponent();

            m_settings = Project.controllerPortSettings;

            FillASCII(comboBoxXon);
            FillASCII(comboBoxXoff);
            //           Project.setDlgIcon(this);
        }
Ejemplo n.º 4
0
        public DlgPortSettings()
        {
            InitializeComponent();

            m_settings = Project.controllerPortSettings;

            FillASCII(comboBoxXon);
            FillASCII(comboBoxXoff);
            //           Project.setDlgIcon(this);
        }
Ejemplo n.º 5
0
        // returns true if could restore from file
        public static bool restoreOrDefaultPortSettings()
        {
            bool ret = false;

            // restore controllerPortSettings from the file or fill it with default values:
            string controllerPortFilePath = Project.GetMiscPath(Project.CONTROLLER_PORTCONFIG_FILE_NAME + "-" + currentControllerMake + ".xml");

            if (!File.Exists(controllerPortFilePath))
            {
                // older versions used single file for all Controllers
                controllerPortFilePath = Project.GetMiscPath(Project.CONTROLLER_PORTCONFIG_FILE_NAME + ".xml");
            }
            Stream fs = null;

            try
            {
                fs = new FileStream(controllerPortFilePath, FileMode.Open, FileAccess.Read, FileShare.Read);
                Project.controllerPortSettings = CommBaseSettings.LoadFromXML(fs);
                if (Project.controllerPortSettings == null)
                {
                    throw new Exception();
                }
                ret = true;
            }
            catch
            {
                Project.controllerPortSettings            = new CommBaseSettings();
                Project.controllerPortSettings.port       = "COM1:";
                Project.controllerPortSettings.baudRate   = 9600;
                Project.controllerPortSettings.parity     = Parity.none;
                Project.controllerPortSettings.autoReopen = true;
            }
            finally
            {
                if (fs != null)
                {
                    fs.Close();
                }
            }

            return(ret);
        }