/// <summary> /// Gets the Category set for the object. /// </summary> public string GetCategory() { var obj = Object; if (obj == null) { return(null); } string result; if (obj.CheckAccess()) { result = LocalizationScope.GetCategory(obj); } else { result = (string)obj.Dispatcher.Invoke(new DispatcherOperationCallback(x => LocalizationScope.GetCategory((DependencyObject)x)), obj); } if (string.IsNullOrEmpty(result)) { // Return the default value result = LocalizationScope.DefaultCategory; } return(result); }
/// <summary> /// Gets the UI culture set for the object. /// </summary> /// <returns> /// A <see cref="CultureInfo"/> or null if no explicit value is set for the object. /// </returns> public CultureInfo GetUICulture() { var obj = Object; if (obj == null) { return(null); } CultureInfo result; if (obj.CheckAccess()) { result = LocalizationScope.GetUICulture(obj); } else { result = (CultureInfo)obj.Dispatcher.Invoke(new DispatcherOperationCallback(x => LocalizationScope.GetUICulture((DependencyObject)x)), obj); } if (result == null) { // Get the culture of the UI thread in case the current thread is different result = obj.Dispatcher.Thread.CurrentUICulture; } return(result); }