Exemplo n.º 1
0
        protected void initDI145()
        {
            count = columnCount;
            detectFileAviable();
            if (isFileAvaible)
            {
                DecryptFile(encryptPath, decryptPath, sKey);
                fsOpen = new FileStream(decryptPath, FileMode.Open);
                sr     = new StreamReader(fsOpen, Encoding.Default);
            }
            else
            {
                DataqDeviceArray = Discovery.DiscoverAllDevices();
                if (DataqDeviceArray.Length == 0)
                {
                    MessageBox.Show("No compatible DATAQ Instruments devices found.",
                                    "Missing DATAQ Instruments hardware", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    Environment.Exit(0);
                }
                else
                {
                    DI_145 = DataqDeviceArray[0];
                    DI_145.Connect();
                }

                if (DI_145.Model != "DI-145")
                {
                    MessageBox.Show("This program works only with DATAQ Instruments model DI-145",
                                    "Incompatible Device (" + DI_145.Model + ")", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    Environment.Exit(0);
                }
                Dataq.Range <double> Range = new Dataq.Range <double>();
                DI_145.ChannelArray[0].Enabled = true;

                DI_145.NewDataMinimum = 1;
                //set the number of scans to acquire before the NewData event fires
                DI_145.Start();
                //start scanning
                fsWrite = new FileStream(filePath, FileMode.Create);
                sw      = new StreamWriter(fsWrite, Encoding.Default);
            }
        }