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; } }; }
private void SendToSimulation(object sender, RoutedEventArgs e) { try { if (sendToSimulation) { SendButton.Content = "发送到仿真"; if (vectorSender != null) { vectorSender.stop(); vectorSender = null; } } else { SendButton.Content = "停止发送"; vectorSender = new VectorSender(); vectorSender.start(); } } catch (Exception ex) { LogUtil.log(ex.Message); } sendToSimulation = !sendToSimulation; }