+using ElmSharp;
using System;
namespace Tizen.Applications.AttachPanel
/// <summary>
/// Represents immutable class for attach panel.
/// </summary>
- /// <since_tizen> 3 </since_tizen>
+ /// <since_tizen> 4 </since_tizen>
/// <param name="conformant">The caller's conformant</param>
/// <exception cref="OutOfMemoryException">Thrown when an attempt to allocate memory fails.</exception>
/// <exception cref="InvalidOperationException">Thrown when the AttachPanel is already exist or the <paramref name="conformant"/> is not a conformant object</exception>
- public AttachPanel(IntPtr conformant)
+ public AttachPanel(EvasObject conformant)
{
if (conformant == IntPtr.Zero)
{
throw new ArgumentNullException("Use the value property, not null value");
}
+
IntPtr candidateAttachPanel = new IntPtr();
Interop.AttachPanel.ErrorCode err = Interop.AttachPanel.CreateAttachPanel(conformant, ref candidateAttachPanel);
- checkException(err);
+ CheckException(err);
Tizen.Log.Debug("AttachPanelSharp", "Success to create an AttachPanel Instance");
isCreationSucceed = true;
}
}
+ /// <summary>
+ /// Represents immutable class for attach panel.
+ /// </summary>
+ /// <since_tizen> 4 </since_tizen>
+ /// <param name="conformant">The caller's conformant</param>
+ /// <exception cref="OutOfMemoryException">Thrown when an attempt to allocate memory fails.</exception>
+ /// <exception cref="InvalidOperationException">Thrown when the AttachPanel is already exist or the <paramref name="conformant"/> is not a conformant object</exception>
+ public AttachPanel(Conformant conformant)
+ {
+ if (conformant == IntPtr.Zero)
+ {
+ throw new ArgumentNullException("Use the value property, not null value");
+ }
+
+ IntPtr candidateAttachPanel = new IntPtr();
+ Interop.AttachPanel.ErrorCode err = Interop.AttachPanel.CreateAttachPanel(conformant, ref candidateAttachPanel);
+ CheckException(err);
+
+ Tizen.Log.Debug("AttachPanelSharp", "Success to create an AttachPanel Instance");
+ isCreationSucceed = true;
+ _attachPanel = candidateAttachPanel;
+
+ if (_eventEventHandler == null)
+ {
+ StateEventListenStart();
+ }
+
+ if (_resultEventHandler == null)
+ {
+ ResultEventListenStart();
+ }
+ }
+
+ /// <summary>
+ /// A destructor which deallocates attach panel resources.
+ /// </summary>
~AttachPanel()
{
if (isCreationSucceed &&
_attachPanel != IntPtr.Zero)
{
Interop.AttachPanel.ErrorCode err = Interop.AttachPanel.DestroyAttachPanel(_attachPanel);
- checkException(err);
+ CheckException(err);
_attachPanel = IntPtr.Zero;
}
}
/// Gets the state of the AttachPanel.
/// </summary>
/// <value>The AttachPanel window state</value>
- public int State
+ /// <since_tizen> 4 </since_tizen>
+ public StateType State
{
get
{
- int state;
- Interop.AttachPanel.ErrorCode err = Interop.AttachPanel.GetState(_attachPanel, out state);
- checkException(err);
+ int interopState;
+ Interop.AttachPanel.ErrorCode err = Interop.AttachPanel.GetState(_attachPanel, out interopState);
+ CheckException(err);
+ StateType state = (StateType)Enum.ToObject(typeof(StateType), interopState);
return state;
}
}
/// Gets the value that indicates whether the AttachPanel is visible.
/// </summary>
/// <value>visible value of AttachPanel state</value>
- public int Visible
+ /// <since_tizen> 4 </since_tizen>
+ public bool Visible
{
get
{
int visible;
Interop.AttachPanel.ErrorCode err = Interop.AttachPanel.GetVisibility(_attachPanel, out visible);
- checkException(err);
- return visible;
+ CheckException(err);
+ return (visible == 1);
}
}
/// <exception cref="UnauthorizedAccessException">Thrown when application does not have privilege to access this method</exception>
/// <exception cref="NotSupportedException">Thrown when the device does not supported the <paramref name="category"/> feature </exception>
/// <exception cref="InvalidOperationException">Thrown when the AttachPanel is not created yet or already destroyed</exception>
+ /// <since_tizen> 4 </since_tizen>
public void AddCategory(ContentCategory category, Bundle extraData)
{
IntPtr bundle = IntPtr.Zero;
{
bundle = extraData.SafeBundleHandle.DangerousGetHandle();
}
+
Interop.AttachPanel.ErrorCode err = Interop.AttachPanel.AddCategory(_attachPanel, (int)category, bundle);
- checkException(err);
+ CheckException(err);
}
/// <summary>
/// <param name="category">The ContentCategory adding in the AttachPanel</param>
/// <exception cref="ArgumentOutOfRangeException">Thrown when the <paramref name="category"/> is not a valid category</exception>
/// <exception cref="InvalidOperationException">Thrown when the AttachPanel is not created yet or already destroyed</exception>
+ /// <since_tizen> 4 </since_tizen>
public void RemoveCategory(ContentCategory category)
{
Interop.AttachPanel.ErrorCode err = Interop.AttachPanel.RemoveCategory(_attachPanel, (int)category);
- checkException(err);
+ CheckException(err);
}
/// <summary>
/// <exception cref="ArgumentOutOfRangeException">Thrown when the <paramref name="category"/> is not a valid category</exception>
/// <exception cref="InvalidOperationException">Thrown when the AttachPanel is destroyed</exception>
/// <exception cref="OutOfMemoryException">Thrown when an attempt to allocate memory fails.</exception>
+ /// <since_tizen> 4 </since_tizen>
public void SetExtraData(ContentCategory category, Bundle extraData)
{
- if(extraData == null)
+ if (extraData == null)
{
- checkException(Interop.AttachPanel.ErrorCode.InvalidParameter);
+ CheckException(Interop.AttachPanel.ErrorCode.InvalidParameter);
}
IntPtr bundle = IntPtr.Zero;
{
bundle = extraData.SafeBundleHandle.DangerousGetHandle();
}
+
Interop.AttachPanel.ErrorCode err = Interop.AttachPanel.SetExtraData(_attachPanel, (int)category, bundle);
- checkException(err);
+ CheckException(err);
}
/// <summary>
/// Shows the attach panel with animations
/// </summary>
/// <exception cref="InvalidOperationException">Thrown when the AttachPanel is destroyed</exception>
+ /// <since_tizen> 4 </since_tizen>
public void Show()
{
Interop.AttachPanel.ErrorCode err = Interop.AttachPanel.Show(_attachPanel);
- checkException(err);
+ CheckException(err);
}
/// <summary>
/// Shows the attach panel and selects whether or not to animate
/// </summary>
+ /// <param name="animation">A flag which turn on or turn off the animation while attach panel showing.</param>
/// <exception cref="InvalidOperationException">Thrown when the AttachPanel is destroyed</exception>
+ /// <since_tizen> 4 </since_tizen>
public void Show(bool animation)
{
if (animation)
{
Interop.AttachPanel.ErrorCode err = Interop.AttachPanel.Show(_attachPanel);
- checkException(err);
+ CheckException(err);
}
else
{
Interop.AttachPanel.ErrorCode err = Interop.AttachPanel.ShowWithoutAnimation(_attachPanel);
- checkException(err);
+ CheckException(err);
}
}
/// Hides the attach panel with animations
/// </summary>
/// <exception cref="InvalidOperationException">Thrown when the AttachPanel is destroyed</exception>
+ /// <since_tizen> 4 </since_tizen>
public void Hide()
{
Interop.AttachPanel.ErrorCode err = Interop.AttachPanel.Hide(_attachPanel);
- checkException(err);
+ CheckException(err);
}
/// <summary>
/// Hides the attach panel and selects whether or not to animate
/// </summary>
+ /// <param name="animation">A flag which turn on or turn off the animation while attach panel hiding.</param>
/// <exception cref="InvalidOperationException">Thrown when the AttachPanel is destroyed</exception>
+ /// <since_tizen> 4 </since_tizen>
public void Hide(bool animation)
{
if (animation)
{
Interop.AttachPanel.ErrorCode err = Interop.AttachPanel.Hide(_attachPanel);
- checkException(err);
+ CheckException(err);
}
else
{
Interop.AttachPanel.ErrorCode err = Interop.AttachPanel.HideWithoutAnimation(_attachPanel);
- checkException(err);
+ CheckException(err);
}
}
/// <summary>
/// Occurs when reserved events are published from the panel-side.
/// </summary>
+ /// <since_tizen> 4 </since_tizen>
public event EventHandler<StateEventArgs> EventChanged
{
add
{
StateEventListenStart();
}
+
_eventEventHandler += value;
}
+
remove
{
_eventEventHandler -= value;
/// <summary>
/// Occurs when an user selects and confirms something to attach in the AttachPanel
/// </summary>
+ /// <since_tizen> 4 </since_tizen>
public event EventHandler<ResultEventArgs> ResultCallback
{
add
{
ResultEventListenStart();
}
+
_resultEventHandler += value;
}
+
remove
{
_resultEventHandler -= value;