private void Kinects_StatusChanged(object sender, StatusChangedEventArgs e)
 {
     switch (e.Status)
     {
         case KinectStatus.Connected:
             var foundViewer = FindViewer(e.KinectRuntime);
             if (foundViewer != null)
             {
                 foundViewer.Kinect = e.KinectRuntime; //will cause a uninit, init
             }
             else if (viewerHolder.Items.Count < maxKinectCount)
             {
                 AddKinectViewer(e.KinectRuntime);
             }
             break;
         case KinectStatus.Disconnected:
             if (Runtime.Kinects.Count >= maxKinectCount)
             {
                 UpdateRuntimeOfKinectViewerToNextKinect(e.KinectRuntime);
             }
             else
             {
                 RemoveKinectViewer(e.KinectRuntime);
             }
             break;
         default:
             if (e.Status.HasFlag(KinectStatus.Error))
             {
                 DisableOrAddKinectViewer(e.KinectRuntime);
             }
             break;
     }
     UpdateUIBasedOnKinectCount();
 }
Beispiel #2
0
 void KinectSensorsStatusChanged(object sender, StatusChangedEventArgs e)
 {
     switch (e.Status)
     {
         case KinectStatus.Disconnected:
             if (_kinectSensor == e.Sensor)
             {
                 Clean();
                 Message = "Kinect disconnected";
             }
             break;
         case KinectStatus.Connected:
             _kinectSensor = e.Sensor;
             Initialize();
             break;
         case KinectStatus.NotPowered:
             Message = "Kinect is not powered";
             Clean();
             break;
         case KinectStatus.NotReady:
             Message = "Kinect is not ready";
             break;
         case KinectStatus.Initializing:
             Message = "Initializing";
             break;
         default:
             Message = string.Concat("Status: ", e.Status);
             break;
     }
 }
Beispiel #3
0
 void Kinects_StatusChanged(object sender, StatusChangedEventArgs e)
 {
     switch (e.Status)
     {
         case KinectStatus.Connected:
             if (kinectSensor == null)
             {
                 kinectSensor = e.Sensor;
                 Initialize();
             }
             break;
         case KinectStatus.Disconnected:
             if (kinectSensor == e.Sensor)
             {
                 Clean();
                 MessageBox.Show("Kinect was disconnected");
             }
             break;
         case KinectStatus.NotReady:
             break;
         case KinectStatus.NotPowered:
             if (kinectSensor == e.Sensor)
             {
                 Clean();
                 MessageBox.Show("Kinect is no more powered");
             }
             break;
         default:
             MessageBox.Show("Unhandled Status: " + e.Status);
             break;
     }
 }
Beispiel #4
0
        private void KinectSensors_StatusChanged(object sender, StatusChangedEventArgs e)
        {
            switch (e.Status)
            {
                case KinectStatus.Connected:
                    if (this.Kinect == null)
                    {
                        this.Kinect = e.Sensor;
                    }
                    break;

                case KinectStatus.Disconnected:
                    if (this.Kinect == e.Sensor)
                    {
                        this.Kinect = null;
                        this.Kinect = KinectSensor.KinectSensors
                                      .FirstOrDefault(x => x.Status == KinectStatus.Connected);

                        if (this.Kinect == null)
                        {
                            MessageBox.Show("This application requires a Kinect sensor");
                            this.Close();
                        }
                    }
                    break;

                //Handle all other statuses according to needs 
            }
        }
 /// <summary>
 /// Handles the StatusChanged event of the KinectSensors control.
 /// </summary>
 /// <param name="sender">The source of the event.</param>
 /// <param name="e">The <see cref="Microsoft.Kinect.StatusChangedEventArgs"/> instance containing the event data.</param>
 void KinectSensors_StatusChanged(object sender, StatusChangedEventArgs e)
 {
     if (e.Status == KinectStatus.Connected)
     {
         //OpenKinect(e.Sensor);
     }
 }
Beispiel #6
0
 private void OnKinectStatusChanged(object sender, StatusChangedEventArgs e)
 {
     switch (e.Status)
     {
         case KinectStatus.Connected:
             if (Kinect == null)
             {
                 Kinect = e.KinectRuntime;
                 Setup();
             }
             break;
         case KinectStatus.Disconnected:
             if (Kinect == e.KinectRuntime)
             {
                 Uninitialize();
                 MessageBox.Show("Kinect was disconnected.");
             }
             break;
         case KinectStatus.NotReady:
             break;
         default:
             MessageBox.Show("Unhandled Status: " + e.Status);
             break;
     }
 }
		void HandleServiceStatusChanged (object sender, StatusChangedEventArgs e)
		{
			// handle when the service has finished being added
			if (e.WasAdded) {
				ExpandFirstOrUnconfiguredSection ();
			}
		}
        /// <summary>
        /// Kinectの接続状態が変わった時に呼び出される
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void KinectSensors_StatusChanged( object sender, StatusChangedEventArgs e )
        {
            // デバイスが接続された
              if ( e.Status == KinectStatus.Connected ) {
            Start( e );
              }
              // デバイスが切断された
              else if ( e.Status == KinectStatus.Disconnected ) {
            Stop( e );
              }
              // ACが抜けてる
              else if ( e.Status == KinectStatus.NotPowered ) {
            Stop( e );

            MessageBox.Show( "電源ケーブルを接続してください" );
              }
              // Kinect for Xbox 360
              else if ( e.Status == KinectStatus.DeviceNotSupported ) {
            MessageBox.Show( "Kinect for Xbox 360 はサポートされません" );
              }
              // USBの帯域が足りない
              else if ( e.Status == KinectStatus.InsufficientBandwidth ) {
            MessageBox.Show( "USBの帯域が足りません" );
              }
        }
Beispiel #9
0
        private void KinectSensors_StatusChanged(object sender, StatusChangedEventArgs e)
        {
            switch (e.Status)
            {
                case KinectStatus.Connected:
                    if (this.Kinect == null)
                    {
                        this.Kinect = e.Sensor;
                    }
                    break;

                case KinectStatus.Disconnected:
                    if (this.Kinect == e.Sensor)
                    {
                        this.Kinect = null;
                        this.Kinect = KinectSensor.KinectSensors
                                      .FirstOrDefault(x => x.Status == KinectStatus.Connected);

                        if (this.Kinect == null)
                        {
                            //Notify the user that the sensor is disconnected 
                        }
                    }
                    break;

                //Handle all other statuses according to needs 
            }
        }
 /// <summary>
 /// A Debug function that gets called whenever the Kinect's state change. Since a state change 
 /// is usually a bad thing, this event handler will mainly print out diagnostic data.
 /// </summary>
 /// <param name="sender">The sending object</param>
 /// <param name="e">Contains data on the sensor</param>
 protected void KinectStatusChange(object sender, StatusChangedEventArgs e)
 {
     Console.WriteLine("[Client] Kinect's status changed!");
     Console.WriteLine("[Client] Kinect is running: {0}", e.Sensor.IsRunning);
     Console.WriteLine("[Client] Kinect Skeletal stream is enabled: {0}", e.Sensor.SkeletonStream.IsEnabled);
     Console.WriteLine("[Client] Kinect status: {0}", e.Sensor.Status);
     Console.WriteLine("[Client] Kinect device connection ID: {0}", e.Sensor.DeviceConnectionId);
 }
Beispiel #11
0
 /// <summary>
 /// Listens to status changes.
 /// Updates statuses as they change
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void Sensor_StatusChanged(object sender, StatusChangedEventArgs e)
 {
     deviceStatusArgs.CurrentStatus = GetStatus(e.Status);
     deviceStatusArgs.OriginalDeviceStatus = e.Status.ToString();
     Device_StatusChanged(deviceStatusArgs);
     sensor = null; // Because the Kinect SDK bugs when the Kinect is unplugged and plugged back in
                    // it is important to set the sensor to null so that a new instance is created in the Record method
                    // The bug message is "The Kinect is not ready" if the sensor's instance stays the same after it is plugged back 
 }
Beispiel #12
0
        void KinectSensors_StatusChanged(object sender, StatusChangedEventArgs e)
        {
            if (kinectError != null)
            {
                MainWindow.animateSlide(kinectError, true, true);

                if (initialisingSpinner != null)
                {
                    MainWindow.animateSlide(initialisingSpinner, true, true);
                    initialisingSpinner = null;
                }
            }

            if (e.Status == KinectStatus.Connected)
            {
                MainWindow.restartMoto();
            }
            else
            {
                MainWindow.animateFade(imgDimmer, 0, 0.5);

                kinectError = MainWindow.generateError(e.Status);
                MainCanvas.Children.Add(kinectError);
                MainWindow.animateSlide(kinectError);

                if (e.Status == KinectStatus.Initializing)
                {
                    //Spinny, turny progress animation
                    initialisingSpinner = new Image();
                    initialisingSpinner.Source = new BitmapImage(new Uri(
            "/Moto;component/images/loading.png", UriKind.Relative));
                    MainCanvas.Children.Add(initialisingSpinner);
                    initialisingSpinner.Width = 150;
                    initialisingSpinner.Height = 150;
                    MainWindow.animateSlide(initialisingSpinner);
                    MainWindow.animateSpin(initialisingSpinner);
                    Canvas.SetTop(initialisingSpinner, 230);

                    Canvas.SetLeft(initialisingSpinner, (MainCanvas.ActualWidth / 2) - (initialisingSpinner.Width / 2));
                    //Add a "Moto will restart soon" message
                    restartMsg = new Image();
                    restartMsg.Source = new BitmapImage(new Uri(
            "/Moto;component/images/kinect-fault/restart.png", UriKind.Relative));
                    MainCanvas.Children.Add(restartMsg);
                    restartMsg.Width = 465;
                    restartMsg.Height = 37;
                    MainWindow.animateSlide(restartMsg);
                    Canvas.SetTop(restartMsg, 200);
                    Canvas.SetLeft(restartMsg, (MainCanvas.ActualWidth / 2) - (restartMsg.Width / 2));
                }
                else if (e.Status == KinectStatus.Disconnected)
                {
                    MainWindow.stopKinect(MainWindow.sensor);
                }
            }
        }
Beispiel #13
0
 //Statusfarbe "Kinect angeschlossen"=blau Fehler=rot "Initialisieren"=schwarz
 void KinectSensors_StatusChanged(object sender, StatusChangedEventArgs e)
 {
     if (StatusGerman(e.Status.ToString()) == "Initialisieren...")
         this.ViewModel.SensorColor = "Black";
     else if(StatusGerman(e.Status.ToString()) != "Kinect angeschlossen")
         this.ViewModel.SensorColor = "Red";
     else
         this.ViewModel.SensorColor  = "Green";
     this.ViewModel.SensorStatus = StatusGerman(e.Status.ToString());
     //this.ViewModel.SensorStatus = e.Status.ToString();
 }
Beispiel #14
0
 void KinectSensors_StatusChanged(object sender, StatusChangedEventArgs e)
 {
     if (kinectSensor == e.Sensor)
     {
         if (e.Status == KinectStatus.Disconnected || e.Status == KinectStatus.NotPowered)
         {
             kinectSensor = null;
             DiscoverKinectSensor();
         }
     }
 }
Beispiel #15
0
 private void OnStatusChangedHandler(StatusChangedEventArgs args)
 {
     if (args.Status == MediaPlayerStatus.Buffering)
     {
         CancelBufferingTask();
         StartBufferingSchedule();
     }
     if (args.Status == MediaPlayerStatus.Stopped || args.Status == MediaPlayerStatus.Failed)
     {
         CancelBufferingTask();
     }
 }
        void geolocator_StatusChanged(Geolocator sender, StatusChangedEventArgs args)
        {
            string status = "";

            switch (args.Status)
            {
            case PositionStatus.Disabled:
                // the application does not have the right capability or the location master switch is off
                status = "Location is disabled in phone settings. Please turn it on";
                MessageBox.Show(status);
                break;

            case PositionStatus.Initializing:
                // the geolocator started the tracking operation
                status = "1";

                break;

            case PositionStatus.NoData:
                // the location service was not able to acquire the location
                status = "no data";
                break;

            case PositionStatus.Ready:
                // the location service is generating geopositions as specified by the tracking parameters
                status = "2";

                break;

            case PositionStatus.NotAvailable:
                status = "not available";
                // not used in WindowsPhone, Windows desktop uses this value to signal that there is no hardware capable to acquire location information
                break;

            case PositionStatus.NotInitialized:
                // the initial state of the geolocator, once the tracking operation is stopped by the user the geolocator moves back to this state

                break;
            }
            /*This part write the status to the UI element StatusTextBlock*/
            Dispatcher.BeginInvoke(() =>
            {
                //StatusTextBlock.Text = status;
                if (status == "1")
                {
                    telerikLoading.IsRunning = true;
                }
                if (status == "2")
                {
                    telerikLoading.IsRunning = false;
                }
            });
        }
 private void OnStatusChangedHandler(StatusChangedEventArgs args)
 {
     if (args.Status == MediaPlayerStatus.Buffering)
     {
         CancelBufferingTask();
         Task.Run(() => OnBuffering(), _onBufferingCancellationSource.Token);
     }
     if (args.Status == MediaPlayerStatus.Stopped || args.Status == MediaPlayerStatus.Failed)
     {
         CancelBufferingTask();
     }
 }
Beispiel #18
0
 /// <summary>
 /// Kinectの動作を開始する
 /// </summary>
 /// <param name="e"></param>
 private void Start(StatusChangedEventArgs e)
 {
     for (int i = 0; i < kinectWindows.Length; i++)
     {
         if (kinectWindows[i].Kinect == null)
         {
             kinectWindows[i].StartKinect(e.Sensor);
             comboBoxSkeleton.Items.Add(i.ToString());
             break;
         }
     }
 }
Beispiel #19
0
        private async void OnStatusChanged(object sender, StatusChangedEventArgs e)
        {
            //if (expandableView.IsExpanded)
            //{
            //    await arrow.RotateTo(180, 200, Easing.CubicInOut);
            //}

            //if (!expandableView.IsExpanded)
            //{
            //    await arrow.RotateTo(0, 200, Easing.CubicInOut);
            //}
        }
        private async void geolocator_StatusChanged(Geolocator sender, StatusChangedEventArgs args)
        {
            if (args.Status == PositionStatus.Ready)
            {
                geolocator.DesiredAccuracy         = PositionAccuracy.High;
                geolocator.DesiredAccuracyInMeters = 100;
                var location = await geolocator.GetGeopositionAsync();

                map.Center = new Bing.Maps.Location(location.Coordinate.Point.Position.Latitude,
                                                    location.Coordinate.Point.Position.Longitude);
            }
        }
Beispiel #21
0
 /// <summary>
 /// Kinectの動作を停止する
 /// </summary>
 /// <param name="e"></param>
 private void Stop(StatusChangedEventArgs e)
 {
     for (int i = 0; i < kinectWindows.Length; i++)
     {
         if (kinectWindows[i].Kinect == e.Sensor)
         {
             kinectWindows[i].StopKinect();
             comboBoxSkeleton.Items.Remove(i.ToString());
             break;
         }
     }
 }
 private void Map_StatusChanged(object sender, StatusChangedEventArgs e)
 {
     try
     {
         System.Diagnostics.Debug.Print($"Latitude:{e.Latitude}  Longitude:{e.Longitude}");
         //await _locationService?.UpdateCenter(map);
     }
     catch (Exception ex)
     {
         Crashes.TrackError(ex);
     }
 }
Beispiel #23
0
        private void Debugger_StatusChanged(object sender, StatusChangedEventArgs e)
        {
            var status = e.NewStatus;

            _dispatcher.InvokeAsync(() => {
                Status = status;
                if (Status == DEBUG_STATUS.NO_DEBUGGEE)
                {
                    _dispatcher.InvokeAsync(() => Processes.Clear());
                }
            });
        }
 /// <summary>
 /// Detecta cuando se conecta o desconecta un sensor kinect. Lanza una busqueda si es necesario.
 /// Se emplea un eventHandler para lanzar la actualizacion, que se dirige con StatusChangedEventArgs
 /// </summary>
 void KinectSensors_StatusChanged(object sender, StatusChangedEventArgs e)
 {
     if (this.kinectSensor == e.Sensor)
     {
         if (e.Status == KinectStatus.Disconnected ||
             e.Status == KinectStatus.NotPowered)
         {
             this.kinectSensor = null;
             this.DiscoverKinectSensor();
         }
     }
 }
        private void CurrentOnStatusChanged(object sender, StatusChangedEventArgs statusChangedEventArgs)
        {
            Device.BeginInvokeOnMainThread(async() =>
            {
                var status = statusChangedEventArgs.Status;
                switch (status)
                {
                case MediaPlayerStatus.Stopped:
                    pause.IsEnabled  = false;
                    stop.IsEnabled   = false;
                    StatusLabel.Text = "Stopped";
                    await StatusLabel.FadeTo(1);
                    break;

                case MediaPlayerStatus.Paused:
                    pause.IsEnabled  = true;
                    stop.IsEnabled   = true;
                    StatusLabel.Text = "Paused";
                    await StatusLabel.FadeTo(1);
                    break;

                case MediaPlayerStatus.Playing:
                    pause.IsEnabled = true;
                    stop.IsEnabled  = true;
                    await StatusLabel.FadeTo(0);
                    break;

                case MediaPlayerStatus.Loading:
                    pause.IsEnabled  = false;
                    stop.IsEnabled   = false;
                    StatusLabel.Text = "Loading";
                    await StatusLabel.FadeTo(1);
                    break;

                case MediaPlayerStatus.Buffering:
                    pause.IsEnabled  = false;
                    stop.IsEnabled   = true;
                    StatusLabel.Text = "Buffering";
                    await StatusLabel.FadeTo(1);
                    break;

                case MediaPlayerStatus.Failed:
                    pause.IsEnabled  = false;
                    stop.IsEnabled   = false;
                    StatusLabel.Text = "Failed";
                    await StatusLabel.FadeTo(1);
                    break;

                default:
                    throw new ArgumentOutOfRangeException();
                }
            });
        }
 private void OnPlayingHandler(StatusChangedEventArgs args)
 {
     if (args.Status == MediaPlayerStatus.Playing)
     {
         CancelPlayingHandler();
         StartPlayingHandler();
     }
     if (args.Status == MediaPlayerStatus.Stopped || args.Status == MediaPlayerStatus.Failed || args.Status == MediaPlayerStatus.Paused)
     {
         CancelPlayingHandler();
     }
 }
Beispiel #27
0
        // The StatusChanged event is raised when the status of the location service changes.
        void geolocator_StatusChanged(Geolocator sender, StatusChangedEventArgs args)
        {
            string status = "";

            switch (args.Status)
            {
            case PositionStatus.Ready:
                // Location data is available.
                status = " ready";
                break;

            case PositionStatus.Initializing:
                // The location provider is initializing. This is the status if a GPS is the source of location data and
                // the GPS receiver does not yet have the required number of satellites in view to obtain an accurate position.
                status = " initializing";
                break;

            case PositionStatus.NoData:
                // No location data is available from any location provider. LocationStatus will have this value if the
                // application calls GetGeopositionAsync or registers an event handler for the PositionChanged event, before data
                // is available from a location sensor. Once data is available LocationStatus transitions to the Ready state.
                status = " no data";
                break;

            case PositionStatus.Disabled:
                // The location provider is disabled. This status indicates that the user has not granted the
                // application permission to access location.
                status = " location is disabled in phone settings";
                break;

            case PositionStatus.NotInitialized:
                // An operation to retrieve location has not yet been initialized. LocationStatus will have this value if the
                // application has not yet called GetGeopositionAsync or registered an event handler for the PositionChanged event.
                break;

            case PositionStatus.NotAvailable:
                status = " not available";
                // Not used in WindowsPhone, Windows desktop uses this value to signal that there is no hardware capable to
                // acquire location information.
                break;
            }

            if (!App.RunningInBackground)
            {
                Dispatcher.BeginInvoke(() =>
                {
                    StatusTextBlock.Text = status;
                });
            }

            Debug.WriteLine(String.Format("{0:d/M/yy h:mm:ss tt} ", DateTime.Now) + "statusChanged:" + status);
        }
        void buildQueue_StatusChanged(object sender, StatusChangedEventArgs e)
        {
            // We have to explicitly check to see if the build has changed.
            if (e.Changed && buildQueue.QueuedBuilds.Length > 0)
            {
                // Get the last item (TFS sorts them as we need)
                int lastItem = buildQueue.QueuedBuilds.Length - 1;

                // In the session, we showed the results of the last build for the team project.
                // here you may want to filter
                UpdateStatus(buildQueue.QueuedBuilds[lastItem]);
            }
        }
Beispiel #29
0
    /// <summary>
    /// This wires up the status changed event to monitor for
    /// Kinect state changes.  It automatically stops the sensor
    /// if the device is no longer available.
    /// </summary>
    /// <param name="sender">The sending object.</param>
    /// <param name="e">The event args.</param>
    private void KinectSensors_StatusChanged(object sender, StatusChangedEventArgs e)
    {
        // If the status is not connected, try to stop it
        (Game as Neat.NeatGame).Console.WriteLine("Kinect status changed to: " + statusMap[e.Status]);
        if (e.Status != KinectStatus.Connected)
        {
            e.Sensor.Stop();
            (Game as Neat.NeatGame).Console.WriteLine("Kinect stopped.");
        }

        this.LastStatus = e.Status;
        this.DiscoverSensor();
    }
        private void Kinects_StatusChanged(object sender, StatusChangedEventArgs e)
        {
            if (e.Status == KinectStatus.Connected)
            {
                InitializeKinect(e.KinectRuntime);

                var foundViewer = this.kinectColorViewer;
                if (foundViewer != null)
                {
                    foundViewer.Kinect = e.KinectRuntime;
                }
            }
        }
Beispiel #31
0
 private void UpdateExecutionStatus(StatusChangedEventArgs e)
 {
     status_RichTextBox.InvokeIfRequired(c =>
     {
         ExecutionServices.SystemTrace.LogInfo(e.StatusMessage);
         _logText.Clear();
         _logText.Append(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff"));
         _logText.Append("  ");
         _logText.AppendLine(e.StatusMessage);
         status_RichTextBox.AppendText(_logText.ToString());
         status_RichTextBox.Refresh();
     });
 }
Beispiel #32
0
        void KinectSensors_StatusChanged(object sender, StatusChangedEventArgs e)
        {
            switch (e.Status)
            {
            case KinectStatus.Undefined:
            case KinectStatus.Disconnected:
                break;

            case KinectStatus.Connected:
                InitKinect(e.Sensor, new KinectChangedEventArgs(null, e.Sensor));
                break;
            }
        }
 public void KinectSensorsStatusChanged(object sender, StatusChangedEventArgs e)
 {
     try
     {
         KServerPaquet sp = new KServerMessagePaquet(200, "1||" + (byte)e.Status);
         sp.send(ns);
     }
     catch (Exception exc)
     {
         System.Console.WriteLine("event statusChanged disconnected : " + exc.Message);
         sensors.StatusChanged -= KinectSensorsStatusChanged;
     }
 }
Beispiel #34
0
        private void Debugger_StatusChanged(object sender, StatusChangedEventArgs e)
        {
            InvokeAsync(() => {
                if (e.NewStatus == _status)
                {
                    return;
                }

                _status = e.NewStatus;
                UpdateCommands();
                RunRecentExecutableCommand.RaiseCanExecuteChanged();
            });
        }
        /// <summary>
        /// Handles the StatusChanged event of the KinectSensors control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="Microsoft.Kinect.StatusChangedEventArgs"/> instance containing the event data.</param>
        void KinectSensors_StatusChanged(object sender, StatusChangedEventArgs e)
        {
            this.Title = e.Status.ToString();
            if (e.Status == KinectStatus.Connected)
            {
                this.StartKinect();
            }
            else
            {
                this.StopKinect();
            }

        }
Beispiel #36
0
        static void _core_StatusChanged(object sender, StatusChangedEventArgs e)
        {
            if (e.StatusText != "Downloading")
            {
                return;
            }

            if (!Completed)
            {
                openUpdater = true;
                Completed   = true;
            }
        }
 public void KinectSensorsStatusChanged(object sender, StatusChangedEventArgs e)
 {
     try
     {
         KServerPaquet sp = new KServerMessagePaquet(200, "1||" + (byte)e.Status);
         sp.send(ns);
     }
     catch (Exception exc)
     {
         System.Console.WriteLine("event statusChanged disconnected : " + exc.Message);
         sensors.StatusChanged -= KinectSensorsStatusChanged;
     }
 }
Beispiel #38
0
 // Custom Event Handler for a change in KinectSensor status
 private void KinectStatusChanged(object sender, StatusChangedEventArgs e)
 {
     // If a new KinectSensor is connected, set is as our currrent Kinect
     if (e.Sensor != null && e.Status == KinectStatus.Connected)
     {
         SetNewKinect(e.Sensor);
     }
     // If the current Kinect changes it's status, disconnect the current Kinect
     if (e.Sensor == this.Kinect)
     {
         SetNewKinect(null);
     }
 }
Beispiel #39
0
 private void Geolocator_StatusChanged(Geolocator sender, StatusChangedEventArgs args)
 {
     if (args.Status == PositionStatus.Ready)
     {
         m_geolocator   = sender;
         App.GeoLocator = sender;
         Deployment.Current.Dispatcher.BeginInvoke(async() =>
         {
             Geoposition pos   = await m_geolocator.GetGeopositionAsync(TimeSpan.FromMinutes(1), TimeSpan.FromSeconds(10));
             m_currentPosition = pos;
         });
     }
 }
        void geolocator_StatusChanged(Geolocator sender, StatusChangedEventArgs args)
        {
            string status        = "";
            bool   isShowLoading = false;
            int    time          = 0;

            switch (args.Status)
            {
            case PositionStatus.Disabled:
                // the application does not have the right capability or the location master switch is off
                status = "location is disabled in phone settings";
                time   = 2000;
                break;

            case PositionStatus.Initializing:
                // the geolocator started the tracking operation
                status        = "initializing...";
                isShowLoading = true;
                break;

            case PositionStatus.NoData:
                // the location service was not able to acquire the location
                status = "no data";
                time   = 2000;
                break;

            case PositionStatus.Ready:
                // the location service is generating geopositions as specified by the tracking parameters
                status = "ready";
                time   = 2000;
                break;

            case PositionStatus.NotAvailable:
                status = "not available";
                time   = 2000;
                // not used in WindowsPhone, Windows desktop uses this value to signal that there is no hardware capable to acquire location information
                break;

            case PositionStatus.NotInitialized:
                // the initial state of the geolocator, once the tracking operation is stopped by the user the geolocator moves back to this state
                status = "Geo Locator not initialized";
                time   = 2000;
                break;
            }

            Dispatcher.BeginInvoke(() =>
            {
                //StatusTextBlock.Text = status;
                StaticMethod.ShowProgress(this, status, time, isShowLoading, true);
            });
        }
Beispiel #41
0
        /// <summary>
        /// Event handler for StatusChanged events. It is raised when the
        /// location status in the system changes.
        /// </summary>
        /// <param name="sender">Geolocator instance</param>
        /// <param name="e">Statu data</param>
        async private void OnStatusChanged(Geolocator sender, StatusChangedEventArgs e)
        {
            await CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
            {
                GeolocationPin.Status = e.Status;
                switch (e.Status)
                {
                case PositionStatus.Ready:
                    // Location platform is providing valid data.
                    ShowStatus();
                    break;

                case PositionStatus.Initializing:
                    // Location platform is attempting to acquire a fix.
                    ShowStatus("Initializing");
                    break;

                case PositionStatus.NoData:
                    // Location platform could not obtain location data.
                    ShowStatus("No data");
                    break;

                case PositionStatus.Disabled:
                    // The permission to access location data is denied by the user or other policies.
                    ShowStatus("Disabled");

                    // Show message to the user to go to location settings
                    //LocationDisabledMessage.Visibility = Visibility.Visible;

                    // Clear cached location data if any
                    CurrentPosition = null;
                    break;

                case PositionStatus.NotInitialized:
                    // The location platform is not initialized. This indicates that the application
                    // has not made a request for location data.
                    ShowStatus("Not initialized");
                    break;

                case PositionStatus.NotAvailable:
                    // The location platform is not available on this version of the OS.
                    ShowStatus("Not available");
                    break;

                default:
                    ShowStatus("Unknown");
                    GeolocationPin.Status = PositionStatus.NoData;
                    break;
                }
            });
        }
Beispiel #42
0
 private void KinectSensorsOnStatusChanged(object sender, StatusChangedEventArgs e)
 {
     if (e != null)
     {
         if (this.StatusCallback != null)
         {
             this.StatusCallback(e);
         }
         if ((e.Sensor == this.Kinect) || (this.Kinect == null))
         {
             GetSensorProcess(null);
         }
     }
 }
Beispiel #43
0
        /// <summary>
        /// Event handler for status change. It prints out notifications.
        /// </summary>
        /// <param name="e">the event args that contains the data of this event.</param>
        public void OnStatusChanged(object sender, StatusChangedEventArgs e)
        {
            QuoteProviderStatus previous = e.Old;
            QuoteProviderStatus current  = e.New;

            if (previous != QuoteProviderStatus.Inactive && current == QuoteProviderStatus.Open)
            {
                Console.WriteLine("Attempting to reopen resource...");
            }
            else if ((previous == QuoteProviderStatus.Open || previous == QuoteProviderStatus.Authenticate) && current == QuoteProviderStatus.Read)
            {
                Console.WriteLine("Resource opened successfully.\n");
            }
        }
        private void GeolocatorOnStatusChanged(Geolocator sender, StatusChangedEventArgs args)
        {
            var handler = LocationStatusChanged;

            if (handler != null)
            {
                MvxMainThreadDispatcher.Instance.RequestMainThreadAction(
                    () => handler(this, new LocationStatusChangedEventArgs()
                {
                    Status = args.Status.ToLocationStatus()
                })
                    );
            }
        }
Beispiel #45
0
 private void OnMiraStatuschanged(object sender, StatusChangedEventArgs e)
 {
     m_MiraOutput.Invoke((MethodInvoker) delegate
     {
         if (e.Percent == null)
         {
             m_MiraOutput.AppendText($"[{DateTime.Now}] {e.Message} {Environment.NewLine}");
         }
         else
         {
             m_MiraOutput.AppendText($"[{DateTime.Now}] [{e.Percent}/100] {e.Message} {Environment.NewLine}");
         }
     });
 }
        private void OnStatusChanged(Object p_sender, EventArgs p_event)
        {
            StatusChangedEventArgs statusChangedEventArgs = (StatusChangedEventArgs)p_event;

            if (m_owner == p_sender && statusChangedEventArgs.Type == StatusChangedEventArgs.EChangeType.HEALTH_POINTS)
            {
                m_owner.Die();
                m_owner.TriggerLateDieEffects();
                foreach (Character character in LegacyLogic.Instance.WorldManager.Party.Members)
                {
                    character.FlushRewardsActionLog();
                }
            }
        }
Beispiel #47
0
        //public void StartWatcher()
        //{
        //    try
        //    {
        //      var settings = SettingService.GetSettings();
        //      if (settings.AllowGps)
        //        {
        //            Instance.Start();
        //        }
        //        else
        //            Instance.Stop();
        //    }
        //    catch { }
        //}

        //public void StopWatcher()
        //{
        //    try
        //    {
        //        Instance.Stop();
        //    }
        //    catch { }
        //}



        void _instance_StatusChanged(Geolocator sender, StatusChangedEventArgs args)
        {
            bool isBusy = false;

            switch (args.Status)
            {
            case PositionStatus.Disabled:
                //TODO
                // The Location Service is disabled or unsupported.
                // Check to see whether the user has disabled the Location Service.
                //if (Instance.Permission == GeoPositionPermission.Denied)
                //{
                //    // The user has disabled the Location Service on their device.
                //    //statusTextBlock.Text = "you have this application access to location.";
                //}
                //else
                //{
                //    //statusTextBlock.Text = "location is not functioning on this device";
                //}


                break;

            case PositionStatus.Initializing:
                // The Location Service is initializing.
                // Disable the Start Location button.
                //startLocationButton.IsEnabled = false;

                isBusy = true;

                break;

            case PositionStatus.NoData:
                // The Location Service is working, but it cannot get location data.
                // Alert the user and enable the Stop Location button.
                //statusTextBlock.Text = "location data is not available.";
                //stopLocationButton.IsEnabled = true;
                break;

            case PositionStatus.Ready:
                // The Location Service is working and is receiving location data.
                // Show the current position and enable the Stop Location button.
                //statusTextBlock.Text = "location data is available.";
                //stopLocationButton.IsEnabled = true;

                break;
            }

            DispatcherHelper.UIDispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () => IsBusy = isBusy);
        }
        /// <summary>
        /// Handles the StatusChanged event of the KinectSensors control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="Microsoft.Kinect.StatusChangedEventArgs"/> instance containing the event data.</param>
        void KinectSensors_StatusChanged(object sender, StatusChangedEventArgs e)
        {
            labelKinectStatus.Content = e.Status.ToString();

            if (e.Status == KinectStatus.Connected)
            {
                // Call the method to show Kinect count and device id
                this.ShowKinectSensorInfo();
            }
            else
            {
                labelKinectSensor.Content = "No Kinect Device Found";
                labelKinectDeviceId.Content = string.Empty;
            }
        }
 /// <summary>
 /// Handles the StatusChanged event of the KinectSensors control.
 /// </summary>
 /// <param name="sender">The source of the event.</param>
 /// <param name="e">The <see cref="Microsoft.Kinect.StatusChangedEventArgs"/> instance containing the event data.</param>
 void KinectSensors_StatusChanged(object sender, StatusChangedEventArgs e)
 {
     this.Title = e.Status.ToString();
     if (e.Status == KinectStatus.Connected)
     {
         this.StartSensor();
     }
     else
     {
         if (sensor != null)
         {
             sensor.Stop();
         }
     }
 }
  void KinectSensors_StatusChanged(object sender, StatusChangedEventArgs e)
 {
     switch (e.Status)
     {
         case KinectStatus.Connected:
             this.SetupSkeletonTracker();
             break;
         case KinectStatus.Disconnected:
         case KinectStatus.NotPowered:
         case KinectStatus.Error:
             server.SendToAll(String.Format("{{\"Kinect\":\"{0}\"}}", e.Status.ToString()));
             this.StopSkeletonTracker();
             break;
     }
 }
Beispiel #51
0
 private void KinectSensors_StatusChanged(object sender, StatusChangedEventArgs e)
 {
     switch (e.Status)
     {
         case KinectStatus.Initializing:
         case KinectStatus.Connected:
             this.Kinect = e.Sensor;
             break;
         case KinectStatus.Disconnected:
             //TODO: Give the user feedback to plug-in a Kinect device.    
             this.Kinect = null;
             break;
         default:
             //TODO: Show an error state
             break;
     }
 }
        public void KinectSensors_StatusChanged(object sender, StatusChangedEventArgs e)
        {
            switch (e.Status)
            {
                case KinectStatus.Initializing:
                case KinectStatus.Connected:
                    _mainWindow.KinectDevice = e.Sensor;
                    break;
                case KinectStatus.Disconnected:

                    _mainWindow.KinectDevice = null;
                    break;
                default:

                    break;
            }
        }
Beispiel #53
0
        private void KinectSensors_StatusChanged(object sender, StatusChangedEventArgs e)
        {
            if (e.Status == KinectStatus.Connected)
            {
                if (sensor != null)
                    sensor.Stop();
                sensor = e.Sensor;
            }
            else if (e.Status == KinectStatus.Disconnected)
            {
                if (sensor != null)
                    sensor.Stop();
                sensor = null;
            }

            if (sensor != null)
                initializeKinect();
        }
Beispiel #54
0
 private void KinectSensors_StatusChanged(object sender, StatusChangedEventArgs e)
 {
     switch (e.Status)
     {
         case KinectStatus.Connected:
             if (this.Kinect == null)
             {
                 this.Kinect = e.Sensor;
             }
             break;
         case KinectStatus.Disconnected:
             if (this.Kinect == e.Sensor)
             {
                 this.Kinect = null;
                 this.Kinect = KinectSensor.KinectSensors.FirstOrDefault(x => x.Status == KinectStatus.Connected);
                 if (this.Kinect == null)
                 {
                     MessageBox.Show("Sensor Disconnected. Please reconnect to continue.");
                 }
             }
             break;
     }
 }
        // KINECTの状態が変わった
        void Kinects_StatusChanged( object sender, StatusChangedEventArgs e )
        {
            // KINECTの数を表示
            ShowKinectCount();

            // KINECTが刺された
            if ( e.Status == KinectStatus.Connected ) {
                InitKinect( e.KinectRuntime );
            }
            // KINECTが抜かれた
            else if ( e.Status == KinectStatus.Disconnected ) {
                // インスタンス数が切りつめられるので、インスタンス数の最後のImageをnullにする
                // 一度に何個も抜かれるかもなので、最後までnullにしちゃう
                for ( int i = Runtime.Kinects.Count; i < images.Length; i++ ) {
                    images[i].Source = null;
                }

                // 抜かれたKINECTのイベント削除と、インスタンスの破棄
                e.KinectRuntime.VideoFrameReady -=
                    new EventHandler<ImageFrameReadyEventArgs>( kinect_VideoFrameReady );
                e.KinectRuntime.Uninitialize();
            }
        }
Beispiel #56
0
        void KinectSensors_StatusChanged(object sender, StatusChangedEventArgs e)
        {
            switch (e.Status)
            {
                case KinectStatus.Connected:
                    if (this.Kinect == null)
                    {
                        this.Kinect = e.Sensor;
                    }
                    break;
                case KinectStatus.DeviceNotGenuine:
                    break;
                case KinectStatus.DeviceNotSupported:
                    break;
                case KinectStatus.Disconnected:
                    if (this.Kinect == e.Sensor)
                    {
                        this.Kinect = null;

                    }
                    break;
                case KinectStatus.Error:
                    break;
                case KinectStatus.Initializing:
                    break;
                case KinectStatus.InsufficientBandwidth:
                    break;
                case KinectStatus.NotPowered:
                    break;
                case KinectStatus.NotReady:
                    break;
                case KinectStatus.Undefined:
                    break;
                default:
                    break;
            }
        }
 /// <summary>
 /// This is a event is generated when the kinect status is changed ie unconnected, connected, or unplugged 
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void Kinects_StatusChanged(object sender, StatusChangedEventArgs e)
 {
     switch (e.Status)
     {
         case KinectStatus.Connected:
             if (Kinect == null)
             {
                 Kinect = e.KinectRuntime; //if Runtime.Init() fails due to an AppDeviceConflict, this property will be null after return.
                 ShowStatus(ErrorCondition.None);
             }
             break;
         case KinectStatus.Disconnected:
             if (Kinect == e.KinectRuntime)
             {
                 Kinect = null;
             }
             break;
         case KinectStatus.NotReady:
             if (Kinect == null)
             {
                 ShowStatus(ErrorCondition.NotReady);
             }
             break;
         case KinectStatus.NotPowered:
             if (Kinect == e.KinectRuntime)
             {
                 Kinect = null;
                 ShowStatus(ErrorCondition.NoPower);
             }
             break;
         default:
             throw new Exception("Unhandled Status: " + e.Status);
     }
     if (Kinect == null)
     {
         ShowStatus(ErrorCondition.NoKinect);
     }
 }
 public void HandleStatusChanged(object sender, StatusChangedEventArgs e)
 {
     Log.Debug (logTag, "Location status changed event raised");
 }
Beispiel #59
0
 private void KinectsStatusChanged(object sender, StatusChangedEventArgs e)
 {
     this.ShowStatus(e.Sensor, e.Status);
 }
Beispiel #60
0
        private void KinectSensorsOnStatusChanged(object sender, StatusChangedEventArgs e)
        {
            if (KinectAdapter == null)
            {
                KinectAdapter = _kinectSensorAdapterFactory.GetFirstKinectSensor();
            }
            else
            {
                if (e.Sensor.UniqueKinectId == KinectAdapter.UniqueKinectId && e.Status == KinectStatus.Disconnected)
                {
                    KinectAdapter.Dispose();
                    KinectAdapter = null;
                }
            }

            OnKinectStatusChanged(e.Status);
        }