// Callback for Application BatteryLowSignal
private void OnNUIApplicationBatteryLow(BatteryStatus status)
{
- NUIApplicationBatteryLowEventArgs e = new NUIApplicationBatteryLowEventArgs();
+ lock (this)
+ {
+ NUIApplicationBatteryLowEventArgs e = new NUIApplicationBatteryLowEventArgs();
- // Populate all members of "e" (NUIApplicationBatteryLowEventArgs) with real data
- e.BatteryStatus = status;
- _applicationBatteryLowEventHandler?.Invoke(this, e);
+ // Populate all members of "e" (NUIApplicationBatteryLowEventArgs) with real data
+ e.BatteryStatus = status;
+ _applicationBatteryLowEventHandler?.Invoke(this, e);
+ }
}
/**
// Callback for Application MemoryLowSignal
private void OnNUIApplicationMemoryLow(MemoryStatus status)
{
- NUIApplicationMemoryLowEventArgs e = new NUIApplicationMemoryLowEventArgs();
+ lock (this)
+ {
+ NUIApplicationMemoryLowEventArgs e = new NUIApplicationMemoryLowEventArgs();
- // Populate all members of "e" (NUIApplicationMemoryLowEventArgs) with real data
- e.MemoryStatus = status;
- _applicationMemoryLowEventHandler?.Invoke(this, e);
+ // Populate all members of "e" (NUIApplicationMemoryLowEventArgs) with real data
+ e.MemoryStatus = status;
+ _applicationMemoryLowEventHandler?.Invoke(this, e);
+ }
}
/**
ci.GetParameters().Length != 0 && ci.IsPublic &&
ci.GetParameters().All(pi => pi.CustomAttributes.Any(attr => attr.AttributeType == typeof (ParameterAttribute))));
object[] arguments = CreateArgumentsArray(node, ctorInfo);
- return ctorInfo.Invoke(arguments);
+ return ctorInfo?.Invoke(arguments);
}
public object CreateFromFactory(Type nodeType, IElementNode node)
{
var parameter = ctorInfo.GetParameters()[i];
var propname =
- parameter.CustomAttributes.First(attr => attr.AttributeType == typeof (ParameterAttribute))
+ parameter?.CustomAttributes?.First(attr => attr.AttributeType == typeof (ParameterAttribute))?
.ConstructorArguments.First()
.Value as string;
var name = new XmlName("", propname);
if (e.OldStartingIndex == -1 || e.OldItems?.Count > 1)
goto case NotifyCollectionChangedAction.Reset;
- var removedItem = e.OldItems[0] as TRestrict;
+ var removedItem = e.OldItems?[0] as TRestrict;
if (removedItem == null || !removedItem.Owned)
break;
if (e.NewStartingIndex == -1 || e.OldStartingIndex == -1 || e.NewItems?.Count > 1)
goto case NotifyCollectionChangedAction.Reset;
- var newReplaceItem = e.NewItems[0] as TRestrict;
+ var newReplaceItem = e.NewItems?[0] as TRestrict;
var oldReplaceItem = e.OldItems?[0] as TRestrict;
if ((newReplaceItem == null || !newReplaceItem.Owned) && (oldReplaceItem == null || !oldReplaceItem.Owned))
() =>
(MemberInfo)Property.DeclaringType.GetRuntimeProperty(Property.PropertyName) ?? (MemberInfo)Property.DeclaringType.GetRuntimeMethod("Get" + Property.PropertyName, new[] { typeof(BindableObject) });
- object value = valueconverter.Convert(Value, Property.ReturnType, minforetriever, serviceProvider);
+ object value = valueconverter?.Convert(Value, Property.ReturnType, minforetriever, serviceProvider);
Value = value;
return this;
}
{
public static IEnumerable<StyleSheet> GetStyleSheets(this IResourcesProvider resourcesProvider)
{
+ if (resourcesProvider == null)
+ yield break;
if (!resourcesProvider.IsResourcesCreated)
yield break;
- if (resourcesProvider.XamlResources.StyleSheets == null)
+ if (resourcesProvider.XamlResources == null || resourcesProvider.XamlResources.StyleSheets == null)
yield break;
foreach (var styleSheet in resourcesProvider.XamlResources.StyleSheets)
yield return styleSheet;
{
if (!BaseHandle.ReferenceEquals(x, null) || !BaseHandle.ReferenceEquals(y, null))
{
- if (x.HasBody())
+ if (x != null && x.HasBody())
{
return x;
}
- if (y.HasBody())
+ if (y != null && y.HasBody())
{
return y;
}