예제 #1
0
 public Catch(IPAddress ip, PLCDiscovery plcfinder)
 {
     InitializeComponent();
     label2.Visible          = false;
     DiscoverPLC             = plcfinder;
     plcAddressBox.IPAddress = ip;
     sw = new Stopwatch();
 }
예제 #2
0
        public Form1()
        {
            InitializeComponent();
            DiscoverPLC                 = new PLCDiscovery();
            PLCGrid.DataSource          = DiscoverPLC.PLCbs;
            PLCGrid.AutoGenerateColumns = true;
            string ip = GetIP();

            if (ip != String.Empty)
            {
                IPLabel.Text = "Local IP: " + ip;
                int lastOctetIndex = ip.LastIndexOf(".") + 1;
                ip  = ip.Substring(0, lastOctetIndex);
                ip += "245";
                plcIPAddressBox.IPAddress = IPAddress.Parse(ip);
            }
            else
            {
                plcIPAddressBox.IPAddress = new IPAddress(new byte[] { 192, 168, 0, 245 });
            }
        }