コード例 #1
0
 private void allDefaultsLinkLabel_LinkClicked(object sender, System.Windows.Forms.LinkLabelLinkClickedEventArgs e)
 {
     m_settings = new CommBaseSettings();
     m_settings.port = Project.gpsPortSettings.port;
     m_settings.baudRate = Project.gpsPortSettings.baudRate;
     m_settings.parity = Parity.none;
     m_settings.autoReopen = true;
     FillValues();
 }
コード例 #2
0
ファイル: Project.cs プロジェクト: slgrobotics/QuakeMap
        // returns true if could restore from file
        public static bool restoreOrDefaultGpsSettings()
        {
            bool ret = false;

            // restore gpsPortSettings from the file or fill it with default values:
            string gpsPortFilePath = GetMiscPath(GPSPORTCONFIG_FILE_NAME + "-" + Project.currentGpsMake + ".xml");
            if(!File.Exists(gpsPortFilePath))
            {
                // older versions used single file for all GPSes
                gpsPortFilePath = GetMiscPath(GPSPORTCONFIG_FILE_NAME + ".xml");
            }
            Stream fs = null;
            try
            {
                fs = new FileStream(gpsPortFilePath, FileMode.Open, FileAccess.Read, FileShare.Read);
                gpsPortSettings = CommBaseSettings.LoadFromXML(fs);
                if (gpsPortSettings == null)
                {
                    throw new Exception();
                }
                ret = true;
            }
            catch
            {
                gpsPortSettings = new CommBaseSettings();
                gpsPortSettings.port = "COM1:";
                gpsPortSettings.baudRate = 9600;
                gpsPortSettings.parity = Parity.none;
                gpsPortSettings.autoReopen = true;

            }
            finally
            {
                if(fs != null) { fs.Close(); }
            }

            return ret;
        }
コード例 #3
0
        public DlgPortSettings()
        {
            //
            // Required for Windows Form Designer support
            //
            InitializeComponent();

            m_settings = Project.gpsPortSettings;

            FillASCII(comboBoxXon);
            FillASCII(comboBoxXoff);
            Project.setDlgIcon(this);
        }