• 大小: 0.06M
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2024-04-23
  • 语言: C#
  • 标签: 软件  测试  

资源简介


资源截图

代码片段和文件信息

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.IO;
using System.Threading;

namespace PclTest
{
    public partial class MainFrm : Form
    {
        string strCom = string.Empty;
        string strBaud = string.Empty;
        string strMeter = string.Empty;
        string strCmd = string.Empty;
        string strBegin = string.Empty;
        string strEnd = string.Empty;
        private static readonly object Lock = new object();

        public MainFrm()
        {
            InitializeComponent();
            // 加入这行
            Control.CheckForIllegalCrossThreadCalls = false;
        }
  
        private void comboBox2_DropDown(object sender EventArgs e)
        {
            //串口
            cbComPort.DataSource = System.IO.Ports.SerialPort.GetPortNames();
        }
     
        private void MainFrm_Load(object sender EventArgs e)
        {
            cbComPort.DataSource = System.IO.Ports.SerialPort.GetPortNames();
            IniFiles.IniFiles f = new IniFiles.IniFiles();
            f.IniFileName = Application.StartupPath + @“\Configuration.ini“;
             strCom = f.ReadStrValue(“COM“ “COM“ ““);
            if (strCom == ““)
            {
                if (cbComPort.Items.Count > 0)
                {
                    strCom = cbComPort.Items[0].ToString();
                    f.WriteStrValue(“COM“ “COM“ strCom);
                }
            }
             strBaud = f.ReadStrValue(“COM“ “BaudRate“ ““);
            if (strCom == ““)
            {
                strBaud = “9600“;
                f.WriteStrValue(“COM“ “BaudRate“ strBaud);
            }
            cbBaudRate.Text = strBaud;
            string strProtocol = f.ReadStrValue(“COM“ “Protocol“ ““);
            if (strProtocol == ““)
            {
                if (cbPclType.Items.Count > 0)
                {
                    strProtocol = cbPclType.Items[0].ToString();
                    f.WriteStrValue(“COM“ “Protocol“ strProtocol);
                }
            }
            cbPclType.Text = strProtocol;
            //Meter Serial Number
            string strMeterList = f.ReadStrValue(“COM“ “MeterList“ ““);
            if (strMeterList == ““)
            {
                strMeterList = “018120014207;018120014208“;
                f.WriteStrValue(“COM“ “MeterList“ strMeterList);
            }
            cbMeterSerial.DataSource = strMeterList.Split(‘;‘);

             strMeter = f.ReadStrValue(“COM“ “Meter“ ““);
            if (strMeter == ““)
            {
                if (cbMeterSerial.Items.Count > 0)
                {
                    strMeter = cbMeterSerial.Items[0].ToString();
                    f.WriteStrValue(“COM“ “Meter“ strMeter);
                }
          

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2021-01-27 14:54  PclTest\
     文件         187  2020-12-24 09:03  PclTest\App.config
     文件       15364  2020-12-24 18:53  PclTest\Form1.Designer.cs
     文件        7911  2020-12-25 09:56  PclTest\Form1.cs
     文件        5817  2020-12-24 18:53  PclTest\Form1.resx
     文件        1056  2020-12-24 13:23  PclTest\FormatData.cs
     文件        2293  2018-08-24 10:52  PclTest\IniFiles.cs
     文件        2383  2020-12-24 13:12  PclTest\Logger.cs
     文件        3726  2020-12-24 13:27  PclTest\PclTest.csproj
     文件        1118  2020-12-24 09:03  PclTest\PclTest.sln
     文件       22528  2020-12-25 10:26  PclTest\PclTest.v12.suo
     文件         521  2020-12-24 09:05  PclTest\Program.cs
     目录           0  2020-12-24 09:03  PclTest\Properties\
     文件        1306  2020-12-24 09:03  PclTest\Properties\AssemblyInfo.cs
     文件        2827  2020-12-24 09:03  PclTest\Properties\Resources.Designer.cs
     文件        5612  2020-12-24 09:03  PclTest\Properties\Resources.resx
     文件        1094  2020-12-24 09:03  PclTest\Properties\Settings.Designer.cs
     文件         249  2020-12-24 09:03  PclTest\Properties\Settings.settings
     文件        3850  2020-12-24 17:18  PclTest\Protocl645_1997.cs
     文件       13055  2020-12-24 18:39  PclTest\Serial.cs
     目录           0  2020-12-24 09:03  PclTest\bin\
     目录           0  2021-02-03 14:33  PclTest\bin\Debug\
     目录           0  2020-12-24 09:03  PclTest\obj\
     目录           0  2021-01-26 12:01  PclTest\obj\Debug\
     文件         210  2021-01-26 12:01  PclTest\obj\Debug\.NETframeworkVersion=v4.5.AssemblyAttributes.cs
     文件         865  2020-12-25 09:55  PclTest\obj\Debug\DesignTimeResolveAssemblyReferences.cache
     文件        7161  2020-12-25 09:53  PclTest\obj\Debug\DesignTimeResolveAssemblyReferencesInput.cache
     文件         180  2020-12-24 18:59  PclTest\obj\Debug\PclTest.MainFrm.resources
     文件         180  2020-12-24 13:27  PclTest\obj\Debug\PclTest.Properties.Resources.resources
     文件         866  2020-12-25 10:01  PclTest\obj\Debug\PclTest.csproj.FileListAbsolute.txt
     文件         977  2020-12-25 09:53  PclTest\obj\Debug\PclTest.csproj.GenerateResource.Cache
............此处省略8个文件信息

评论

共有 条评论