parameter에 쓰인 것을 'parameter: value' 식으로 나오게 함.
Inheritance: IValueConverter
Example #1
0
		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();
		}
		/// <summary>
		/// 파일 선택했을 때.
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		async void itemListView_SelectionChanged(object sender, SelectionChangedEventArgs e)
		{
			var lbFile = itemListView.SelectedItem as LbFile;
			if (lbFile == null)
				return;
			if (_viewModel.SelectedBoard == null)
				_viewModel.SelectedBoard = new BoardViewModel();

			// 파일 부르기.
			StorageFile retrievedFile = null;
			string text = null;
			try
			{
				retrievedFile = await StorageApplicationPermissions.MostRecentlyUsedList.GetFileAsync(lbFile.Token);
				text = await FileIO.ReadTextAsync(retrievedFile);
			}
			catch (IOException)
			{
				var converter = new ExtractFilenameConverter();
				var filename = converter.Convert(lbFile.Metadata, typeof(string), null, Windows.System.UserProfile.GlobalizationPreferences.Languages[0]);
				new MessageDialog(String.Format(_loader.GetString("ErrorFileLoading"), filename), _loader.GetString("PlayRecentBoard/Text")).ShowAsync();

				// 최근 실행목록 삭제.
				StorageApplicationPermissions.MostRecentlyUsedList.Remove(lbFile.Token);
				_viewModel.RefreshRecentOpenedList();

				return;
			}

			Dispatcher.RunAsync(CoreDispatcherPriority.Normal,
				() => _viewModel.LoadSelectedBoard(Board.FromXml(XElement.Parse(text), _viewModel.Templates),
				retrievedFile));

			if (this.UsingLogicalPageNavigation())
			{
				this.navigationHelper.GoBackCommand.RaiseCanExecuteChanged();
			}
		}