/ src / modules / launcher / Plugins / Microsoft.Plugin.Program / LocationConverter.cs
LocationConverter.cs
 1  // Copyright (c) Microsoft Corporation
 2  // The Microsoft Corporation licenses this file to you under the MIT license.
 3  // See the LICENSE file in the project root for more information.
 4  
 5  using System;
 6  using System.Globalization;
 7  using System.Windows.Data;
 8  using System.Windows.Markup;
 9  
10  namespace Microsoft.Plugin.Program
11  {
12      public class LocationConverter : MarkupExtension, IValueConverter
13      {
14          public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
15          {
16              var text = value as string;
17              if (string.IsNullOrEmpty(text))
18              {
19                  return string.Empty;
20              }
21              else
22              {
23                  return text;
24              }
25          }
26  
27          public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
28          {
29              throw new NotSupportedException();
30          }
31  
32          public override object ProvideValue(IServiceProvider serviceProvider)
33          {
34              return this;
35          }
36      }
37  }