예제 #1
0
        /// <summary>
        /// Function to connect device using wforms interface.
        /// </summary>
        public void Connect()
        {
            //for Shimmer and ShimmerSDBT
            ShimmerDevice.SetComPort(comboBoxComPorts.Text);

            //bool connect = true; // check to connect one at a time

            if (ShimmerDevice.GetState() != Shimmer.SHIMMER_STATE_CONNECTED)
            {
                if (!DeviceConnected)
                {
                    DeviceConnected = true;
                    ShimmerDevice.StartConnectThread();
                }
            }
        }
예제 #2
0
        private void exitToolStripMenuItem_Click(object sender, EventArgs e)
        {
            CloseVideoSource();

            if (ShimmerDevice1 != null)
            {
                if (ShimmerDevice1.GetState() == (int)Shimmer.SHIMMER_STATE_STREAMING)
                {
                    ShimmerDevice1.StopStreaming();
                }

                ShimmerDevice1.Disconnect();
            }

            if (ShimmerDevice2 != null)
            {
                if (ShimmerDevice2.GetState() == (int)Shimmer.SHIMMER_STATE_STREAMING)
                {
                    ShimmerDevice2.StopStreaming();
                }

                ShimmerDevice2.Disconnect();
            }

            try
            {
                if (_writeToFileShimmer1 != null)
                {
                    _writeToFileShimmer1.CloseFile();
                }

                if (_writeToFileShimmer2 != null)
                {
                    _writeToFileShimmer2.CloseFile();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, Control.ApplicationName, MessageBoxButtons.OK, MessageBoxIcon.Warning);
                throw;
            }

            Application.Exit();
        }