/// <since_tizen> 6 </since_tizen>
public string[] ImageArray
{
- get => (GetValue(ImageListProperty) as List<string>).ToArray();
+ get => (GetValue(ImageListProperty) as List<string>)?.ToArray() ?? null;
set => SetValue(ImageListProperty, value == null ? new List<string>() : new List<string>((string[])value));
}
groupHeader.isGroupFooter = false;
ContentContainer.Add(groupHeader);
}
- groupHeader.ParentItemsView = this;
- groupHeader.Index = index;
- groupHeader.ParentGroup = context;
- groupHeader.BindingContext = context;
+
+ if (groupHeader != null)
+ {
+ groupHeader.ParentItemsView = this;
+ groupHeader.Index = index;
+ groupHeader.ParentGroup = context;
+ groupHeader.BindingContext = context;
+ }
//group selection?
item = groupHeader;
}
groupFooter.isGroupFooter = true;
ContentContainer.Add(groupFooter);
}
- groupFooter.ParentItemsView = this;
- groupFooter.Index = index;
- groupFooter.ParentGroup = context;
- groupFooter.BindingContext = context;
+ if (groupFooter != null)
+ {
+ groupFooter.ParentItemsView = this;
+ groupFooter.Index = index;
+ groupFooter.ParentGroup = context;
+ groupFooter.BindingContext = context;
+ }
//group selection?
item = groupFooter;
}
if (IsSelectable)
{
- if (ParentItemsView as CollectionView)
+ if (ParentItemsView is CollectionView colView)
{
- CollectionView colView = ParentItemsView as CollectionView;
switch (colView.SelectionMode)
{
case ItemSelectionMode.Single:
if (IsSelectable)
{
// Extension : Extension?.SetTouchInfo(touch);
- if (ParentItemsView as CollectionView)
+ if (ParentItemsView is CollectionView colView)
{
- CollectionView colView = ParentItemsView as CollectionView;
switch (colView.SelectionMode)
{
case ItemSelectionMode.Single:
if (targetSibling > -1 && targetSibling < Container.Children.Count)
{
RecyclerViewItem candidate = Container.Children[targetSibling] as RecyclerViewItem;
- if (candidate.Index >= 0 && candidate.Index < colView.InternalItemSource.Count)
+ if (candidate != null && candidate.Index >= 0 && candidate.Index < colView.InternalItemSource.Count)
{
nextFocusedView = candidate;
}
if (targetSibling > -1 && targetSibling < Container.Children.Count)
{
RecyclerViewItem candidate = Container.Children[targetSibling] as RecyclerViewItem;
- if (candidate.Index >= 0 && candidate.Index < colView.InternalItemSource.Count)
+ if (candidate != null && candidate.Index >= 0 && candidate.Index < colView.InternalItemSource.Count)
{
nextFocusedView = candidate;
}
public void OnActive()
{
- if (null != childOp)
+ if (null != childOp && childOp.ValueList.Count > 3 && (childOp.ValueList[0] is Instance instance) && (childOp.ValueList[1] is Instance element))
{
- int instanceIndex = (childOp.ValueList[0] as Instance).Index;
- int elementIndex = (childOp.ValueList[1] as Instance).Index;
+ int instanceIndex = instance.Index;
+ int elementIndex = element.Index;
int propertyIndex = (int)childOp.ValueList[2];
int value = (int)childOp.ValueList[3];
globalDataList.Operations.Add(new AddEvent(globalDataList, instanceIndex, elementIndex, propertyIndex, value));
public void OnActive()
{
- if (null != childOp)
+ if (null != childOp && childOp.ValueList.Count > 2 && (childOp.ValueList[0] is Instance instance) && (childOp.ValueList[1] is string key))
{
- int instanceIndex = (childOp.ValueList[0] as Instance).Index;
- string key = childOp.ValueList[1] as string;
+ int instanceIndex = instance.Index;
var value = childOp.ValueList[2];
globalDataList.Operations.Add(new AddToResourceDictionary(globalDataList, instanceIndex, key, value));
}
public void OnActive()
{
- if (null != childOp)
+ if (null != childOp && childOp.ValueList.Count > 2 && (childOp.ValueList[0] is Instance instance) && (childOp.ValueList[1] is Instance child))
{
- int parentIndex = (childOp.ValueList[0] as Instance).Index;
- int childIndex = (childOp.ValueList[1] as Instance).Index;
+ int parentIndex = instance.Index;
+ int childIndex = child.Index;
int methodIndex = (int)childOp.ValueList[2];
globalDataList.Operations.Add(new CallAddMethod(globalDataList, parentIndex, childIndex, methodIndex));
public void OnActive()
{
- if (null != childOp)
+ if (null != childOp && childOp.ValueList.Count > 2 && (childOp.ValueList[0] is Instance instance))
{
- int instanceIndex = (childOp.ValueList[0] as Instance).Index;
+ int instanceIndex = instance.Index;
int bindalbePropertyIndex = (int)childOp.ValueList[1];
var value = childOp.ValueList[2];
globalDataList.Operations.Add(new SetBindalbeProperty(globalDataList, instanceIndex, bindalbePropertyIndex, value));
public void OnActive()
{
- if (null != childOp)
+ if (null != childOp && childOp.ValueList.Count > 2 && (childOp.ValueList[0] is Instance instance) && (childOp.ValueList[2] is Instance value))
{
- int instanceIndex = (childOp.ValueList[0] as Instance).Index;
+ int instanceIndex = instance.Index;
var propertyIndex = (int)childOp.ValueList[1];
- int valueIndex = (childOp.ValueList[2] as Instance).Index;
+ int valueIndex = value.Index;
globalDataList.Operations.Add(new SetBinding(globalDataList, instanceIndex, propertyIndex, valueIndex));
}
public void OnActive()
{
- if (null != childOp)
+ if (null != childOp && childOp.ValueList.Count > 2 && (childOp.ValueList[0] is Instance instance) && (childOp.ValueList[2] is string key))
{
- int instanceIndex = (childOp.ValueList[0] as Instance).Index;
+ int instanceIndex = instance.Index;
int propertyIndex = (int)childOp.ValueList[1];
- string key = childOp.ValueList[2] as string;
-
globalDataList.Operations.Add(new SetDynamicResource(globalDataList, instanceIndex, propertyIndex, key));
}
}
public void OnActive()
{
- if (null != childOp)
+ if (null != childOp && childOp.ValueList.Count > 2 && (childOp.ValueList[0] is Instance instance))
{
- int instanceIndex = (childOp.ValueList[0] as Instance).Index;
+ int instanceIndex = instance.Index;
int propertyIndex = (int)childOp.ValueList[1];
var value = childOp.ValueList[2];
globalDataList.Operations.Add(new SetProperty(globalDataList, instanceIndex, propertyIndex, value));
{
List<int> genericTypeIndexs = new List<int>();
var genericTypeIndexList = valueList[1] as List<object>;
- foreach (var index in genericTypeIndexList)
+ if (genericTypeIndexList != null)
{
- genericTypeIndexs.Add((int)index);
+ foreach (var index in genericTypeIndexList)
+ {
+ genericTypeIndexs.Add((int)index);
+ }
}
-
return new GatherType(globalDataList, assemblyIndex, typeName, genericTypeIndexs);
}
else
var instance = globalDataList.GatheredInstances[instanceIndex] as ResourceDictionary;
var realValue = (value is Instance) ? globalDataList.GatheredInstances[(value as Instance).Index] : value;
- instance.Add(key, realValue);
+ instance?.Add(key, realValue);
}
private int instanceIndex;
field = type.GetField(fi => fi.Name == propertyName && fi.IsStatic && !fi.IsPublic);
}
- globalDataList.GatheredBindableProperties.Add(field.GetValue(null) as BindableProperty);
+ if (null != field && field.GetValue(null) is BindableProperty value)
+ {
+ globalDataList.GatheredBindableProperties.Add(value);
+ }
}
private int typeIndex;
public void Do()
{
var converter = globalDataList.GatheredInstances[converterIndex] as TypeConverter;
- globalDataList.GatheredInstances.Add(converter.ConvertFromInvariantString(value));
+ globalDataList.GatheredInstances.Add(converter?.ConvertFromInvariantString(value));
}
private int converterIndex;
var instance = globalDataList.GatheredInstances[instanceIndex] as BindableObject;
var property = globalDataList.GatheredBindableProperties[propertyIndex];
- instance.SetDynamicResource(property, key);
+ instance?.SetDynamicResource(property, key);
}
private int instanceIndex;
SetupAnimationForPosition(layoutPositionData, positionTransitionComponents);
SetupAnimationForSize(layoutPositionData, sizeTransitionComponents);
+
+ // Dispose components
+ positionTransitionComponents.Dispose();
+ sizeTransitionComponents.Dispose();
}
} // class LayoutController
{
var newStyle = value.Clone() as TOut;
- newStyle.CopyFrom(other);
+ newStyle?.CopyFrom(other);
return newStyle;
}
{
// Get the frame for the child, start, top, end, bottom.
Vector4 frame = new Vector4(Interop.FlexLayout.GetNodeFrame(swigCPtr, childIndex), true);
- childLayout.Layout(new LayoutLength(frame.X), new LayoutLength(frame.Y), new LayoutLength(frame.Z), new LayoutLength(frame.W));
+ childLayout?.Layout(new LayoutLength(frame.X), new LayoutLength(frame.Y), new LayoutLength(frame.Z), new LayoutLength(frame.W));
frame.Dispose();
}
}