private void findButton_Click(object sender, RoutedEventArgs e) { int result = -1; var task = InputTextDialogAsync(); var task2 = task.ContinueWith(t => { try { result = StudentList.FindItem(int.Parse(t.Result)); } catch (FormatException fe) { NotFindItemAsync(); return; } }); var awaiter = task2.GetAwaiter(); awaiter.OnCompleted(() => { if (result == -1) { NotFindItemAsync(); return; } var record = dataGrid.GetRecordAtRowIndex(result + 1); dataGrid.SelectedItem = record; dataGrid.ScrollInView(new Syncfusion.UI.Xaml.ScrollAxis.RowColumnIndex(result + 1, 3)); }); }
protected override void OnActivated(IActivatedEventArgs args) { if (args.Kind == ActivationKind.VoiceCommand) { var commandArgs = args as VoiceCommandActivatedEventArgs; Windows.Media.SpeechRecognition.SpeechRecognitionResult speechRecognitionResult = commandArgs.Result; string voiceCommandName = speechRecognitionResult.RulePath[0]; if (voiceCommandName == "Search") { string item = speechRecognitionResult.SemanticInterpretation.Properties["Sid"][0]; int result = StudentList.FindItem(int.Parse(item)); if (result != -1) { var record = Item1.dataGrid.GetRecordAtRowIndex(result + 1); Item1.dataGrid.SelectedItem = record; Item1.dataGrid.ScrollInView(new Syncfusion.UI.Xaml.ScrollAxis.RowColumnIndex(result + 1, 3)); } } } }
private void sortButton_Click(object sender, RoutedEventArgs e) { StudentList.Sort(); stuViewModel.Init(); }