コード例 #1
0
        private void Main_Load(object sender, EventArgs e)
        {
            try
            {
                OpenDMX.start();                                            //find and connect to devive (first found if multiple)
                if (OpenDMX.status == FT_STATUS.FT_DEVICE_NOT_FOUND)        //update status
                {
                    toolStripStatusLabel1.Text = "No Enttec USB Device Found";
                }
                else if (OpenDMX.status == FT_STATUS.FT_OK)
                {
                    toolStripStatusLabel1.Text = "Found DMX on USB";
                }
                else
                {
                    toolStripStatusLabel1.Text = "Error Opening Device";
                }
            }
            catch (Exception exp)
            {
                Console.WriteLine(exp);
                toolStripStatusLabel1.Text = "Error Connecting to Enttec USB Device";
            }

            // On initialization, reset alll lights to zero
            OpenDMX.setDmxValue(1, 0);
            OpenDMX.setDmxValue(2, 0);
            OpenDMX.setDmxValue(3, 0);
            OpenDMX.setDmxValue(4, 0);
            OpenDMX.setDmxValue(5, 0);
            OpenDMX.setDmxValue(6, 0);
            OpenDMX.setDmxValue(7, 0);
            OpenDMX.setDmxValue(8, 0);
            OpenDMX.writeData();

            // For some reason we need duplication...
            OpenDMX.setDmxValue(1, 0);
            OpenDMX.setDmxValue(2, 0);
            OpenDMX.setDmxValue(3, 0);
            OpenDMX.setDmxValue(4, 0);
            OpenDMX.setDmxValue(5, 0);
            OpenDMX.setDmxValue(6, 0);
            OpenDMX.setDmxValue(7, 0);
            OpenDMX.setDmxValue(8, 0);
            OpenDMX.writeData();


            for (int i = 0; i < 8; i++)
            {
                mostRecentData[i] = 0;
            }
        }