void EvasObjectDeleted(object sender, EventArgs e)
{
- IntPtr handle = (sender as EvasObject).Handle;
- s_HandleToEvasObject.Remove(handle);
+ if(sender is EvasObject evasObject)
+ s_HandleToEvasObject.Remove(evasObject);
}
IntPtr GetReusableContentCallback(IntPtr data, IntPtr obj, IntPtr part, IntPtr old)
// thanks to the fact that we never remove item from _handlers, we don't need a lock here
if (handlerIndex < 0 || handlerIndex >= _handlers.Count)
return;
- Action<object> action = _handlers[handlerIndex].Action;
+
+ var currentHandler = _handlers[handlerIndex];
+ Action<object> action = currentHandler.Action;
if (action == null)
return;
+
// the interpretation of the event_info struct pointer depends on the GestureType
- switch (_handlers[handlerIndex].Type)
+ switch (currentHandler.Type)
{
case GestureType.Tap:
case GestureType.LongTap:
}
};
- MemoryStream memstream = new MemoryStream();
- await stream.CopyToAsync(memstream);
-
- unsafe
+ using (MemoryStream memstream = new MemoryStream())
{
- byte[] dataArr = memstream.ToArray();
- fixed (byte* data = &dataArr[0])
+ await stream.CopyToAsync(memstream);
+
+ unsafe
{
- bool ret = Interop.Elementary.elm_image_memfile_set(RealHandle, data, dataArr.Length, IntPtr.Zero, IntPtr.Zero);
- if (!ret)
+ byte[] dataArr = memstream.ToArray();
+ fixed (byte* data = &dataArr[0])
{
- return false;
+ bool ret = Interop.Elementary.elm_image_memfile_set(RealHandle, data, dataArr.Length, IntPtr.Zero, IntPtr.Zero);
+ if (!ret)
+ {
+ return false;
+ }
}
}
}
- memstream.Dispose();
-
return await tcs.Task;
}