示例#1
0
 private void SetAdressDialog_Load(object sender, EventArgs e)
 {
     try
     {
         Port = Convert.ToInt16(lblPort.Text);
     }
     catch
     {
         XtraMessageBox.Show("端口号不符合要求!请重新设置!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
         this.Close();
         return;
     }
     if (!aiOiTag.Open(IP, Port))
     {
         XtraMessageBox.Show("打开连接失败,\n请检查IP和端口号是否正确!", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
         this.Close();
         return;
     }
     Microsoft.VisualBasic.Devices.Network network = new Microsoft.VisualBasic.Devices.Network();
     if (!network.Ping(IP))
     {
         XtraMessageBox.Show("控制器IP错误或控制器与本机不在同一个网络!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
         this.Close();
         return;
     }
 }
 private void SetAdressDialog_Load(object sender, EventArgs e)
 {
     try
     {
         Port = Convert.ToInt16(lblPort.Text);
     }
     catch
     {
         XtraMessageBox.Show("端口号不符合要求!请重新设置!","提示",MessageBoxButtons.OK,MessageBoxIcon.Exclamation);
         this.Close();
         return;
     }
     if (!aiOiTag.Open(IP, Port))
     {
         XtraMessageBox.Show("打开连接失败,\n请检查IP和端口号是否正确!", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
         this.Close();
         return;
     }
     Microsoft.VisualBasic.Devices.Network network = new Microsoft.VisualBasic.Devices.Network();
     if (!network.Ping(IP))
     {
         XtraMessageBox.Show("控制器IP错误或控制器与本机不在同一个网络!", "提示",MessageBoxButtons.OK,MessageBoxIcon.Exclamation);
         this.Close();
         return;
     }
 }
 private void CmdDialog_Load(object sender, EventArgs e)
 {
     if (!aiOiTag.Open(IP, Port))
     {
         XtraMessageBox.Show("打开连接失败,\n请检查IP和端口号是否正确!", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
         this.Close();
         return;
     }
     Microsoft.VisualBasic.Devices.Network network = new Microsoft.VisualBasic.Devices.Network();
     if (!network.Ping(IP))
     {
         XtraMessageBox.Show("控制器IP错误或控制器与本机不在同一个网络!", "提示",MessageBoxButtons.OK,MessageBoxIcon.Exclamation);
         this.Close();
         return;
     }
 }
示例#4
0
 private void CmdDialog_Load(object sender, EventArgs e)
 {
     if (!aiOiTag.Open(IP, Port))
     {
         XtraMessageBox.Show("打开连接失败,\n请检查IP和端口号是否正确!", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
         this.Close();
         return;
     }
     Microsoft.VisualBasic.Devices.Network network = new Microsoft.VisualBasic.Devices.Network();
     if (!network.Ping(IP))
     {
         XtraMessageBox.Show("控制器IP错误或控制器与本机不在同一个网络!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
         this.Close();
         return;
     }
 }
示例#5
0
 public static void Initialize(string LedCollection)
 {
     leds.DelAllProgram();
     isActiveLeds.Clear();
     string[] ledConfig = LedCollection.Split(';');
     Microsoft.VisualBasic.Devices.Network network = new Microsoft.VisualBasic.Devices.Network();
     foreach (string led in ledConfig)
     {
         if (network.Ping(led.Split(',')[1]))
         {
             isActiveLeds.Add(Convert.ToInt32(led.Split(',')[0]), led.Split(',')[1]);
             leds.Add(Convert.ToInt32(led.Split(',')[0]));
         }
         else
         {
             Logger.Error(Convert.ToInt32(led.Split(',')[0]) + "号LED屏故障,请检查!IP:[" + led.Split(',')[1] + "]");
         }
     }
 }
示例#6
0
 private static bool IsOnLineLed(int ledNo)
 {
     if (isActiveLeds.ContainsKey(ledNo))
     {
         Microsoft.VisualBasic.Devices.Network network = new Microsoft.VisualBasic.Devices.Network();
         if (!network.Ping(isActiveLeds[ledNo]))
         {
             //Logger.Error(ledNo + "号LED屏故障,请检查!IP:[" + isActiveLeds[ledNo] + "]");
             return(false);
         }
         else
         {
             return(true);
         }
     }
     else
     {
         return(false);
     }
 }
        public override void Initialize(Context context)
        {
            base.Initialize(context);

            Microsoft.VisualBasic.Devices.Network network = new Microsoft.VisualBasic.Devices.Network();
            string[] ledConfig = context.Attributes["IsActiveLeds"].ToString().Split(';');

            foreach (string led in ledConfig)
            {
                if (network.Ping(led.Split(',')[1]))
                {
                    isActiveLeds.Add(Convert.ToInt32(led.Split(',')[0]), led.Split(',')[1]);
                }
                else
                {
                    Logger.Error(Convert.ToInt32(led.Split(',')[0]) + "ºÅLEDÆÁ¹ÊÕÏ£¬Çë¼ì²é£¡IP:[" + led.Split(',')[1] + "]");
                }
            }

            ledUtil.isActiveLeds = isActiveLeds;
        }
示例#8
0
 private bool IsOnLineLed(int ledNo)
 {
     if (isActiveLeds.ContainsKey(ledNo))
     {
         Microsoft.VisualBasic.Devices.Network network = new Microsoft.VisualBasic.Devices.Network();
         if (!network.Ping(isActiveLeds[ledNo]))
         {
             THOK.MCP.Logger.Error(ledNo + "��LED�����ϣ����飡IP:[" + isActiveLeds[ledNo] + "]");
             return false;
         }
         else
             return true;
     }
     else
         return false;
 }