Ejemplo n.º 1
0
        private void StartCanvasWindow()
        {
            CanvasWindow canvas = new CanvasWindow();

            if (Screen.AllScreens.Length > 1)
            {
                int    mainScreen           = Screen.AllScreens.Length == 2 ? 1 : 0;
                Screen s2                   = Screen.AllScreens[mainScreen];
                System.Drawing.Rectangle r2 = s2.Bounds;
                canvas.Top  = r2.Top;
                canvas.Left = r2.Left;
                canvas.Show();
                canvas.WindowStyle = WindowStyle.None;
                canvas.WindowState = WindowState.Maximized;
                canvas.Topmost     = true;
            }
            else
            {
                Screen s1 = Screen.AllScreens[0];
                System.Drawing.Rectangle r1 = s1.WorkingArea;
                canvas.Top  = r1.Top;
                canvas.Left = r1.Left;
                canvas.Show();
            }
        }
Ejemplo n.º 2
0
 public KinectGesture(string shape)
 {
     Shape     = shape;
     Type      = GestureParser.GetTypeContext();
     Direction = GestureParser.GetDirectionContext();
     Pointer   = CanvasWindow.GetCurrentPoint();
     Timestamp = DateTime.Now;
 }
Ejemplo n.º 3
0
        private void ManageMobileConnection()
        {
            try
            {
                Console.WriteLine("User connected! Address: " + socket.RemoteEndPoint);
                CanvasWindow.SetConnection(this);
                Connected = true;

                using (NetworkStream stream = new NetworkStream(socket))
                    using (sr = new StreamReader(stream))
                        using (sw = new StreamWriter(stream))
                        {
                            sw.AutoFlush = true;
                            string start = GestureParser.GetDirectionContext() == GestureDirection.Pull ? "startpull" : "startpush";
                            sw.WriteLine(start);
                            if (GestureParser.GetDirectionContext() == GestureDirection.Pull)
                            {
                                sw.WriteLine(nextShape);
                            }

                            SetGesture(GestureParser.GetTypeContext());
                            while (true)
                            {
                                String line = sr.ReadLine();

                                if (line.Contains("resetgyro"))
                                {
                                    gyro.ResetGyroscope();
                                }
                                //else if (line.StartsWith("gyrodata"))
                                //{
                                //    gyro.Update(line.Split(':')[2], line.Split(':')[4], line.Split(':')[6], line.Split(':')[8]);
                                //}
                                else
                                {
                                    dynamic jO = JsonConvert.DeserializeObject(line);
                                    if (jO.GetType().GetProperty("Type") != null)
                                    {
                                        GestureParser.AddMobileGesture(new MobileGesture(jO));
                                    }
                                }
                            }
                        }
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }
            finally
            {
                socket.Close();
                Connected = false;
            }
        }
Ejemplo n.º 4
0
        public CanvasWindow(bool accuracyTest = true)
        {
            this.accuracyTest = accuracyTest;

            targetColor = accuracyTest ? Brushes.White : Brushes.DarkGray;

            source = accuracyTest? DataSource.Accuracy : DataSource.Target;

            sounds.Add("hit", new SoundPlayer("resources/hit.wav"));
            sounds.Add("miss", new SoundPlayer("resources/miss.wav"));

            shapes = new List <String>();
            shapes.Add("circle");
            shapes.Add("square");
            GestureParser.Initialize(this);
            currentSize = GridSize.Small;
            window      = this;
            InitializeComponent();
            kinectManager = new KinectManager(this);
            VideoWindow.SetCanvasWindow(this);
        }
Ejemplo n.º 5
0
 public static void SetCanvasWindow(CanvasWindow window)
 {
     canvasWindow = window;
 }