private void Form1_Load(object sender, EventArgs e) { BackgroundColor.SelectedItem = Enum.GetValues(typeof(Index_Colours)); SegmentsNO.SelectedItem = Enum.GetValues(typeof(Segments)); RunlightColor.SelectedItem = Enum.GetValues(typeof(Index_Colours)); LevelLimit1.SelectedItem = Enum.GetValues(typeof(Index_Colours)); LevelLimit2.SelectedItem = Enum.GetValues(typeof(Index_Colours)); LevelLimit3.SelectedItem = Enum.GetValues(typeof(Index_Colours)); LevelLimit4.SelectedItem = Enum.GetValues(typeof(Index_Colours)); LevelLimit5.SelectedItem = Enum.GetValues(typeof(Index_Colours)); clsIOLUDPIF20.eError result = clsIOLUDPIF20.eError.OK; tbMessages.Text = ""; //Read DLL Info clsIOLUDPIF20.clsDllInfo DLLInfo = new clsIOLUDPIF20.clsDllInfo(); WriteInfo("Info about IOLUDPIF20.DLL:"); WriteInfo(" Revision of C DLL: " + DLLInfo.C_DLL_Version); WriteInfo(" Revision of .NET DLL: " + DLLInfo.NET_DLL_Version); WriteInfo(""); //search on UDP Masters clsIOLUDPIF20.clsUDPIOLMaster[] IOLMList = BNI005H.GetUDPMaster(); if (IOLMList.Length == 0) //jezeli nie wyszuka urzadzen { result = clsIOLUDPIF20.eError.DEVICE_NOT_AVAILABLE; goto RError; } // IOLM = IOLMList[0]; //laczy do pierwszego wyszukanego mastera Profinet/EthernetIP -> mozna by dac Combobox for (int i = 0; i < IOLMList.Length; i++) { avaliablemasters.Items.Add(IOLMList[i].Name); } return; // Obsluga bledow RError: //label if (result == clsIOLUDPIF20.eError.DEVICE_NOT_AVAILABLE) { MessageBox.Show("Error Message: " + result.ToString() + "\r\n" + "Maybe the device is not existing, or the firewall blocks the communication" + "\r\n" + "Please ensure either the UDP communication or attach the network device" + "\r\n" + "and start the program again", "Critical Warning"); } else { MessageBox.Show("Error Message: " + result.ToString(), "Critical Warning"); Environment.Exit(0); } }
private void Form3_Load(object sender, EventArgs e) { BackgroundColor.SelectedItem = Enum.GetValues(typeof(Index_Colours)); SegmentsNO.SelectedItem = Enum.GetValues(typeof(Segments)); RunlightColor.SelectedItem = Enum.GetValues(typeof(Index_Colours)); LevelLimit1.SelectedItem = Enum.GetValues(typeof(Index_Colours)); LevelLimit2.SelectedItem = Enum.GetValues(typeof(Index_Colours)); LevelLimit3.SelectedItem = Enum.GetValues(typeof(Index_Colours)); LevelLimit4.SelectedItem = Enum.GetValues(typeof(Index_Colours)); LevelLimit5.SelectedItem = Enum.GetValues(typeof(Index_Colours)); clsIOLUDPIF20.eError result = clsIOLUDPIF20.eError.OK; //tbMessages.Text = ""; clsIOLUDPIF20.clsUDPIOLMaster[] IOLMList = BNI005H.GetUDPMaster(); if (IOLMList.Length == 0) //jezeli nie wyszuka urzadzen { result = clsIOLUDPIF20.eError.DEVICE_NOT_AVAILABLE; goto RError; } IOLM = IOLMList[0]; RError: //label if (result == clsIOLUDPIF20.eError.DEVICE_NOT_AVAILABLE) { MessageBox.Show("Error Message: " + result.ToString() + "\r\n" + "Maybe the device is not existing, or the firewall blocks the communication" + "\r\n" + "Please ensure either the UDP communication or attach the network device" + "\r\n" + "and start the program again", "Critical Warning"); } else { MessageBox.Show("Error Message: " + result.ToString(), "Critical Warning"); Environment.Exit(0); } }