/// </summary>
/// <param name="parent">Parent EvasObject class.</param>
/// <since_tizen> preview </since_tizen>
- public AccessibleObject(EvasObject parent) : base(parent)
+ protected AccessibleObject(EvasObject parent) : base(parent)
{
}
/// Creates and initializes a new instance of the AccessibleObject class.
/// </summary>
/// <since_tizen> preview </since_tizen>
- public AccessibleObject() : base()
+ protected AccessibleObject()
{
}
}
else
{
- throw new Exception("This method just makes sense if an image file was set.");
+ throw new InvalidOperationException("This method just makes sense if an image file was set.");
}
}
{
get
{
- var tm = new Interop.Libc.SystemTime();
- Interop.Elementary.elm_calendar_displayed_time_get(RealHandle, out tm);
+ Interop.Elementary.elm_calendar_displayed_time_get(RealHandle, out Interop.Libc.SystemTime tm);
// TODO
// If the defect is fixed, it will be removed.
var daysInMonth = DateTime.DaysInMonth(tm.tm_year + 1900, tm.tm_mon + 1);
/// <since_tizen> preview </since_tizen>
public static bool operator ==(Color a, Color b)
{
- if (ReferenceEquals(a, b))
- return true;
-
- if ((object)a == null || (object)b == null)
- return false;
-
return EqualsInner(a, b);
}
/// <since_tizen> preview </since_tizen>
public static Color FromHex(string hex)
{
- hex = hex.Replace("#", "");
- switch (hex.Length)
+ string ret = hex.Replace("#", "");
+ switch (ret.Length)
{
case 3: //#rgb => ffrrggbb
- hex = string.Format("ff{0}{1}{2}{3}{4}{5}", hex[0], hex[0], hex[1], hex[1], hex[2], hex[2]);
+ ret = string.Format("ff{0}{1}{2}{3}{4}{5}", ret[0], ret[0], ret[1], ret[1], ret[2], ret[2]);
break;
case 4: //#argb => aarrggbb
- hex = string.Format("{0}{1}{2}{3}{4}{5}{6}{7}", hex[0], hex[0], hex[1], hex[1], hex[2], hex[2], hex[3], hex[3]);
+ ret = string.Format("{0}{1}{2}{3}{4}{5}{6}{7}", ret[0], ret[0], ret[1], ret[1], ret[2], ret[2], ret[3], ret[3]);
break;
case 6: //#rrggbb => ffrrggbb
- hex = string.Format("ff{0}", hex);
+ ret = string.Format("ff{0}", ret);
break;
}
- return FromUint(Convert.ToUInt32(hex.Replace("#", ""), 16));
+ return FromUint(Convert.ToUInt32(ret.Replace("#", ""), 16));
}
/// <summary>
{
return Color.Default.A;
}
-
set
{
Console.WriteLine("ColorSelector instance doesn't support to set Opacity.");
/// <param name="parent">The parent is a given object, which will be attached by the Container
/// as a child. It's <see cref="EvasObject"/> type.</param>
/// <since_tizen> preview </since_tizen>
- public Container(EvasObject parent) : base(parent)
+ protected Container(EvasObject parent) : base(parent)
{
}
/// Creates and initializes a new instance of the Container class.
/// </summary>
/// <since_tizen> preview </since_tizen>
- protected Container() : base()
+ protected Container()
{
}
}
}
- class SignalData
+ class SignalData : IEquatable<SignalData>
{
public string Emission { get; set; }
public string Source { get; set; }
Action = action;
}
- /// <summary>
- /// Indicates whether this instance and a specified object are equal.
- /// </summary>
- /// <param name="obj">The object to compare with the current instance.</param>
- /// <returns>
- /// true if the object and this instance are of the same type and represent the same value.
- /// otherwise, false.
- /// </returns>
- public override bool Equals(object obj)
+ public override bool Equals(object other)
{
- SignalData s = obj as SignalData;
- if (s == null)
+ return Equals(other as SignalData);
+ }
+
+ public bool Equals(SignalData other) {
+ if (other == null)
{
return false;
}
- return (Emission == s.Emission) && (Source == s.Source) && (Action == s.Action);
+ return (Emission == other.Emission) && (Source == other.Source) && (Action == other.Action);
}
public override int GetHashCode()
/// <since_tizen> preview </since_tizen>
public void Remove(FlipSelectorItem item)
{
- if (item as FlipSelectorItem != null)
+ if (item != null)
item.Delete();
}
internal static GenGridItemEventArgs CreateFromSmartEvent(IntPtr data, IntPtr obj, IntPtr info)
{
GenGridItem item = ItemObject.GetItemByHandle(info) as GenGridItem;
- return new GenGridItemEventArgs() { Item = item };
+ return new GenGridItemEventArgs { Item = item };
}
}
internal static GenListItemEventArgs CreateFromSmartEvent(IntPtr data, IntPtr obj, IntPtr info)
{
GenListItem item = ItemObject.GetItemByHandle(info) as GenListItem;
- return new GenListItemEventArgs() { Item = item };
+ return new GenListItemEventArgs { Item = item };
}
}
/// Creates and initializes a new instance of the GenList class.
/// </summary>
/// <since_tizen> preview </since_tizen>
- protected GenList() : base()
+ protected GenList()
{
}
internal static HoverselItemEventArgs CreateFromSmartEvent(IntPtr data, IntPtr obj, IntPtr info)
{
HoverselItem item = ItemObject.GetItemByHandle(info) as HoverselItem;
- return new HoverselItemEventArgs() { Item = item };
+ return new HoverselItemEventArgs { Item = item };
}
}
SelectedItem?.SendSelected();
Changed?.Invoke(this, e);
}
-
- void AddInternal(IndexItem item)
- {
- _children.Add(item);
- item.Deleted += Item_Deleted;
- }
-
- void Item_Deleted(object sender, EventArgs e)
- {
- _children.Remove((IndexItem)sender);
- }
}
}
\ No newline at end of file
return s_globalId++;
}
- class SignalData
+ class SignalData : IEquatable<SignalData>
{
public string Emission { get; set; }
public string Source { get; set; }
Func = func;
}
- /// <summary>
- /// Indicates whether this instance and a specified object are equal.
- /// </summary>
- /// <param name="obj">The object to compare with the current instance.</param>
- /// <returns>
- /// true if the object and this instance are of the same type and represent the same value,
- /// otherwise false.
- /// </returns>
- public override bool Equals(object obj)
+ public override bool Equals(object other)
{
- SignalData s = obj as SignalData;
- if (s == null)
+ return Equals(other as SignalData);
+ }
+
+ public bool Equals(SignalData other) {
+ if (other == null)
{
return false;
}
- return (Emission == s.Emission) && (Source == s.Source) && (Func == s.Func);
+ return (Emission == other.Emission) && (Source == other.Source) && (Func == other.Func);
}
public override int GetHashCode()
{
IntPtr _trackHandle = IntPtr.Zero;
- /// <summary>
- /// Creates and initializes a new instance of the ItemEvasObject class.
- /// </summary>
- /// <param name="parent">IntPtr</param>
- public ItemEvasObject(IntPtr parent) : base()
+ public ItemEvasObject(IntPtr parent)
{
_trackHandle = Interop.Elementary.elm_object_item_track(parent);
if (_trackHandle != IntPtr.Zero)
}
}
- /// <summary>
- /// Creates a widget handle.
- /// </summary>
- /// <param name="parent">Parent EvasObject.</param>
- /// <returns>Handle IntPtr.</returns>
protected override IntPtr CreateHandle(EvasObject parent)
{
return _trackHandle;
// "item,deleted" event will be called after removing the item from ItemObject has been done.
// ItemObject will no longer have the item instance that is deleted after this.
// So, ItemDelete event with the removed item should be triggered here.
- ItemDeleted?.Invoke(this, new MultiButtonEntryItemEventArgs() { Item = removed });
+ ItemDeleted?.Invoke(this, new MultiButtonEntryItemEventArgs { Item = removed });
}
void OnItemAdded(object sender, MultiButtonEntryItemEventArgs e)
internal static MultiButtonEntryItemEventArgs CreateFromSmartEvent(IntPtr data, IntPtr obj, IntPtr info)
{
MultiButtonEntryItem item = ItemObject.GetItemByHandle(info) as MultiButtonEntryItem;
- return new MultiButtonEntryItemEventArgs() { Item = item };
+ return new MultiButtonEntryItemEventArgs { Item = item };
}
internal static MultiButtonEntryItemEventArgs CreateAndAddFromSmartEvent(IntPtr data, IntPtr obj, IntPtr info)
// ItemObject does NOT have an item that contains handle matched to "info" at this time.
// So, item should be created and added internally here.
MultiButtonEntryItem item = new MultiButtonEntryItem(info);
- return new MultiButtonEntryItemEventArgs() { Item = item };
+ return new MultiButtonEntryItemEventArgs { Item = item };
}
}
}
\ No newline at end of file
/// This value can be used for <see cref="EvasObject.WeightX"/> and <see cref="EvasObject.WeightY"/>.
/// </summary>
/// <since_tizen> preview </since_tizen>
- public static double Expand = 1.0;
+ public static readonly double Expand = 1.0;
/// <summary>
/// This value can be used for <see cref="EvasObject.AlignmentX"/> and <see cref="EvasObject.AlignmentY"/>.
/// </summary>
/// <since_tizen> preview </since_tizen>
- public static double Fill = -1.0;
+ public static readonly double Fill = -1.0;
}
}
if (item == null)
return;
_itemStack.Remove(item);
- Popped?.Invoke(this, new NaviframeEventArgs() { Content = item.Content });
+ Popped?.Invoke(this, new NaviframeEventArgs { Content = item.Content });
}
}
}
internal static ToolbarItemEventArgs CreateFromSmartEvent(IntPtr data, IntPtr obj, IntPtr info)
{
ToolbarItem item = ItemObject.GetItemByHandle(info) as ToolbarItem;
- return new ToolbarItemEventArgs() { Item = item };
+ return new ToolbarItemEventArgs { Item = item };
}
}
void AddObject(EvasObject obj)
{
if (_checker.Contains(obj))
- throw new Exception("Cannot add the duplicate object.");
+ throw new InvalidOperationException("Cannot add the duplicate object.");
_checker.Add(obj);
Interop.Elementary.elm_transit_object_add(_handle, obj);
void AddChainedTransit(Transit transit)
{
if (_checker.Contains(transit))
- throw new Exception("Cannot add the duplicate transit.");
+ throw new InvalidOperationException("Cannot add the duplicate transit.");
_checker.Add(transit);
Interop.Elementary.elm_transit_chain_transit_add(_handle, transit._handle);
CubicBezier
}
- internal delegate void EcoreCallback(IntPtr data);
internal delegate bool EcoreTaskCallback(IntPtr data);
internal delegate bool EcoreEventCallback(IntPtr data, int type, IntPtr evt);
internal delegate bool EcoreTimelineCallback(IntPtr data, double pos);
internal static string BackgroundFileGet(IntPtr obj)
{
- IntPtr file = IntPtr.Zero;
- elm_bg_file_get(obj, out file, IntPtr.Zero);
+ elm_bg_file_get(obj, out IntPtr file, IntPtr.Zero);
return Marshal.PtrToStringAnsi(file);
}
}
internal static extern IntPtr elm_image_add(IntPtr obj);
[DllImport(Libraries.Elementary)]
- internal static extern void elm_image_async_open_set(IntPtr obj, bool async);
+ internal static extern void elm_image_async_open_set(IntPtr obj, bool @async);
[DllImport(Libraries.Elementary)]
internal static extern IntPtr elm_image_object_get(IntPtr obj);
var errPtr = dlerror();
if (errPtr != IntPtr.Zero)
{
- throw new Exception("dlsym : " + Marshal.PtrToStringAnsi(errPtr));
+ throw new InvalidOperationException("dlsym : " + Marshal.PtrToStringAnsi(errPtr));
}
return res;
}