Я после документации от Microsoft здесь:Кортана Интеграция: Не удается установить VCD XML файл
реализовать Кортана интеграции в мой Windows 10 приложений. Тем не менее, я получаю следующее сообщение об ошибке ...
«Система не может найти указанный файл»
Вот мой код для OnLaunched метода, который является, где я пытаюсь установить VCD ...
protected override async void OnLaunched(LaunchActivatedEventArgs e)
{
Frame rootFrame = Window.Current.Content as Frame;
// Do not repeat app initialization when the Window already has content,
// just ensure that the window is active
if (rootFrame == null)
{
// Create a Frame to act as the navigation context and navigate to the first page
rootFrame = new Frame();
rootFrame.NavigationFailed += OnNavigationFailed;
if (e.PreviousExecutionState == ApplicationExecutionState.Terminated)
{
//TODO: Load state from previously suspended application
}
// Place the frame in the current Window
Window.Current.Content = rootFrame;
}
if (e.PrelaunchActivated == false)
{
if (rootFrame.Content == null)
{
// When the navigation stack isn't restored navigate to the first page,
// configuring the new page by passing required information as a navigation
// parameter
rootFrame.Navigate(typeof(MainPage), e.Arguments);
}
// Ensure the current window is active
Window.Current.Activate();
}
try
{
//StorageFile vcdStorageFile = await Package.Current.InstalledLocation.GetFileAsync("VoiceCommandDefinitions.xml");
//await VoiceCommandDefinitionManager.InstallCommandDefinitionsFromStorageFileAsync(vcdStorageFile);
var storageFile = await StorageFile.GetFileFromApplicationUriAsync(new Uri("ms-appx:///VoiceCommandDefinitions.xml"));
await VoiceCommandDefinitionManager.InstallCommandDefinitionsFromStorageFileAsync(storageFile);
}
catch (Exception)
{
throw;
}
}
Я получил файл VCD в корне моего проекта и установить его, чтобы скопировать файл только в соответствии с указаниями в документации, связанной выше.
Кроме того, вот мой VCD-файл с именем «VoiceCommandDefinitions.xml».
<?xml version="1.0" encoding="utf-8" ?>
<VoiceCommands xmlns="http://schemas.microsoft.com/voicecommands/1.2">
<CommandSet xml:lang="en-gb" Name="VoiceCommands_en-gb">
<AppName>Hero Explorer</AppName>
<Example>Refresh the characters list</Example>
<Command Name="RefreshCharactersLIst">
<Example>Refresh the characters list</Example>
<ListenFor>Refresh [the] [characters] list</ListenFor>
<Feedback>Refreshing the characters list</Feedback>
<Navigate/>
</Command>
</CommandSet>
</VoiceCommands>
Что я делаю неправильно?
Hi @Sunteen! Спасибо за ваш ответ. К сожалению, после выполнения ваших инструкций я все еще сталкиваюсь с такой же ошибкой. См. Скриншот здесь: http://imgur.com/a/gEx27 Что мне не хватает? –
@SamDHarris не могли бы вы поставить точку прерывания на эту строку кода и иметь скриншот, чтобы я мог видеть, что это исключение выбрано этой линией. –
Еще раз спасибо @Sunteen, я не совсем уверен, что вы спрашиваете здесь: http://imgur.com/a/sOcap - это скриншот информации, хранящейся в переменной vcdStorageFile. Надеюсь эта помощь :) –