コード例 #1
0
    public static void Start(String name, WSRKinectSensor sensor) {
      Thread thread = new Thread(() => {
        SynchronizationContext.SetSynchronizationContext(new DispatcherSynchronizationContext(Dispatcher.CurrentDispatcher));
        WSRCamera camera = new WSRCamera(name, sensor);
        camera.Closing += (sender2, e2) => { camera.Hide(); e2.Cancel = true; };
        System.Windows.Threading.Dispatcher.Run();
      });

      thread.Name = name;
      thread.SetApartmentState(ApartmentState.STA);
      thread.IsBackground = true;
      thread.Start();
    }
コード例 #2
0
        public static void Start(String name, WSRKinectSensor sensor)
        {
            Thread thread = new Thread(() => {
                SynchronizationContext.SetSynchronizationContext(new DispatcherSynchronizationContext(Dispatcher.CurrentDispatcher));
                WSRCamera camera = new WSRCamera(name, sensor);
                camera.Closing  += (sender2, e2) => { camera.Hide(); e2.Cancel = true; };
                System.Windows.Threading.Dispatcher.Run();
            });

            thread.Name = name;
            thread.SetApartmentState(ApartmentState.STA);
            thread.IsBackground = true;
            thread.Start();
        }
コード例 #3
0
        public override void Dispose()
        {
            // Stop super
            base.Dispose();

            // Stop Thread
            WSRCamera.Shutdown();

            // Stop Sensor
            WSRConfig.GetInstance().logInfo("KINECT", "Stop Sensors");
            if (Sensors != null)
            {
                foreach (WSRKinectSensor sensor in Sensors)
                {
                    if (sensor != null)
                    {
                        sensor.Dispose();
                    }
                }
            }
        }
コード例 #4
0
        // ==========================================
        //  HANDLE SYSTEM TRAY
        // ==========================================


        public override void HandleCtxMenu(ContextMenuStrip menu)
        {
            int i = 0;

            foreach (WSRKinectSensor sensor in Sensors)
            {
                var name = "Kinect_" + i++;

                // Start Camera window
                WSRCamera.Start(name, sensor);

                // Build CtxMenu
                var item = new ToolStripMenuItem();
                item.Text   = name;
                item.Click += new EventHandler(Kinect_Click);
                item.Image  = net.encausse.sarah.Properties.Resources.Kinect;

                // Add CtxMenu
                menu.Items.Add(item);
            }

            // Super
            base.HandleCtxMenu(menu);
        }
コード例 #5
0
 public static void Start()
 {
     Thread thread = new Thread(() => {
     camera = new WSRCamera();
      // camera.Show();
      // camera.Closed += (sender2, e2) => camera.Dispatcher.InvokeShutdown();
     camera.Closing += (sender2, e2) => { camera.Hide(); e2.Cancel = true; };
     System.Windows.Threading.Dispatcher.Run();
       });
       thread.Name = "Camera";
       thread.SetApartmentState(ApartmentState.STA);
       thread.Start();
 }
コード例 #6
0
        void Kinect_Click(object sender, EventArgs e)
        {
            ToolStripMenuItem menu = sender as ToolStripMenuItem;

            WSRCamera.Display(menu.Text);
        }