/ src / modules / FileLocksmith / FileLocksmithUI / Converters / UserToSystemWarningVisibilityConverter.cs
UserToSystemWarningVisibilityConverter.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 7 using Microsoft.UI.Xaml; 8 using Microsoft.UI.Xaml.Data; 9 10 namespace PowerToys.FileLocksmithUI.Converters 11 { 12 public sealed partial class UserToSystemWarningVisibilityConverter : IValueConverter 13 { 14 public object Convert(object value, Type targetType, object parameter, string language) 15 { 16 string user = ((string)value).ToUpperInvariant().Trim(); 17 if (user.Equals("SYSTEM", StringComparison.Ordinal) || user.Equals("LOCALSYSTEM", StringComparison.Ordinal)) 18 { 19 return Visibility.Visible; 20 } 21 else 22 { 23 return Visibility.Collapsed; 24 } 25 } 26 27 public object ConvertBack(object value, Type targetType, object parameter, string language) 28 { 29 throw new NotSupportedException(); 30 } 31 } 32 }