private void btnSetting_Click(object sender, MouseButtonEventArgs e)
        {
            if (cbOprationType.Text == "TCP" || cbOprationType.Text == "UDP")
            {
                IPSetting settingForm = new IPSetting();
                if (Setting != null && (Setting as Business.NetworkSetting) != null)
                {
                    Business.NetworkSetting ns = (Business.NetworkSetting)Setting;
                    settingForm.Ip = ns.Ip;
                    settingForm.Port = ns.Port;
                }

                if (settingForm.ShowDialog() == true)
                {
                    Business.NetworkSetting ns = new Business.NetworkSetting();
                    ns.Ip = settingForm.Ip;
                    ns.Port = settingForm.Port;

                    Setting = ns;
                }
            }
            else if (cbOprationType.Text == "串口")
            {
                SerialPortSetting settingForm = new SerialPortSetting();
                if (Setting  != null && (Setting as Business.ComSetting) != null)
                {
                    Business.ComSetting cs = (Business.ComSetting)Setting;
                    settingForm.ComNumber = cs.ComNumber;
                    settingForm.BaudRate = cs.BaudRate;
                    settingForm.DataBit = cs.DataBits;
                    settingForm.StopBit = cs.StopBits;
                    settingForm.Parity = cs.Parity;
                }
                if (settingForm.ShowDialog() == true)
                {
                    Business.ComSetting cs = new Business.ComSetting();
                    cs.ComNumber = settingForm.ComNumber;
                    cs.BaudRate = settingForm.BaudRate;
                    cs.StopBits = settingForm.StopBit;
                    cs.DataBits = settingForm.DataBit;
                    cs.Parity = settingForm.Parity;

                    Setting = cs;
                }

            }
        }
        private void btnSetting_Click(object sender, MouseButtonEventArgs e)
        {
            if (cbOprationType.Text == "TCP" || cbOprationType.Text == "UDP")
            {
                IPSetting settingForm = new IPSetting();
                if (Setting != null && (Setting as Business.NetworkSetting) != null)
                {
                    Business.NetworkSetting ns = (Business.NetworkSetting)Setting;
                    settingForm.Ip   = ns.Ip;
                    settingForm.Port = ns.Port;
                }

                if (settingForm.ShowDialog() == true)
                {
                    Business.NetworkSetting ns = new Business.NetworkSetting();
                    ns.Ip   = settingForm.Ip;
                    ns.Port = settingForm.Port;

                    Setting = ns;
                }
            }
            else if (cbOprationType.Text == "串口")
            {
                SerialPortSetting settingForm = new SerialPortSetting();
                if (Setting != null && (Setting as Business.ComSetting) != null)
                {
                    Business.ComSetting cs = (Business.ComSetting)Setting;
                    settingForm.ComNumber = cs.ComNumber;
                    settingForm.BaudRate  = cs.BaudRate;
                    settingForm.DataBit   = cs.DataBits;
                    settingForm.StopBit   = cs.StopBits;
                    settingForm.Parity    = cs.Parity;
                }
                if (settingForm.ShowDialog() == true)
                {
                    Business.ComSetting cs = new Business.ComSetting();
                    cs.ComNumber = settingForm.ComNumber;
                    cs.BaudRate  = settingForm.BaudRate;
                    cs.StopBits  = settingForm.StopBit;
                    cs.DataBits  = settingForm.DataBit;
                    cs.Parity    = settingForm.Parity;

                    Setting = cs;
                }
            }
        }