private static async Task CopyActionIconsToTempFolder(string iconFileName)
{
try
{
// Start by opening the image that is packaged as an embedded resource
var assembly = typeof(CortanaListener).GetTypeInfo().Assembly;
using (
var stream =
assembly.GetManifestResourceStream(typeof(CortanaListener).Namespace + ".Images." + iconFileName)
)
{
if (stream == null) return;
// Create the image in the local folder so that it can be used as an icon in Cortana interface
var iconFolder =
await
ApplicationData.Current.LocalFolder.CreateFolderAsync("builditmedia",
CreationCollisionOption.OpenIfExists);
var localIconFile =
await iconFolder.CreateFileAsync(iconFileName, CreationCollisionOption.ReplaceExisting);
using (var outStream = await localIconFile.OpenStreamForWriteAsync())
{
await stream.CopyToAsync(outStream);
}
}
}
catch (Exception ex)
{
ex.LogException();
}
}