private async void ButtonPlayRecent_OnClick(object sender, RoutedEventArgs e)
{
if (_viewModel == null
|| StorageApplicationPermissions.MostRecentlyUsedList.Entries == null
|| StorageApplicationPermissions.MostRecentlyUsedList.Entries.Count == 0)
{
await new MessageDialog(_loader.GetString("NoRecentFile")).ShowAsync();
return;
}
String mruFirstToken = null;
try
{
mruFirstToken = StorageApplicationPermissions.MostRecentlyUsedList.Entries.First().Token;
_playStorageFile = await StorageApplicationPermissions.MostRecentlyUsedList.GetFileAsync(mruFirstToken);
}
catch (IOException)
{
if (!String.IsNullOrEmpty(mruFirstToken))
{
var converter = new ExtractFilenameConverter();
var filename = converter.Convert(mruFirstToken, typeof (string), null, GlobalizationPreferences.Languages[0]);
new MessageDialog(String.Format(_loader.GetString("ErrorFileLoading"), filename),
_loader.GetString("PlayRecentBoard/Text")).ShowAsync();
// 최근 실행목록 삭제.
StorageApplicationPermissions.MostRecentlyUsedList.Remove(mruFirstToken);
_viewModel.RefreshRecentOpenedList();
return;
}
}
var dialog = new MessageDialog(String.Format(_loader.GetString("AskToPlayFile"), _playStorageFile.DisplayName), _loader.GetString("PlayRecentBoard/Text"));
dialog.Commands.Add(new UICommand(_loader.GetString("PlayNow"), playClickHandler));
dialog.Commands.Add(new UICommand(_loader.GetString("Cancel/Text")));
dialog.DefaultCommandIndex = 0;
dialog.CancelCommandIndex = 1;
await dialog.ShowAsync();
}