コード例 #1
0
ファイル: Catch.cs プロジェクト: hamwich3/WinPLCChangeIP
 public Catch(IPAddress ip, PLCDiscovery plcfinder)
 {
     InitializeComponent();
     label2.Visible          = false;
     DiscoverPLC             = plcfinder;
     plcAddressBox.IPAddress = ip;
     sw = new Stopwatch();
 }
コード例 #2
0
ファイル: Form1.cs プロジェクト: hamwich3/WinPLCChangeIP
        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 });
            }
        }