/// <summary> /// Event is fired when successfully connected to ROS master server /// </summary> /// <param name="sender">Sender</param> /// <param name="e">Arguments</param> private void RosControlBase_RosConnected(object sender, EventArgs e) { DetectionImage.Visibility = Visibility.Visible; DetectionImage.Subscribe(); // Enabling button enableDisableFollowMeButton.IsEnabled = true; followMeApp.Enable(true); dispatcherTimer.Start(); }
/// <summary> /// Image updated /// </summary> /// <param name="sender">Sender.</param> /// <param name="e">Arguments.</param> private void ImageSink_Updated(object sender, EventArgs e) { if (!firstUpdate) { return; } Dispatcher.Invoke(new Action(() => { firstUpdate = false; DetectionImage.SetActualSize(); })); }
/// <summary> /// Event is fired when disconnected from ROS master server /// </summary> /// <param name="sender">Sender</param> /// <param name="e">Arguments</param> private void RosControlBase_RosDisconnecting(object sender, EventArgs e) { // Unsubscribing from image stream DetectionImage.Visibility = Visibility.Hidden; DetectionImage.Unsubscribe(); // In case follow me is left working, user is asked if he wants it be shutdown AskToDisableFollowMe(); // Disabling button enableDisableFollowMeButton.IsEnabled = false; firstUpdate = true; dispatcherTimer.Stop(); }