bool usingSerial = false; //change this flag if you don't want to use the arduino control hub (useful for testing)

        //initialization called in mainwindow.xaml.cs
        public KinectBehavior_PortHandler(KinectBehavior_FileHandler fh) { //constructor
            fileHandler = fh;

            //can set this value to autoenable ports for specific environments or users (useful for developing on one computer and implementing on another)
            string environmentUserName = "";
            if(Environment.UserName == environmentUserName) 
            {
                usingSerial = true;
            }

            //checks to see if the comport exists, if it does then create the comport
            if (usingSerial && SerialPort.GetPortNames().Any(x => string.Compare(x, ComPortString, true) == 0))
            {
                serialPort1.PortName = ComPortString;
                serialPort1.BaudRate = 9600;
                serialPort1.DataReceived += new SerialDataReceivedEventHandler(DataReceivedHandler);

                serialPort1.Open();
                serialPort1.ReadTimeout = 20;
            }
            else
            {
                Console.WriteLine("no comPort");
            }
        }
        bool usingSerial = false;               //change this flag if you don't want to use the arduino control hub (useful for testing)

        //initialization called in mainwindow.xaml.cs
        public KinectBehavior_PortHandler(KinectBehavior_FileHandler fh)   //constructor
        {
            fileHandler = fh;

            //can set this value to autoenable ports for specific environments or users (useful for developing on one computer and implementing on another)
            string environmentUserName = "";

            if (Environment.UserName == environmentUserName)
            {
                usingSerial = true;
            }

            //checks to see if the comport exists, if it does then create the comport
            if (usingSerial && SerialPort.GetPortNames().Any(x => string.Compare(x, ComPortString, true) == 0))
            {
                serialPort1.PortName      = ComPortString;
                serialPort1.BaudRate      = 9600;
                serialPort1.DataReceived += new SerialDataReceivedEventHandler(DataReceivedHandler);

                serialPort1.Open();
                serialPort1.ReadTimeout = 20;
            }
            else
            {
                Console.WriteLine("no comPort");
            }
        }
Пример #3
0
        string recipient = "";              //who are you sending the email to (can be same as sender)

        public KinectBehavior_EmailHandler(KinectBehavior_FileHandler fh)
        {
            fileHandler = fh;
        }
        string recipient = ""; //who are you sending the email to (can be same as sender)

        public KinectBehavior_EmailHandler(KinectBehavior_FileHandler fh)
        {
            fileHandler = fh;
        }