/// <summary> /// Execute startup tasks /// </summary> /// <param name="sender">object sending the event</param> /// <param name="e">event arguments</param> private void WindowLoaded(object sender, RoutedEventArgs e) { // Create the drawing group we'll use for drawing _drawingGroup = new DrawingGroup(); currLang = ""; // Create an image source that we can use in our image control _imageSource = new DrawingImage(_drawingGroup); DataContext = this; _3dviewIsAktive = false; _ifSkeletonisBuild = false; pointAndControlMain = Initializer.InitializeIgs(); logger = pointAndControlMain.logger; fillFieldsGUI(); this.coordinateMapper = pointAndControlMain.Tracker.Sensor.CoordinateMapper; pointAndControlMain.devInit = true; _sensor = pointAndControlMain.Tracker.Sensor; if (_sensor != null) { this.multiFrameReader = pointAndControlMain.Tracker.Sensor.OpenMultiSourceFrameReader(FrameSourceTypes.Color | FrameSourceTypes.Body); this.multiFrameReader.MultiSourceFrameArrived += this.Reader_MultiSourceFrameArrived; } FrameDescription ColorframeDescription = pointAndControlMain.Tracker.Sensor.ColorFrameSource.FrameDescription; // allocate space to put the pixels being received this.pixels = new byte[ColorframeDescription.Width * ColorframeDescription.Height * this.bytesPerPixel]; // create the bitmap to display this.bitmap = new WriteableBitmap(ColorframeDescription.Width, ColorframeDescription.Height, 96.0, 96.0, PixelFormats.Bgr32, null); // query frame description for skeleton display FrameDescription depthFrameDescription = pointAndControlMain.Tracker.Sensor.DepthFrameSource.FrameDescription; this.displayWidth = depthFrameDescription.Width; this.displayHeight = depthFrameDescription.Height; this.imageSourceSkeleton = new DrawingImage(this._drawingGroup); }
public async void igsStart() { await Task.Run(() => { try { pncMain = Initializer.InitializeIgs(); pncRunning = true; while (pncMain.isRunning) { cancellationToken.ThrowIfCancellationRequested(); } } catch (OperationCanceledException) { pncMain.shutDown(); pncRunning = false; } }); pncRunning = false; Environment.Exit(1); }