static private ShowErrorMessage ( string title, string text, |
||
title | string | |
text | string | |
parent | ||
return | void |
public void launchServer() { //These don't need a lock to be thread safe since they are volatile forceStop = false; serverState = ServerRunState.Starting; string errorMessage = ""; if (serverMasterOptions.parseSettings(out errorMessage)) { //Start the Kinect audio streams and create the per Kinect skeleton lists for (int i = 0; i < kinects.Count; i++) { kinects[i].StartKinectAudio(); //TODO: This will crash if the Kinects are in another thread (i.e. console mode) } //Start the feedback client if necessary if (serverMasterOptions.feedbackOptions.useFeedback) { feedbackCore = new FeedbackCore(verbose, this, parent); feedbackCore.StartFeedbackCore(serverMasterOptions.feedbackOptions.feedbackServerName, serverMasterOptions.feedbackOptions.feedbackSensorNumber); } runServerCoreDelegate serverDelegate = runServerCore; serverDelegate.BeginInvoke(null, null); //Start voice recognition, if necessary if (serverMasterOptions.voiceCommands.Count > 0) { voiceRecog = new VoiceRecogCore(this, verbose, parent); launchVoiceRecognizerDelegate voiceDelegate = voiceRecog.launchVoiceRecognizer; //Dispatcher newDispatch = new Dispatcher(); voiceDelegate.BeginInvoke(new AsyncCallback(voiceStartedCallback), null); //voiceRecog.launchVoiceRecognizer(); } else { //Because the voice callback will not be called, we need to call this stuff here if (GUI) { parent.startServerButton.Content = "Stop"; parent.startServerButton.IsEnabled = true; parent.ServerStatusItem.Content = "Running"; parent.ServerStatusTextBlock.Text = "Running"; } } } else { HelperMethods.ShowErrorMessage("Error", "Settings parsing failed! See the log for more details.", parent); HelperMethods.WriteToLog(errorMessage, parent); } }
private void stopButton_Click(object sender, RoutedEventArgs e) { recording = false; parent.MergedSkeletonChanged -= parent_MergedSkeletonChanged; if (isTrainingDataValid(trainingData)) { string temp = getTrainingDataName(); trainingDataNames.Add(temp); KinectSkeleton[] newList = new KinectSkeleton[trainingData.Count]; trainingData.CopyTo(newList); settings.trainingData.Add(new List <KinectSkeleton>(newList)); } else { HelperMethods.ShowErrorMessage("No Training Data", "Warning: No training data was recorded!", parent); } trainingData.Clear(); trainingSetsListBox.Items.Refresh(); stopButton.IsEnabled = false; testButton.IsEnabled = false; trainButton.IsEnabled = true; startButton.IsEnabled = true; }