Ejemplo n.º 1
0
        public HandHandler()
        {
            ClientType clientType = Properties.Settings.Default.ClientType;
            ButtonCodes.SetType(clientType);

            if (clientType == ClientType.Custom)
            {
                buttonSender = new ButtonSender(Properties.Settings.Default.ClientType);
            }
            else
            {
                if (clientType == ClientType.XBMC)
                {
                    buttonSender = new ButtonSender(Properties.Settings.Default.ClientType, Properties.Settings.Default.IpAddress, 9777);
                }
                else if (clientType == ClientType.Boxee)
                {
                    buttonSender = new ButtonSender(Properties.Settings.Default.ClientType, Properties.Settings.Default.IpAddress, 9770);
                }
                buttonSender.SendNotification("KinEmote v0.3", "Hand Detected, tracking started.");
            }

            lastDirection = Direction.Illegal;
            handMode = HandMode.Normal;
            lastPoint = new Point(1, 2);

            intervalTimer = new Timer();
            intervalTimer.Elapsed += new ElapsedEventHandler(intervalTimer_Elapsed);
        }
Ejemplo n.º 2
0
        public void Dispose()
        {
            intervalTimer.Stop();
            intervalTimer.Dispose();

            buttonSender.SendNotification("KinEmote v0.3", "Session Ended");
            buttonSender = null;
        }
Ejemplo n.º 3
0
        private void butConnect_Click(object sender, EventArgs e)
        {
            Cursor = Cursors.WaitCursor;

            if (sensorHandler == null)
            {
                sensorHandler = new SensorHandler();
                sensorHandler.HandDetected += new EventHandler<EventArgs>(sensorHandler_HandDetected);
                sensorHandler.HoverDetected += new EventHandler<SelectableSlider2DHoverEventArgs>(sensorHandler_HoverDetected);
                sensorHandler.SessionEnded += new EventHandler<EventArgs>(sensorHandler_SessionEnded);

                if (!sensorHandler.isOK)
                {
                    sensorHandler.Dispose();
                    sensorHandler = null;
                    Cursor = Cursors.Default;
                    return;
                }

                Properties.Settings.Default.IpAddress = tbIp.Text;
                Properties.Settings.Default.Save();

                if (checkBoxXBMC.Checked)
                {
                    ButtonCodes.SetType(ClientType.XBMC);

                    ButtonSender buttonSender = new ButtonSender(ClientType.XBMC, Properties.Settings.Default.IpAddress, 9777);
                    buttonSender.SendNotification("KinEmote v0.3", "Connected");
                }
                else if (checkBoxBoxee.Checked)
                {
                    ButtonCodes.SetType(ClientType.Boxee);

                    ButtonSender buttonSender = new ButtonSender(ClientType.Boxee, Properties.Settings.Default.IpAddress, 9770);
                    buttonSender.SendNotification("KinEmote v0.3", "Connected");
                }
                else if (checkBoxCustom.Checked)
                {
                    ButtonCodes.SetType(ClientType.Custom);
                }

                butConnect.Text = "Disconnect";
            }
            else
            {
                sensorHandler.Dispose();
                sensorHandler = null;
                butConnect.Text = "Connect";
            }

            Cursor = Cursors.Default;
        }