public static bool TryCreate(Uri uri, out CommandKey key) { if (uri == null) { key = null; return(false); } return(TryCreate(uri.ToString(), out key)); }
public static bool TryCreate(string s, out CommandKey key) { if (string.IsNullOrWhiteSpace(s)) { key = null; return(false); } key = new CommandKey(s); return(true); }
public static bool TryGetOrCreate(Uri uri, out CommandKey key) { if (uri == null) { key = null; return(false); } return(TryGetOrCreate(uri.OriginalString, out key)); }
public static bool TryGetOrCreate(string text, out CommandKey key) { if (string.IsNullOrWhiteSpace(text)) { key = null; return(false); } key = Cache.GetOrAdd(text, s => new CommandKey(s)); return(true); }
public bool Equals(CommandKey other) { if (ReferenceEquals(null, other)) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return(string.Equals(this.key, other.key, StringComparison.InvariantCultureIgnoreCase)); }
internal static bool TryGetOrCreate(object key, out CommandKey commandKey) { if (key is string s) { return(TryGetOrCreate(s, out commandKey)); } if (key is Uri uri) { return(TryGetOrCreate(uri, out commandKey)); } commandKey = null; return(false); }
internal static bool TryCreate(object key, out CommandKey commandKey) { var s = key as string; if (s != null) { return(TryCreate(s, out commandKey)); } var uri = key as Uri; if (uri != null) { return(TryCreate(uri, out commandKey)); } commandKey = null; return(false); }