public DataProducerPage() { InitializeComponent(); this.Loaded += (s, e) => { messageQueue = CommonDataMessageQueue.getInstance(GlobalVariable.messageQueueInterval); DiscoverKinectSensor(); this.drawingGroup = new DrawingGroup(); this.imageSource = new DrawingImage(this.drawingGroup); skeletonImageElement.Source = this.imageSource; }; this.Unloaded += (s, e) => { UninitializeKinectSensor(this.kinectSensor); this.kinectSensor = null; if (messageQueue != null) { messageQueue.release(); messageQueue = null; } if (vectorSender != null) { vectorSender.stop(); vectorSender = null; } }; }
public TrainingPage() { InitializeComponent(); this.Loaded += (s, e) => { this.timer.Elapsed += new ElapsedEventHandler(TimerCountDown); this.timer.Interval = 1000; //DataMessageQueue messageQueue = new ServerChannelDataMessageQueue(); DataMessageQueue messageQueue = CommonDataMessageQueue.getInstance(); this.consumer = new SkeletonDataComsumer(messageQueue, (vectors) => { Posture pos = new Posture(PostureType.Both, vectors); Dispatcher.Invoke(() => PostureDataReady(pos)); }); String[] trainingNames = service.getTrainingNames(0); foreach (String trainingName in trainingNames) { TrainingNameSelect.Items.Add(trainingName); } }; this.Unloaded += (s, e) => { timer.Dispose(); }; }
public GameTrainingPage() { InitializeComponent(); this.Loaded += (s, e) => { serverSocket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); IPAddress ip = IPAddress.Parse("127.0.0.1"); EndPoint endPoint = new IPEndPoint(ip, 6000); serverSocket.Bind(endPoint); serverSocket.Listen(1); //DataMessageQueue messageQueue = new ServerChannelDataMessageQueue(); DataMessageQueue messageQueue = CommonDataMessageQueue.getInstance(); this.consumer = new SkeletonDataComsumer(messageQueue, (vectors) => { Posture pos = new Posture(PostureType.Both, vectors); Dispatcher.Invoke(() => PostureDataReady(pos)); }); }; this.Unloaded += (s, e) => { if (socket != null) { socket.Close(); } if (serverSocket != null) { serverSocket.Close(); } if (consumer != null) { consumer.stop(); } }; }
public ActionTrainingPage() { InitializeComponent(); this.Loaded += (s, e) => { this.timer.Elapsed += new ElapsedEventHandler(TimerCountDown); this.timer.Interval = 1000; //DataMessageQueue messageQueue = new ServerChannelDataMessageQueue(); DataMessageQueue messageQueue = CommonDataMessageQueue.getInstance(); this.consumer = new SkeletonDataComsumer(messageQueue, (vectors) => { Dispatcher.Invoke(() => VectorDataReady(vectors)); }); this.player = new ActionImgPlayer(img => { Dispatcher.Invoke(() => this.targetImageElement.Source = img); }); }; this.Unloaded += (s, e) => { timer.Dispose(); }; }