private void EditUserWord() { var item = MainPage.Current.SelectedDictionaryItem; var settingsModel = (EditDictionaryListFlyout.Current.DataContext as HandwritingSettingsViewModel). SettingsModel; var list = settingsModel.DictionaryList; var position = 0; foreach (var listItem in list) { if (listItem.Equals(item)) { list.Remove(listItem); list.Insert(position, DictionaryWord.Text); break; } position += 1; } WritePadAPI.HWR_NewUserDict(WritePadAPI.getRecoHandle()); foreach (var listItem in list) { WritePadAPI.addWordToUserDictionary(listItem); } WritePadAPI.saveRecognizerDataOfType(WritePadAPI.USERDATA_DICTIONARY); }
private void DeleteButton_OnClick(object sender, RoutedEventArgs e) { var item = MainPage.Current.SelectedDictionaryItem; var settingsModel = (EditDictionaryListFlyout.Current.DataContext as HandwritingSettingsViewModel). SettingsModel; var list = settingsModel.DictionaryList; foreach (var listItem in list.Where(listItem => listItem.Equals(item))) { list.Remove(listItem); break; } WritePadAPI.HWR_NewUserDict(WritePadAPI.getRecoHandle()); foreach (var listItem in list) { WritePadAPI.addWordToUserDictionary(listItem); } WritePadAPI.saveRecognizerDataOfType(WritePadAPI.USERDATA_DICTIONARY); GoBack(); }