After this patch, about 87 CA2000 warnings are remaining in VS.
if (ret != null)
{
Interop.BaseHandle.DeleteBaseHandle(new HandleRef(this, cPtr));
+ NDalicPINVOKE.ThrowExceptionIfExists();
+ return ret;
}
else
{
ret = new Renderer(cPtr, true);
+ return ret;
}
- NDalicPINVOKE.ThrowExceptionIfExists();
- return ret;
}
/// <summary>
return !operand1.Equals(operand2);
}
- internal readonly NUI.Shadow ToShadow() => new NUI.Shadow(BlurRadius, Color.ToReferenceType(), new (OffsetX, OffsetY), new (ExtraWidth, ExtraHeight));
+ internal readonly NUI.Shadow ToShadow()
+ {
+ using var color = Color.ToReferenceType();
+ using Vector2 offset = new(OffsetX, OffsetY);
+ using Vector2 extents = new(ExtraWidth, ExtraHeight);
+ return new NUI.Shadow(BlurRadius, color, offset, extents);
+ }
internal readonly PropertyMap BuildMap(View attachedView)
{
}
// It will be removed until dali APIs are prepared.
- Rectangle initRectangle = new Rectangle(0, 0, 0, 0);
+ using Rectangle initRectangle = new Rectangle(0, 0, 0, 0);
Application ret = new Application(Interop.Application.New(argc, argvStr, stylesheet, (int)windowMode, Rectangle.getCPtr(initRectangle), (int)type), true);
- if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
return ret;
}
public Tizen.NUI.BaseComponents.View GetView()
{
global::System.IntPtr cPtr = Interop.VisualObjectsContainer.GetOwner(SwigCPtr);
-
- Tizen.NUI.BaseComponents.View ret = null;
+
if (Interop.RefObject.GetRefObjectPtr(cPtr) == global::System.IntPtr.Zero)
{
// Visual container don't have owner. Return null.
Interop.BaseHandle.DeleteBaseHandle(new global::System.Runtime.InteropServices.HandleRef(this, cPtr));
+ NDalicPINVOKE.ThrowExceptionIfExists();
}
else
{
- ret = Registry.GetManagedBaseHandleFromNativePtr(cPtr) as Tizen.NUI.BaseComponents.View;
+ Tizen.NUI.BaseComponents.View ret = Registry.GetManagedBaseHandleFromNativePtr(cPtr) as Tizen.NUI.BaseComponents.View;
if (ret != null)
{
Interop.BaseHandle.DeleteBaseHandle(new global::System.Runtime.InteropServices.HandleRef(this, cPtr));
+ NDalicPINVOKE.ThrowExceptionIfExists();
+ return ret;
}
else
{
ret = new Tizen.NUI.BaseComponents.View(cPtr, true);
+ return ret;
}
}
- NDalicPINVOKE.ThrowExceptionIfExists();
- return ret;
+ return null;
}
public int GetContainerRangeType()
transitionItemList = new List<TransitionItemBase>();
for (int index = 0; index < transitionList.Count; ++index)
{
- TimePeriod localTimePeriod = new TimePeriod(transitionList[index].GetTimePeriod().DelayMilliseconds, transitionList[index].GetTimePeriod().DurationMilliseconds);
+ using TimePeriod localTimePeriod = new TimePeriod(transitionList[index].GetTimePeriod().DelayMilliseconds, transitionList[index].GetTimePeriod().DurationMilliseconds);
AlphaFunction localAlphaFunction = transitionList[index].GetAlphaFunction();
if (useGroupTimePeriod)
{
instance.GetWindow().Hide();
defaultWindowSet = true;
}
-
- Window = new Window(new Rectangle(0, 0, width, height), false);
+ using var rect = new Rectangle(0, 0, width, height);
+ Window = new Window(rect, false);
Window.Show();
}
NUIWindowProxy = new NUIWindowProxy(Window);
if (_border != value)
{
_border = new Rectangle(value);
- UpdateImage(NpatchImageVisualProperty.Border, new PropertyValue(_border));
+ using var pv = new PropertyValue(_border);
+ UpdateImage(NpatchImageVisualProperty.Border, pv);
}
}
// Update currentStates properties to cachedImagePropertyMap
if (currentStates.changed)
{
- UpdateImage(ImageVisualProperty.LoopCount, new PropertyValue(currentStates.loopCount), false);
- UpdateImage(ImageVisualProperty.StopBehavior, new PropertyValue((int)currentStates.stopEndAction), false);
- UpdateImage(ImageVisualProperty.LoopingMode, new PropertyValue((int)currentStates.loopMode), false);
- UpdateImage(ImageVisualProperty.RedrawInScalingDown, new PropertyValue(currentStates.redrawInScalingDown), false);
- UpdateImage(ImageVisualProperty.SynchronousLoading, new PropertyValue(currentStates.synchronousLoading), false);
- UpdateImage(ImageVisualProperty.EnableFrameCache, new PropertyValue(currentStates.enableFrameCache), false);
- UpdateImage(ImageVisualProperty.NotifyAfterRasterization, new PropertyValue(currentStates.notifyAfterRasterization), false);
- UpdateImage(ImageVisualProperty.FrameSpeedFactor, new PropertyValue(currentStates.frameSpeedFactor), false);
+ using (var pv = new PropertyValue(currentStates.loopCount))
+ UpdateImage(ImageVisualProperty.LoopCount, pv, false);
+ using (var pv = new PropertyValue((int)currentStates.stopEndAction))
+ UpdateImage(ImageVisualProperty.StopBehavior, pv, false);
+ using (var pv = new PropertyValue((int)currentStates.loopMode))
+ UpdateImage(ImageVisualProperty.LoopingMode, pv, false);
+ using (var pv = new PropertyValue(currentStates.redrawInScalingDown))
+ UpdateImage(ImageVisualProperty.RedrawInScalingDown, pv, false);
+ using (var pv = new PropertyValue(currentStates.synchronousLoading))
+ UpdateImage(ImageVisualProperty.SynchronousLoading, pv, false);
+ using (var pv = new PropertyValue(currentStates.enableFrameCache))
+ UpdateImage(ImageVisualProperty.EnableFrameCache, pv, false);
+ using (var pv = new PropertyValue(currentStates.notifyAfterRasterization))
+ UpdateImage(ImageVisualProperty.NotifyAfterRasterization, pv, false);
+ using (var pv = new PropertyValue(currentStates.frameSpeedFactor))
+ UpdateImage(ImageVisualProperty.FrameSpeedFactor, pv, false);
// Do not cache PlayRange and TotalFrameNumber into cachedImagePropertyMap.
// (To keep legacy implements behaviour)
{
ret = new View(Layer.getCPtr(layer).Handle, false);
NUILog.Error("This Parent property is deprecated, should do not be used");
+ Interop.BaseHandle.DeleteBaseHandle(CPtr);
+ CPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
+
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve());
+ return ret;
}
else
{
ret = basehandle as View;
- }
-
- Interop.BaseHandle.DeleteBaseHandle(CPtr);
- CPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
+ Interop.BaseHandle.DeleteBaseHandle(CPtr);
+ CPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
- if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve());
- return ret;
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve());
+ return ret;
+ }
}
}
int visualType = 0;
- map.Find(Visual.Property.Type)?.Get(out visualType);
+ using (var pv = map.Find(Visual.Property.Type))
+ {
+ pv?.Get(out visualType);
+ }
if (visualType == (int)Visual.Type.Image)
{
// Background extra data flag is not meanful anymore.
backgroundExtraDataUpdatedFlag &= ~BackgroundExtraDataUpdatedFlag.Background;
- Tizen.NUI.Object.SetProperty((System.Runtime.InteropServices.HandleRef)SwigCPtr, View.Property.BACKGROUND, new PropertyValue(map));
+ using (var pv = new PropertyValue(map))
+ {
+ Tizen.NUI.Object.SetProperty(SwigCPtr, View.Property.BACKGROUND, pv);
+ }
}
private void SetBorderlineColor(Color value)
backgroundExtraDataUpdatedFlag &= ~BackgroundExtraDataUpdatedFlag.Background;
- var mapValue = new PropertyValue(map);
+ using var mapValue = new PropertyValue(map);
Object.SetProperty(SwigCPtr, Property.BACKGROUND, mapValue);
-
}
private void SetColor(Color value)
private void SetShadow(ShadowBase value)
{
- Tizen.NUI.Object.SetProperty((System.Runtime.InteropServices.HandleRef)SwigCPtr, View.Property.SHADOW, value == null ? new PropertyValue() : value.ToPropertyValue(this));
+ using var pv = value == null ? new PropertyValue() : value.ToPropertyValue(this);
+ Tizen.NUI.Object.SetProperty(SwigCPtr, View.Property.SHADOW, pv);
}
}
}
{
// Register new camera into Registry.
ret = new Animatable(cPtr, true);
+ return ret;
}
else
{
HandleRef handle = new HandleRef(this, cPtr);
Interop.Actor.DeleteActor(handle);
handle = new HandleRef(null, IntPtr.Zero);
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ return ret;
}
- if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
- return ret;
}
/// <summary>
if (ret != null)
{
Interop.BaseHandle.DeleteBaseHandle(new HandleRef(this, cPtr));
+ NDalicPINVOKE.ThrowExceptionIfExists();
+ return ret;
}
else
{
ret = new Renderable(cPtr, true);
+ return ret;
}
- NDalicPINVOKE.ThrowExceptionIfExists();
- return ret;
}
/// <summary>
global::System.Runtime.InteropServices.HandleRef CPtr = new global::System.Runtime.InteropServices.HandleRef(dummyObect, cPtr);
Interop.BaseHandle.DeleteBaseHandle(CPtr);
CPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ return ret;
}
else
{
ret = new TypeRegistry(cPtr, true);
+ return ret;
}
-
- if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
- return ret;
}
[EditorBrowsable(EditorBrowsableState.Never)]
global::System.Runtime.InteropServices.HandleRef CPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
Interop.BaseHandle.DeleteBaseHandle(CPtr);
CPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ return ret;
}
else
{
ret = new Tizen.NUI.TypeInfo(cPtr, true);
+ return ret;
}
-
- if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
- return ret;
}
internal Tizen.NUI.TypeInfo GetTypeInfo(SWIGTYPE_p_std__type_info registerType)
{
set
{
- var pixelBuffer = ImageLoader.LoadImageFromFile(value);
+ using var pixelBuffer = ImageLoader.LoadImageFromFile(value);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
- Texture tex = new Texture(TextureType.TEXTURE_2D, PixelFormat.RGBA8888, pixelBuffer.GetWidth(),
+ using Texture tex = new Texture(TextureType.TEXTURE_2D, PixelFormat.RGBA8888, pixelBuffer.GetWidth(),
pixelBuffer.GetHeight());
- tex.Upload(pixelBuffer.CreatePixelData());
+ using var pd = pixelBuffer.CreatePixelData();
+ tex.Upload(pd);
Interop.ParticleEmitter.SetTexture(SwigCPtr, tex.SwigCPtr);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
if (source is View || source is Layer)
{
- Interop.Capture.Start4(SwigCPtr, source.SwigCPtr, new Vector2(position.X, position.Y).SwigCPtr, new Vector2(size.Width, size.Height).SwigCPtr, path, new Vector4(color.R, color.G, color.B, color.A).SwigCPtr);
+ using var posVector2 = new Vector2(position.X, position.Y);
+ using var sizeVector2 = new Vector2(size.Width, size.Height);
+ Interop.Capture.Start4(SwigCPtr, source.SwigCPtr, posVector2.SwigCPtr, sizeVector2.SwigCPtr, path, new Vector4(color.R, color.G, color.B, color.A).SwigCPtr);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
if (source is View || source is Layer)
{
- Interop.Capture.Start3(SwigCPtr, source.SwigCPtr, new Vector2(size.Width, size.Height).SwigCPtr, path, new Vector4(color.R, color.G, color.B, color.A).SwigCPtr, quality);
+ using var sizeVector2 = new Vector2(size.Width, size.Height);
+ Interop.Capture.Start3(SwigCPtr, source.SwigCPtr, sizeVector2.SwigCPtr, path, new Vector4(color.R, color.G, color.B, color.A).SwigCPtr, quality);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
if (source is View || source is Layer)
{
- Interop.Capture.Start1(SwigCPtr, source.SwigCPtr, new Vector2(size.Width, size.Height).SwigCPtr, path, new Vector4(color.R, color.G, color.B, color.A).SwigCPtr);
+ using var sizeVector2 = new Vector2(size.Width, size.Height);
+ Interop.Capture.Start1(SwigCPtr, source.SwigCPtr, sizeVector2.SwigCPtr, path, new Vector4(color.R, color.G, color.B, color.A).SwigCPtr);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
if (source is View || source is Layer)
{
- Interop.Capture.Start2(SwigCPtr, source.SwigCPtr, new Vector2(size.Width, size.Height).SwigCPtr, path);
+ using var sizeVector2 = new Vector2(size.Width, size.Height);
+ Interop.Capture.Start2(SwigCPtr, source.SwigCPtr, sizeVector2.SwigCPtr, path);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
if (ret != null)
{
Interop.BaseHandle.DeleteBaseHandle(new HandleRef(this, cPtr));
+ NDalicPINVOKE.ThrowExceptionIfExists();
+ return ret;
}
else
{
ret = new ImageUrl(cPtr, true);
+ return ret;
}
- NDalicPINVOKE.ThrowExceptionIfExists();
- return ret;
}
/// <summary>
}
else
{
- var urlArray = new PropertyArray();
+ using var urlArray = new PropertyArray();
foreach (var url in urls)
{
- urlArray.Add(new PropertyValue(url));
+ var pv = new PropertyValue(url);
+ using var _ = urlArray.Add(pv);
}
using (var temp = new PropertyValue(urlArray))
{
_outputVisualMap.Add(ImageVisualProperty.URL, temp);
}
- urlArray.Dispose();
}
if (batchSize != null)
{
global::System.Runtime.InteropServices.HandleRef CPtr = new global::System.Runtime.InteropServices.HandleRef(dummyObect, cPtr);
Interop.BaseHandle.DeleteBaseHandle(CPtr);
CPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ return ret;
}
else
{
ret = new VisualFactory(cPtr, true);
+ return ret;
}
-
- if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
- return ret;
}
[EditorBrowsable(EditorBrowsableState.Never)]
using var urlArray = new PropertyArray();
foreach (var url in resourceUrls)
{
- using var urlValue = new PropertyValue(url);
- urlArray.Add(urlValue);
+ var urlValue = new PropertyValue(url);
+ using var _ = urlArray.Add(urlValue);
}
if (cachedVisualPropertyMap != null)
get
{
Tizen.NUI.Color ret = new Tizen.NUI.Color();
- using var propertyValue = GetCachedVisualProperty((int)Tizen.NUI.BorderVisualProperty.Color);
- propertyValue?.Get(ret);
+ using (var propertyValue = GetCachedVisualProperty((int)Tizen.NUI.BorderVisualProperty.Color))
+ {
+ propertyValue?.Get(ret);
+ }
return ret;
}
}
// Get type from the property map.
internalType = (int)Tizen.NUI.Visual.Type.Invalid;
- if (cachedVisualPropertyMap?.Find((int)Tizen.NUI.Visual.Property.Type)?.Get(out internalType) ?? false)
+ using var pv = cachedVisualPropertyMap?.Find((int)Tizen.NUI.Visual.Property.Type);
+ if (pv?.Get(out internalType) ?? false)
{
UpdateVisualPropertyMap();
}
}
Interop.Window.FeedHoverEvent(SwigCPtr, TouchPoint.getCPtr(touchPoint));
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ touchPoint.Dispose();
}
/// <summary>
HandleRef CPtr = new HandleRef(this, cPtr);
Interop.BaseHandle.DeleteBaseHandle(CPtr);
CPtr = new HandleRef(null, global::System.IntPtr.Zero);
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ return ret;
}
else
{
ret = new RenderTaskList(cPtr, true);
+ return ret;
}
-
- if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
- return ret;
}
/// <summary>
for (int i = 0; i < size; i++)
{
string option = "none";
- tmp.GetElementAt((uint)i).Get(out option);
+ using (var pv = tmp.GetElementAt((uint)i))
+ {
+ pv.Get(out option);
+ }
tmpList.Add(option);
}