// Get feedback which matches the currently selected waveform in the dropdown. // To get the feedback, the SimpleHapticsController's SupportedFeedback list must be traversed // to see if a matching feedback is present. // This is important because InkContinuous is the only Inking waveform required to be // supported by every pen with haptics. // If no matching feedback is found in the SupportedFeedback list, this method returns // InkContinuous as a guaranteed fallback. private SimpleHapticsControllerFeedback GetSelectedFeedbackOrFallback(out string message) { // Look up the waveform the user selected. string name = (string)waveformComboBox.SelectionBoxItem; ushort waveform = MainPage.WaveformNamesMap[name]; // See if the haptics controller supports the selected waveform. SimpleHapticsControllerFeedback feedback = MainPage.FindSupportedFeedback(hapticsController, waveform); if (feedback != null) { message = "Waveform set to " + name; return(feedback); } // It does not. Use InkContinuous as a fallback. message = name + " is not supported by this pen, so falling back to InkContinuous"; return(MainPage.FindSupportedFeedback(hapticsController, KnownSimpleHapticsControllerWaveforms.InkContinuous)); }