LiveBoard.Common.ExtractFilenameConverter.Convert C# (CSharp) Method

Convert() public method

public Convert ( object value, Type targetType, object parameter, string language ) : object
value object
targetType System.Type
parameter object
language string
return object
        public object Convert(object value, Type targetType, object parameter, string language)
        {
            var path = value.ToString();
            if (String.IsNullOrEmpty(path))
                return path;
            path = System.IO.Path.GetFileNameWithoutExtension(Uri.UnescapeDataString(path).Replace("/", "\\"));
            return String.Format(path);
        }

Usage 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();
		}
All Usage Examples Of LiveBoard.Common.ExtractFilenameConverter::Convert
ExtractFilenameConverter