コード例 #1
0
        public bool Connect(string connectArgs = null)
        {
            try
            {
                COMMON.Init();
                NumberOfSpectrometers = OceanOpticsWrapper.openAllSpectrometers();
                Console.WriteLine("연결된 스펙트로미터 : " + NumberOfSpectrometers.ToString());

                if (NumberOfVirtualSpectrometers > 0)
                {
                    VirtualWaveLength = new double[NumberOfVirtualSpectrometers][];
                    VirtualIntensity  = new double[NumberOfVirtualSpectrometers][];
                    Console.WriteLine("생성된 가상 스펙트로미터 : " + NumberOfVirtualSpectrometers.ToString());
                }

                if (NumberOfSpectrometers == 0)
                {
                    IsConnected = false;
                    MessageBox.Show("Spectrometer가 연결이 되지 않았습니다");
                    return(false);
                }
                WaveLength = new double[NumberOfSpectrometers][];
                Intensity  = new double[NumberOfSpectrometers][];

                IsConnected = true;
                return(IsConnected);
            }
            catch (Exception except)
            {
                COMMON.Log.Error("Spectrometer :: Connect " + except.ToString());
                LastErrorMsg = "Connect Error " + except.ToString();
                IsConnected  = false;
                MessageBox.Show(except.ToString());
                return(IsConnected);
            }
        }