Example #1
0
 private void Cartogram_Form_Load(object sender, EventArgs e)
 {
     protocolList = protocols_GURD_XML.Load(Protocol_Path);
     foreach (Protocol protocol in protocolList.Protocols)
     {
         Protocol_Name_ComBox.Items.Add(protocol.Protocol_TitleName);
     }
     stereoscopicCartogramPaint.StereoscopicCartogramInitialized(ref c1Chart3D1, ref PaintData);
     SerialPortHelper_HomeForm.serialPortData += SerialPortChange;
 }
Example #2
0
        private void ProtocolAdd_Btn_Click(object sender, EventArgs e)
        {
            try
            {
                ProtocolList protocolList = operation.Load(Protocol_Path);

                protocolList = operation.Add(ProtocolName_TextBox.Text, ProtocolContent_TextBox.Text, protocolList);
                operation.Protocol_Save(protocolList, Protocol_Path);
                protocolAdd(protocolList);
                MessageBox.Show("添加成功");
                this.Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show("发生错误:" + ex.ToString());
            }
        }
        private void Multi_Device_Form_Load(object sender, EventArgs e)
        {
            ComboBox_StartSeting(SerialPort1_ComboBox);
            ComboBox_StartSeting(SerialPort2_ComboBox);
            ComboBox_StartSeting(SerialPort3_ComboBox);
            ComboBox_StartSeting(SerialPort4_ComboBox);
            ComboBox_StartSeting(SerialPort5_ComboBox);
            if (!File.Exists(Xml_Path))
            {
                Protocols protocols = new Protocols();

                protocols.Protocolist.Add(new ProtocolSingle("超声波", "01 03 00 10 00 0A C4 08", "02 03 00 10 00 0A C4 3B", "03 03 00 10 00 0A C5 EA", "04 03 00 10 00 0A C4 5D", "05 03 00 10 00 0A C5 8C"));
                protocols.Protocolist.Add(new ProtocolSingle("特高频", "01 03 00 1A 00 0A E4 0A", "02 03 00 1A 00 0A E4 39", "03 03 00 1A 00 0A E5 E8", "04 03 00 1A 00 0A E4 5F", "05 03 00 1A 00 0A E5 8E"));
                protocols.Protocolist.Add(new ProtocolSingle("高频电流", "01 03 00 24 00 0A 85 C6", "02 03 00 24 00 0A 85 F5", "03 03 00 24 00 0A 84 24", "04 03 00 24 00 0A 85 93", "05 03 00 24 00 0A 84 42"));
                protocols.Protocolist.Add(new ProtocolSingle("低压故障电弧", "01 03 00 2E 00 0A A5 C4", "02 03 00 2E 00 0A A5 F7", "03 03 00 2E 00 0A A4 26", "04 03 00 2E 00 0A A5 91", "05 03 00 2E 00 0A A4 40"));
                protocols.Protocolist.Add(new ProtocolSingle("二合一", "01 03 00 10 00 0F 04 0B", "02 03 00 10 00 0F 04 38", "03 03 00 10 00 0F 05 E9", "04 03 00 10 00 0F 04 5E", "05 03 00 10 00 0F 05 8F"));
                protocols.Protocolist.Add(new ProtocolSingle("基站局放检测", "01 03 00 10 00 14 44 00", "02 03 00 10 00 14 44 33", "03 03 00 10 00 0F 05 E9", "04 03 00 10 00 0F 04 5E", "05 03 00 10 00 0F 05 8F"));
                //protocols.Protocolist.Add(new ProtocolSingle("1号传感器", "01 03 00 10 00 0A C4 08","","","",""));
                //protocols.Protocolist.Add(new ProtocolSingle("2号传感器", "01 03 00 1A 00 0A E4 0A","","","",""));
                protocols_GURD.Protocol_Save(protocols, Xml_Path);
            }
            if (File.Exists(Txt_Path))
            {
                this.Text = fileCRUD.Read(Txt_Path, Encoding.UTF8);
            }
            else
            {
                fileCRUD.Write(Txt_Path, "");
            }

            protocols = protocols_GURD.Load(Xml_Path);
            foreach (ProtocolSingle protocol in protocols.Protocolist)
            {
                Protocol_TitleName_ComboBox.Items.Add(protocol.ProtocolName);
            }
            cartogramPaint.CartogramInitialized(ref c1Chart1, ref arrHistory1);
            cartogramPaint.CartogramInitialized(ref c1Chart2, ref arrHistory2);
            cartogramPaint.CartogramInitialized(ref c1Chart3, ref arrHistory3);
            cartogramPaint.CartogramInitialized(ref c1Chart4, ref arrHistory4);
            cartogramPaint.CartogramInitialized(ref c1Chart5, ref arrHistory5);
            cartogramPaint.CartogramInitialized(ref c1Chart6, ref arrHistory6);
            cartogramPaint.CartogramInitialized(ref c1Chart7, ref arrHistory7);
        }