private void txCalStatus_TextChanged(object sender, TextChangedEventArgs e) { context = (CalibrationViewModel)DataContext; if (context.ProcessedFrames >= context.NumFrames) { TextBox bt = (TextBox)FindName("txNumFrames"); bt.Focus(); } }
/// <summary> /// Selects the user control to show within the tab area. Creates a new ViewModel, if the case and /// pass it to ApplicationViewModel (shell that controls navigation). /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void TabControl_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (e.Source is TabControl) { ApplicationViewModel app = (ApplicationViewModel)DataContext; if (TabItemCalibration.IsSelected) { if (calViewModel == null) { calViewModel = new CalibrationViewModel(app); } calViewModel.LoadCalibrationData(false); app.CurrentPageViewModel = calViewModel; } else if (TabItemExecution.IsSelected) { if (exeViewModel == null) { exeViewModel = new AnalysisViewModel(app); } exeViewModel.LoadExecutionModel(); app.CurrentPageViewModel = exeViewModel; } else if (TabItemResults.IsSelected) { if (resultViewModel == null) { resultViewModel = new ResultsViewModel(app); } resultViewModel.LoadResultViewModel(); app.CurrentPageViewModel = resultViewModel; } else if (TabItemSessions.IsSelected) { // This is the first and default page. app.CurrentPageViewModel = app.PageViewModels[0]; } } }
/// <summary> /// Constructor for playing a clip in order to calibrate parameters /// </summary> /// <param name="callingProcess">Reference to a calling object</param> /// <param name="filename">Name of the clip to be played</param> /// <param name="numFrame">Number of frames to be evaluated</param> /// <param name="joint">Body joint identifier</param> /// <param name="initialTime">Initial time of the clip</param> /// <param name="estimated">Estimated joint initial position</param> public SessionCalibrationKinect(CalibrationViewModel callingProcess, string filename, int numFrame, JointType joint, Int64 initialTime, Vector3 estimated) { _calling = callingProcess; _calibrationData = new List <Vector3>(); _calibrationResult = new Vector3(0f, 0f, 0f); _maxFramesCalibration = numFrame; _calibrationJoint = joint; _initialTime = new TimeSpan(initialTime * 10000); _estimated = estimated; _relativeTime = new TimeSpan(); _rightThighLength = new List <double>(); _rightShankLength = new List <double>(); _leftThighLength = new List <double>(); _leftShankLength = new List <double>(); finished = false; frameCount = 1; _sensor = KinectSensor.GetDefault(); if (_sensor != null) { _sensor.Open(); _reader = _sensor.OpenMultiSourceFrameReader(FrameSourceTypes.Body); _reader.MultiSourceFrameArrived += CalibrationFrameArrived; } if (!string.IsNullOrEmpty(filename)) { _calling.CalibrationStatus = "Starting playback..."; OneArgDelegate playback = new OneArgDelegate(PlaybackClip); playback.BeginInvoke(filename, null, null); } }
/// <summary> /// Any threshold has changed /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void TextBox_TextChanged(object sender, TextChangedEventArgs e) { context = (CalibrationViewModel)DataContext; context.CalibrationChanged = true; }
private void lbJointNames_SelectionChanged(object sender, SelectionChangedEventArgs e) { context = (CalibrationViewModel)DataContext; context.SelectedJoint = lbJointNames.SelectedValue.ToString(); }
private void UserControl_Loaded(object sender, RoutedEventArgs e) { context = (CalibrationViewModel)DataContext; lbCalStatus.Visibility = context.ProcessedFrames > 0 ? Visibility.Visible : Visibility.Hidden; txCalStatus.Visibility = context.ProcessedFrames > 0 ? Visibility.Visible : Visibility.Hidden; }