コード例 #1
0
        private void webBrowser1_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
        {
            //WebClient client = new WebClient();
            //var bytes = client.DownloadData("description");
            //var stream = new System.IO.MemoryStream(bytes);

            //Image url = Image.FromStream(stream); // 1 способ

            Browser1.Navigate("url");
        }
コード例 #2
0
ファイル: MainWindow.xaml.cs プロジェクト: rthoreau/kinect
        /// <summary>
        /// Handles the body frame data arriving from the sensor and updates the associated gesture detector object for each body
        /// </summary>
        /// <param name="sender">object sending the event</param>
        /// <param name="e">event arguments</param>
        private void Reader_BodyFrameArrived(object sender, BodyFrameArrivedEventArgs e)
        {
            bool dataReceived = false;


            using (BodyFrame bodyFrame = e.FrameReference.AcquireFrame())
            {
                if (bodyFrame != null)
                {
                    if (this.bodies == null)
                    {
                        // creates an array of 6 bodies, which is the max number of bodies that Kinect can track simultaneously
                        this.bodies = new Body[bodyFrame.BodyCount];
                    }

                    // The first time GetAndRefreshBodyData is called, Kinect will allocate each Body in the array.
                    // As long as those body objects are not disposed and not set to null in the array,
                    // those body objects will be re-used.
                    bodyFrame.GetAndRefreshBodyData(this.bodies);
                    dataReceived = true;
                }
            }

            if (dataReceived)
            {
                // visualize the new body data
                int scene = this.kinectBodyView.UpdateBodyFrame(this.bodies);
                if (scene == 1)
                {
                    BrowserInit.Visibility = Visibility.Hidden;
                    BrowserInit.Navigate(new Uri("https://www.google.fr"));
                    finvideointro.Visibility = Visibility.Visible;
                }
                if (scene == 2)
                {
                    BrowserInit.Visibility = Visibility.Hidden;
                    BrowserInit.Navigate(new Uri("https://www.google.fr"));
                    actionmain.Visibility = Visibility.Visible;
                }
                if (scene == 3)
                {
                    if (videoPLayed == 0)
                    {
                        videoPLayed++;
                        actionmain.Visibility = Visibility.Hidden;
                        Browser1.Visibility   = Visibility.Visible;
                        //Browser1.Source = new Uri("https://www.youtube.com/");

                        Debug.Print("Astronaute");

                        this.Browser1.Navigate(new Uri("http://antoine.kairos-agency.com/kinect/"));
                    }
                }
                if (scene == 4 && videoDehors == 0)
                {
                    Debug.Print("Vidéo Finie");
                    Browser1.Visibility = Visibility.Hidden;
                    Browser1.Navigate(new Uri("https://www.google.fr"));
                    fondDecran2.Visibility = Visibility.Visible;
                    videoDehors++;
                }
                if (scene == 5 && quizz == 0)
                {
                    fondDecran2.Visibility = Visibility.Hidden;
                    quizzImage.Visibility  = Visibility.Visible;
                    quizz++;
                }

                // we may have lost/acquired bodies, so update the corresponding gesture detectors
                if (this.bodies != null)
                {
                    // loop through all bodies to see if any of the gesture detectors need to be updated
                    int maxBodies = this.kinectSensor.BodyFrameSource.BodyCount;
                    for (int i = 0; i < maxBodies; ++i)
                    {
                        Body  body       = this.bodies[i];
                        ulong trackingId = body.TrackingId;

                        // if the current body TrackingId changed, update the corresponding gesture detector with the new value
                        if (trackingId != this.gestureDetectorList[i].TrackingId)
                        {
                            this.gestureDetectorList[i].TrackingId = trackingId;

                            // if the current body is tracked, unpause its detector to get VisualGestureBuilderFrameArrived events
                            // if the current body is not tracked, pause its detector so we don't waste resources trying to get invalid gesture results
                            this.gestureDetectorList[i].IsPaused = trackingId == 0;
                        }
                    }
                }
            }
        }