none
HELP trying to open the mainwindow.xaml from a WINDOWS FORM! RRS feed

  • Question

  • Hello!!

    i've been working with kinect code for a couple of weeks and i haven't been able to call the mainwindow.xaml with a buttom from the main windows form.

    the thing is i have a main aplication (WPF) and when i press a buttom i want to be able to see the color camare of the kinect to watch what kinect's scope. 

    is that posible?

    i created  a Usercontrol element with this code

     

        private void Window_Loaded(object sender, RoutedEventArgs e)

            {

                SetupKinect();

            }

     

     

             private void SetupKinect()

            {

                if (Runtime.Kinects.Count == 0)

                {

                    this.Title = "No Kinect connected";

                }

                else

                {

                    //use first Kinect

                    nui = Runtime.Kinects[0];

     

                    //UseDepthAndPlayerIndex and UseSkeletalTracking

                    nui.Initialize(RuntimeOptions.UseColor);

     

                    //register for event

                    nui.VideoFrameReady += new EventHandler<ImageFrameReadyEventArgs>(nui_VideoFrameReady);

                    //DepthAndPlayerIndex ImageType

                    nui.VideoStream.Open(ImageStreamType.Video, 2, ImageResolution.Resolution640x480, ImageType.Color);

                }

            }

     

             void nui_VideoFrameReady(object sender, ImageFrameReadyEventArgs e)

             {

                 //Manually create BitmapSource for Video

                 PlanarImage imageData = e.ImageFrame.Image;

                 image1.Source = BitmapSource.Create(imageData.Width, imageData.Height, 96, 96, PixelFormats.Bgr32, null, imageData.Bits, imageData.Width * imageData.BytesPerPixel);

             }

     

    the code i did for the buttom click event is 

    userControl control =  new usercontrol();

    control.OnLoad();

     

    it doesnt work, is there a way i can make this work? open the color camara from a WFP app? 

    thanks!!

    Tuesday, December 27, 2011 3:03 PM

All replies

  • nobody has any idea how to do this? 

    i have a proyect already made and i want to add the kinect camara into it

    thankss

    Tuesday, December 27, 2011 7:46 PM