コード例 #1
0
        public void SaveUserData()
        {
            Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);

            config.AppSettings.Settings["CommunicationMode"].Value = CommunicationMode.ToString();
            config.AppSettings.Settings["IPAddress"].Value         = IPAddress.ToString();
            config.AppSettings.Settings["TCPPort"].Value           = TCPPort.ToString();
            config.AppSettings.Settings["PortName"].Value          = PortName.ToString();
            config.AppSettings.Settings["Baud"].Value     = Baud.ToString();
            config.AppSettings.Settings["Parity"].Value   = Parity.ToString();
            config.AppSettings.Settings["SlaveId"].Value  = SlaveId.ToString();
            config.AppSettings.Settings["DataBits"].Value = DataBits.ToString();
            config.AppSettings.Settings["StopBits"].Value = StopBits.ToString();
            config.Save(ConfigurationSaveMode.Modified);
            ConfigurationManager.RefreshSection("appSettings");


            //Properties.Settings.Default.CommunicationMode = CommunicationMode.ToString();
            //Properties.Settings.Default.IPAddress = IPAddress.ToString();
            //Properties.Settings.Default.DisplayFormat = DisplayFormat.ToString();
            //Properties.Settings.Default.TCPPort = TCPPort;
            //Properties.Settings.Default.PortName = PortName;
            //Properties.Settings.Default.Baud = Baud;
            //Properties.Settings.Default.Parity = Parity;
            //Properties.Settings.Default.StartAddress = StartAddress;
            //Properties.Settings.Default.DataLength = DataLength;
            //Properties.Settings.Default.SlaveId = SlaveId;
            //Properties.Settings.Default.SlaveDelay = SlaveDelay;
            //Properties.Settings.Default.DataBits = DataBits;
            //Properties.Settings.Default.StopBits = StopBits;
            //Properties.Settings.Default.Save();
        }
コード例 #2
0
        public Guid SendSetCommunicationMode(Guid resourceId, CommunicationMode mode)
        {
            var requestGuid = Guid.NewGuid();
            var request     = new ResourceMessage()
            {
                Command     = "mode",
                Data        = mode.ToString().ToLower(),
                TargetGuid  = resourceId.ToString(),
                SenderGuid  = m_clientId.ToString(),
                RequestGuid = requestGuid.ToString()
            };

            SendRequest(request);
            return(requestGuid);
        }
コード例 #3
0
 private void SaveUserData()
 {
     Properties.Settings.Default.CommunicationMode = CommunicationMode.ToString();
     Properties.Settings.Default.IPAddress         = IPAddress.ToString();
     Properties.Settings.Default.DisplayFormat     = DisplayFormat.ToString();
     Properties.Settings.Default.TCPPort           = TCPPort;
     Properties.Settings.Default.PortName          = PortName;
     Properties.Settings.Default.Baud         = Baud;
     Properties.Settings.Default.Parity       = Parity;
     Properties.Settings.Default.StartAddress = StartAddress;
     Properties.Settings.Default.DataLength   = DataLength;
     Properties.Settings.Default.SlaveId      = SlaveId;
     Properties.Settings.Default.SlaveDelay   = SlaveDelay;
     Properties.Settings.Default.DataBits     = DataBits;
     Properties.Settings.Default.StopBits     = StopBits;
     Properties.Settings.Default.Save();
 }