From 197f9866bec2cfc099ee859e93f7162d8569ba8e Mon Sep 17 00:00:00 2001 From: hallower Date: Fri, 9 Feb 2018 08:40:37 +0900 Subject: [PATCH] [Tizen.Applications.AttachPanel] Add attach_panel feature checking routine (#85) * [AttachPanel] Add attach-panel feature check code and exceptions * Fix exception description Signed-off-by: csk * Remove unnecessary file(coding rule checker) Signed-off-by: csk * Add feature description, fix reviewed issues. Signed-off-by: csk --- .../Interop/Interop.AttachPanel.cs | 3 +- .../Tizen.Applications.AttachPanel.csproj | 1 + .../Tizen.Applications.AttachPanel.sln | 7 + .../Tizen.Applications.AttachPanel/AttachPanel.cs | 228 +++++++++++++++------ .../AttachPanelInternal.cs | 56 ++--- .../ContentCategory.cs | 11 + .../Tizen.Applications.AttachPanel/EventType.cs | 3 + .../Tizen.Applications.AttachPanel/StateType.cs | 2 + 8 files changed, 223 insertions(+), 88 deletions(-) diff --git a/src/Tizen.Applications.AttachPanel/Interop/Interop.AttachPanel.cs b/src/Tizen.Applications.AttachPanel/Interop/Interop.AttachPanel.cs index 12940dc..8d5560b 100755 --- a/src/Tizen.Applications.AttachPanel/Interop/Interop.AttachPanel.cs +++ b/src/Tizen.Applications.AttachPanel/Interop/Interop.AttachPanel.cs @@ -22,6 +22,7 @@ internal static partial class Interop NotInitialized = -0x02850000 | 0x02, UnsupportedContentCategory = -0x02850000 | 0x03, AlreadyDestroyed = -0x02850000 | 0x05, + NotSupported = Tizen.Internals.Errors.ErrorCode.NotSupported, } [UnmanagedFunctionPointer(CallingConvention.Cdecl)] @@ -30,7 +31,7 @@ internal static partial class Interop internal delegate void AttachPanelResultCallback(IntPtr attachPanel, int category, IntPtr result, int resultCode, IntPtr userData); [DllImport(Libraries.AttachPanel, EntryPoint = "attach_panel_create")] - internal static extern ErrorCode CreateAttachPanel(IntPtr conform, ref IntPtr attach_panel); + internal static extern ErrorCode CreateAttachPanel(IntPtr conform, out IntPtr attach_panel); [DllImport(Libraries.AttachPanel, EntryPoint = "attach_panel_destroy")] internal static extern ErrorCode DestroyAttachPanel(IntPtr attach_panel); diff --git a/src/Tizen.Applications.AttachPanel/Tizen.Applications.AttachPanel.csproj b/src/Tizen.Applications.AttachPanel/Tizen.Applications.AttachPanel.csproj index b16fa50..f358b07 100755 --- a/src/Tizen.Applications.AttachPanel/Tizen.Applications.AttachPanel.csproj +++ b/src/Tizen.Applications.AttachPanel/Tizen.Applications.AttachPanel.csproj @@ -7,6 +7,7 @@ + diff --git a/src/Tizen.Applications.AttachPanel/Tizen.Applications.AttachPanel.sln b/src/Tizen.Applications.AttachPanel/Tizen.Applications.AttachPanel.sln index 644bd5d..d9ec1c8 100755 --- a/src/Tizen.Applications.AttachPanel/Tizen.Applications.AttachPanel.sln +++ b/src/Tizen.Applications.AttachPanel/Tizen.Applications.AttachPanel.sln @@ -6,6 +6,7 @@ MinimumVisualStudioVersion = 10.0.40219.1 Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.Applications.AttachPanel", "Tizen.Applications.AttachPanel.csproj", "{C8C93D46-CACE-4BF1-8B50-6A6A00967045}" ProjectSection(ProjectDependencies) = postProject {AF2CEEB1-B3B2-4E2D-8854-A54871CD0D1C} = {AF2CEEB1-B3B2-4E2D-8854-A54871CD0D1C} + {0FF56FE4-CBFA-4E8E-B0A2-0FEDB856498D} = {0FF56FE4-CBFA-4E8E-B0A2-0FEDB856498D} EndProjectSection EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.Applications.Common", "..\Tizen.Applications.Common\Tizen.Applications.Common.csproj", "{D2B5F854-4FE1-473C-A8E3-53ABB0A966AA}" @@ -16,6 +17,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.Log", "..\Tizen.Log\T EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ElmSharp", "..\ElmSharp\ElmSharp.csproj", "{AF2CEEB1-B3B2-4E2D-8854-A54871CD0D1C}" EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.System.Information", "..\Tizen.System.Information\Tizen.System.Information.csproj", "{0FF56FE4-CBFA-4E8E-B0A2-0FEDB856498D}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -42,6 +45,10 @@ Global {AF2CEEB1-B3B2-4E2D-8854-A54871CD0D1C}.Debug|Any CPU.Build.0 = Debug|Any CPU {AF2CEEB1-B3B2-4E2D-8854-A54871CD0D1C}.Release|Any CPU.ActiveCfg = Release|Any CPU {AF2CEEB1-B3B2-4E2D-8854-A54871CD0D1C}.Release|Any CPU.Build.0 = Release|Any CPU + {0FF56FE4-CBFA-4E8E-B0A2-0FEDB856498D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {0FF56FE4-CBFA-4E8E-B0A2-0FEDB856498D}.Debug|Any CPU.Build.0 = Debug|Any CPU + {0FF56FE4-CBFA-4E8E-B0A2-0FEDB856498D}.Release|Any CPU.ActiveCfg = Release|Any CPU + {0FF56FE4-CBFA-4E8E-B0A2-0FEDB856498D}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/src/Tizen.Applications.AttachPanel/Tizen.Applications.AttachPanel/AttachPanel.cs b/src/Tizen.Applications.AttachPanel/Tizen.Applications.AttachPanel/AttachPanel.cs index 7838b87..13ccd38 100755 --- a/src/Tizen.Applications.AttachPanel/Tizen.Applications.AttachPanel/AttachPanel.cs +++ b/src/Tizen.Applications.AttachPanel/Tizen.Applications.AttachPanel/AttachPanel.cs @@ -13,29 +13,41 @@ namespace Tizen.Applications.AttachPanel /// /// 4 /// The caller's conformant. + /// http://tizen.org/feature/attach_panel + /// Thrown when the parameter is null /// Thrown when an attempt to allocate the memory fails. /// Thrown when the AttachPanel already exists or the is not a conformant object. + /// Thrown when the AttachPanel is not supported in the device. public AttachPanel(EvasObject conformant) { if (conformant == IntPtr.Zero) { - throw new ArgumentNullException("Use the value property, not null value"); + throw new ArgumentNullException("Invalid conformant, it's null"); } - IntPtr candidateAttachPanel = new IntPtr(); - Interop.AttachPanel.ErrorCode err = Interop.AttachPanel.CreateAttachPanel(conformant, ref candidateAttachPanel); + if (IsAttachPanelSupported() == false) + { + CheckException(Interop.AttachPanel.ErrorCode.NotSupported); + } + + if (IsInitialized()) + { + CheckException(Interop.AttachPanel.ErrorCode.AlreadyExists); + } + + var candidateAttachPanel = IntPtr.Zero; + var err = Interop.AttachPanel.CreateAttachPanel(conformant, out candidateAttachPanel); CheckException(err); Tizen.Log.Debug("AttachPanelSharp", "Success to create an AttachPanel Instance"); - isCreationSucceed = true; - _attachPanel = candidateAttachPanel; + s_attachPanel = candidateAttachPanel; - if (_eventEventHandler == null) + if (s_eventEventHandler == null) { StateEventListenStart(); } - if (_resultEventHandler == null) + if (s_resultEventHandler == null) { ResultEventListenStart(); } @@ -46,32 +58,13 @@ namespace Tizen.Applications.AttachPanel /// /// 4 /// The caller's conformant. + /// http://tizen.org/feature/attach_panel /// Thrown when an attempt to allocate the memory fails. /// Thrown when the AttachPanel already exists or the is not a conformant object. - public AttachPanel(Conformant conformant) + /// Thrown when the AttachPanel is not supported in the device. + /// Thrown when the parameter is null + public AttachPanel(Conformant conformant) : this(conformant as EvasObject) { - 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(); - } } /// @@ -79,12 +72,10 @@ namespace Tizen.Applications.AttachPanel /// ~AttachPanel() { - if (isCreationSucceed && - _attachPanel != IntPtr.Zero) + if (IsInitialized()) { - Interop.AttachPanel.ErrorCode err = Interop.AttachPanel.DestroyAttachPanel(_attachPanel); - CheckException(err); - _attachPanel = IntPtr.Zero; + Interop.AttachPanel.DestroyAttachPanel(s_attachPanel); + s_attachPanel = IntPtr.Zero; } } @@ -93,15 +84,28 @@ namespace Tizen.Applications.AttachPanel /// /// The AttachPanel window state. /// 4 + /// http://tizen.org/feature/attach_panel + /// Thrown when the AttachPanel is not created yet or is already destroyed. + /// Thrown when the AttachPanel is not supported in the device. + /// Thrown when the parameter is invalid public StateType State { get { - int interopState; - Interop.AttachPanel.ErrorCode err = Interop.AttachPanel.GetState(_attachPanel, out interopState); + if (IsAttachPanelSupported() == false) + { + CheckException(Interop.AttachPanel.ErrorCode.NotSupported); + } + + if (IsInitialized() == false) + { + CheckException(Interop.AttachPanel.ErrorCode.NotInitialized); + } + + var err = Interop.AttachPanel.GetState(s_attachPanel, out int interopState); CheckException(err); - StateType state = (StateType)Enum.ToObject(typeof(StateType), interopState); - return state; + + return (StateType)Enum.ToObject(typeof(StateType), interopState); } } @@ -110,14 +114,27 @@ namespace Tizen.Applications.AttachPanel /// /// Visible value of the AttachPanel state. /// 4 + /// http://tizen.org/feature/attach_panel + /// Thrown when the AttachPanel is not created yet or is already destroyed. + /// Thrown when the AttachPanel is not supported in the device. public bool Visible { get { - int visible; - Interop.AttachPanel.ErrorCode err = Interop.AttachPanel.GetVisibility(_attachPanel, out visible); + if (IsAttachPanelSupported() == false) + { + CheckException(Interop.AttachPanel.ErrorCode.NotSupported); + } + + if (IsInitialized() == false) + { + CheckException(Interop.AttachPanel.ErrorCode.NotInitialized); + } + + var err = Interop.AttachPanel.GetVisibility(s_attachPanel, out int visible); CheckException(err); - return (visible == 1); + + return visible == 1; } } @@ -132,11 +149,12 @@ namespace Tizen.Applications.AttachPanel /// http://tizen.org/privilege/appmanager.launch /// http://tizen.org/feature/camera /// http://tizen.org/feature/microphone + /// http://tizen.org/feature/attach_panel /// /// The caller application has to check the return value of this function. /// Content categories will be shown as the sequence of using AddCategory. /// Some contents need time to load it all. - /// So, it is needed to use this before the mainloop of the Show. + /// So, it is needed to use this before the main-loop of the Show. /// Privileges, /// http://tizen.org/privilege/mediastorage, for using Image or Camera. /// http://tizen.org/privilege/camera, for using Camera or TakePicture. @@ -144,6 +162,7 @@ namespace Tizen.Applications.AttachPanel /// http://tizen.org/privilege/appmanager.launch, for adding content categories on the More tab. /// http://tizen.org/feature/camera, for using Camera or TakePicture. /// http://tizen.org/feature/microphone, for using Voice. + /// http://tizen.org/feature/attach_panel, for using attach panel /// Deliver more information to the callee with a bundle if you need. /// http://tizen.org/appcontrol/data/total_count /// http://tizen.org/appcontrol/data/total_size @@ -152,16 +171,27 @@ namespace Tizen.Applications.AttachPanel /// Thrown when the application does not have the privilege to access this method. /// Thrown when the device does not support the feature. /// Thrown when the AttachPanel is not created yet or is already destroyed. + /// Thrown when the AttachPanel is not supported in the device. /// 4 public void AddCategory(ContentCategory category, Bundle extraData) { - IntPtr bundle = IntPtr.Zero; + if (IsAttachPanelSupported() == false) + { + CheckException(Interop.AttachPanel.ErrorCode.NotSupported); + } + + if (IsInitialized() == false) + { + CheckException(Interop.AttachPanel.ErrorCode.NotInitialized); + } + + var bundle = IntPtr.Zero; if (extraData != null) { bundle = extraData.SafeBundleHandle.DangerousGetHandle(); } - Interop.AttachPanel.ErrorCode err = Interop.AttachPanel.AddCategory(_attachPanel, (int)category, bundle); + var err = Interop.AttachPanel.AddCategory(s_attachPanel, (int)category, bundle); CheckException(err); } @@ -169,12 +199,24 @@ namespace Tizen.Applications.AttachPanel /// Removes the ContentCategory from the AttachPanel. /// /// The ContentCategory to be added in the AttachPanel. - /// Thrown when the is not a valid category. + /// http://tizen.org/feature/attach_panel + /// Thrown when the is not a valid category. /// Thrown when the AttachPanel is not created yet or is already destroyed. + /// Thrown when the AttachPanel is not supported in the device. /// 4 public void RemoveCategory(ContentCategory category) { - Interop.AttachPanel.ErrorCode err = Interop.AttachPanel.RemoveCategory(_attachPanel, (int)category); + if (IsAttachPanelSupported() == false) + { + CheckException(Interop.AttachPanel.ErrorCode.NotSupported); + } + + if (IsInitialized() == false) + { + CheckException(Interop.AttachPanel.ErrorCode.NotInitialized); + } + + var err = Interop.AttachPanel.RemoveCategory(s_attachPanel, (int)category); CheckException(err); } @@ -183,9 +225,11 @@ namespace Tizen.Applications.AttachPanel /// /// The ContentCategory that some information is to be set, in the AttachPanel. /// The AttachPanel sends some information using a Bundle. + /// http://tizen.org/feature/attach_panel /// Thrown when the is not a valid category. /// Thrown when the AttachPanel is destroyed. /// Thrown when an attempt to allocate the memory fails. + /// Thrown when the AttachPanel is not supported in the device. /// 4 public void SetExtraData(ContentCategory category, Bundle extraData) { @@ -194,24 +238,46 @@ namespace Tizen.Applications.AttachPanel CheckException(Interop.AttachPanel.ErrorCode.InvalidParameter); } - IntPtr bundle = IntPtr.Zero; + if (IsAttachPanelSupported() == false) + { + CheckException(Interop.AttachPanel.ErrorCode.NotSupported); + } + + if (IsInitialized() == false) + { + CheckException(Interop.AttachPanel.ErrorCode.NotInitialized); + } + + var bundle = IntPtr.Zero; if (extraData != null) { bundle = extraData.SafeBundleHandle.DangerousGetHandle(); } - Interop.AttachPanel.ErrorCode err = Interop.AttachPanel.SetExtraData(_attachPanel, (int)category, bundle); + var err = Interop.AttachPanel.SetExtraData(s_attachPanel, (int)category, bundle); CheckException(err); } /// /// Shows the attach panel with the animations. /// + /// http://tizen.org/feature/attach_panel /// Thrown when the AttachPanel is destroyed. + /// Thrown when the AttachPanel is not supported in the device. /// 4 public void Show() { - Interop.AttachPanel.ErrorCode err = Interop.AttachPanel.Show(_attachPanel); + if (IsAttachPanelSupported() == false) + { + CheckException(Interop.AttachPanel.ErrorCode.NotSupported); + } + + if (IsInitialized() == false) + { + CheckException(Interop.AttachPanel.ErrorCode.NotInitialized); + } + + var err = Interop.AttachPanel.Show(s_attachPanel); CheckException(err); } @@ -219,18 +285,30 @@ namespace Tizen.Applications.AttachPanel /// Shows the attach panel and selects whether or not to animate. /// /// A flag which turns on or turns off the animation while the attach panel is showing. + /// http://tizen.org/feature/attach_panel /// Thrown when the AttachPanel is destroyed. + /// Thrown when the AttachPanel is not supported in the device. /// 4 public void Show(bool animation) { + if (IsAttachPanelSupported() == false) + { + CheckException(Interop.AttachPanel.ErrorCode.NotSupported); + } + + if (IsInitialized() == false) + { + CheckException(Interop.AttachPanel.ErrorCode.NotInitialized); + } + if (animation) { - Interop.AttachPanel.ErrorCode err = Interop.AttachPanel.Show(_attachPanel); + var err = Interop.AttachPanel.Show(s_attachPanel); CheckException(err); } else { - Interop.AttachPanel.ErrorCode err = Interop.AttachPanel.ShowWithoutAnimation(_attachPanel); + var err = Interop.AttachPanel.ShowWithoutAnimation(s_attachPanel); CheckException(err); } } @@ -238,11 +316,23 @@ namespace Tizen.Applications.AttachPanel /// /// Hides the attach panel with the animations. /// + /// http://tizen.org/feature/attach_panel /// Thrown when the AttachPanel is destroyed. + /// Thrown when the AttachPanel is not supported in the device. /// 4 public void Hide() { - Interop.AttachPanel.ErrorCode err = Interop.AttachPanel.Hide(_attachPanel); + if (IsAttachPanelSupported() == false) + { + CheckException(Interop.AttachPanel.ErrorCode.NotSupported); + } + + if (IsInitialized() == false) + { + CheckException(Interop.AttachPanel.ErrorCode.NotInitialized); + } + + var err = Interop.AttachPanel.Hide(s_attachPanel); CheckException(err); } @@ -250,18 +340,30 @@ namespace Tizen.Applications.AttachPanel /// Hides the attach panel and selects whether or not to animate. /// /// A flag which turns on or turns off the animation while the attach panel is hiding. + /// http://tizen.org/feature/attach_panel /// Thrown when the AttachPanel is destroyed. + /// Thrown when the AttachPanel is not supported in the device. /// 4 public void Hide(bool animation) { + if (IsAttachPanelSupported() == false) + { + CheckException(Interop.AttachPanel.ErrorCode.NotSupported); + } + + if (IsInitialized() == false) + { + CheckException(Interop.AttachPanel.ErrorCode.NotInitialized); + } + if (animation) { - Interop.AttachPanel.ErrorCode err = Interop.AttachPanel.Hide(_attachPanel); + var err = Interop.AttachPanel.Hide(s_attachPanel); CheckException(err); } else { - Interop.AttachPanel.ErrorCode err = Interop.AttachPanel.HideWithoutAnimation(_attachPanel); + var err = Interop.AttachPanel.HideWithoutAnimation(s_attachPanel); CheckException(err); } } @@ -274,18 +376,18 @@ namespace Tizen.Applications.AttachPanel { add { - if (_eventEventHandler == null) + if (s_eventEventHandler == null) { StateEventListenStart(); } - _eventEventHandler += value; + s_eventEventHandler += value; } remove { - _eventEventHandler -= value; - if (_eventEventHandler == null) + s_eventEventHandler -= value; + if (s_eventEventHandler == null) { StateEventListenStop(); } @@ -300,18 +402,18 @@ namespace Tizen.Applications.AttachPanel { add { - if (_resultEventHandler == null) + if (s_resultEventHandler == null) { ResultEventListenStart(); } - _resultEventHandler += value; + s_resultEventHandler += value; } remove { - _resultEventHandler -= value; - if (_resultEventHandler == null) + s_resultEventHandler -= value; + if (s_resultEventHandler == null) { ResultEventListenStop(); } diff --git a/src/Tizen.Applications.AttachPanel/Tizen.Applications.AttachPanel/AttachPanelInternal.cs b/src/Tizen.Applications.AttachPanel/Tizen.Applications.AttachPanel/AttachPanelInternal.cs index 827ebdd..bb4ac40 100755 --- a/src/Tizen.Applications.AttachPanel/Tizen.Applications.AttachPanel/AttachPanelInternal.cs +++ b/src/Tizen.Applications.AttachPanel/Tizen.Applications.AttachPanel/AttachPanelInternal.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using Tizen.System; namespace Tizen.Applications.AttachPanel { @@ -9,51 +10,46 @@ namespace Tizen.Applications.AttachPanel /// 4 public partial class AttachPanel { - private static IntPtr _attachPanel; - private bool isCreationSucceed; + private static IntPtr s_attachPanel = IntPtr.Zero; - private static event EventHandler _eventEventHandler; - private static event EventHandler _resultEventHandler; + private static event EventHandler s_eventEventHandler; - private static Interop.AttachPanel.AttachPanelEventCallback SetEventListener; - private static Interop.AttachPanel.AttachPanelResultCallback SetResultListener; + private static event EventHandler s_resultEventHandler; + + private static Interop.AttachPanel.AttachPanelEventCallback s_setEventListener; + private static Interop.AttachPanel.AttachPanelResultCallback s_setResultListener; private void StateEventListenStart() { - Interop.AttachPanel.ErrorCode err = 0; - - SetEventListener = (attachPanel, eventType, eventInfo, userData) => + s_setEventListener = (attachPanel, eventType, eventInfo, userData) => { - _eventEventHandler?.Invoke(null, new StateEventArgs((EventType)eventType)); + s_eventEventHandler?.Invoke(null, new StateEventArgs((EventType)eventType)); }; - err = Interop.AttachPanel.SetEventCb(_attachPanel, SetEventListener, IntPtr.Zero); + var err = Interop.AttachPanel.SetEventCb(s_attachPanel, s_setEventListener, IntPtr.Zero); CheckException(err); } private void StateEventListenStop() { - Interop.AttachPanel.ErrorCode err = 0; - err = Interop.AttachPanel.UnsetEventCb(_attachPanel); + var err = Interop.AttachPanel.UnsetEventCb(s_attachPanel); CheckException(err); } private void ResultEventListenStart() { - Interop.AttachPanel.ErrorCode err = 0; - SetResultListener = (attachPanel, category, resulthandler, resultCode, userData) => + s_setResultListener = (attachPanel, category, resulthandler, resultCode, userData) => { SafeAppControlHandle handle = new SafeAppControlHandle(resulthandler, false); AppControl result = new AppControl(handle); - _resultEventHandler?.Invoke(null, new ResultEventArgs((ContentCategory)category, result, (AppControlReplyResult)resultCode)); + s_resultEventHandler?.Invoke(null, new ResultEventArgs((ContentCategory)category, result, (AppControlReplyResult)resultCode)); }; - err = Interop.AttachPanel.SetResultCb(_attachPanel, SetResultListener, IntPtr.Zero); + var err = Interop.AttachPanel.SetResultCb(s_attachPanel, s_setResultListener, IntPtr.Zero); CheckException(err); } private void ResultEventListenStop() { - Interop.AttachPanel.ErrorCode err = 0; - err = Interop.AttachPanel.UnsetResultCb(_attachPanel); + var err = Interop.AttachPanel.UnsetResultCb(s_attachPanel); CheckException(err); } @@ -62,20 +58,32 @@ namespace Tizen.Applications.AttachPanel switch (err) { case Interop.AttachPanel.ErrorCode.InvalidParameter: - throw new ArgumentOutOfRangeException("Invalid parameter error at unmanaged code"); + throw new ArgumentOutOfRangeException("Invalid parameter"); case Interop.AttachPanel.ErrorCode.OutOfMemory: throw new OutOfMemoryException("Out of Memory"); case Interop.AttachPanel.ErrorCode.PermissionDenied: throw new UnauthorizedAccessException(); case Interop.AttachPanel.ErrorCode.AlreadyExists: - throw new InvalidOperationException("Already Exists"); + throw new InvalidOperationException("AttachPanel is already exists"); case Interop.AttachPanel.ErrorCode.NotInitialized: - throw new InvalidOperationException("Not initialized"); + throw new InvalidOperationException("AttachPanel is not initialized"); case Interop.AttachPanel.ErrorCode.UnsupportedContentCategory: - throw new NotSupportedException("Unsupported Content Category"); + throw new NotSupportedException("Unsupported content category"); case Interop.AttachPanel.ErrorCode.AlreadyDestroyed: - throw new InvalidOperationException("Already Destroyed"); + throw new InvalidOperationException("AttachPanel is already destroyed"); + case Interop.AttachPanel.ErrorCode.NotSupported: + throw new NotSupportedException("AttachPanel is not supported in this device"); } } + + internal static bool IsAttachPanelSupported() + { + return Information.TryGetValue("http://tizen.org/feature/attach_panel", out bool isAttachPanelSupported) && isAttachPanelSupported; + } + + internal static bool IsInitialized() + { + return s_attachPanel != IntPtr.Zero; + } } } diff --git a/src/Tizen.Applications.AttachPanel/Tizen.Applications.AttachPanel/ContentCategory.cs b/src/Tizen.Applications.AttachPanel/Tizen.Applications.AttachPanel/ContentCategory.cs index 845fd81..bc65fc6 100755 --- a/src/Tizen.Applications.AttachPanel/Tizen.Applications.AttachPanel/ContentCategory.cs +++ b/src/Tizen.Applications.AttachPanel/Tizen.Applications.AttachPanel/ContentCategory.cs @@ -10,46 +10,57 @@ namespace Tizen.Applications.AttachPanel /// Attaching images from the gallery. /// Image = 1, + /// /// Taking pictures to attach. /// Camera, + /// /// Taking a voice clip to attach. /// Voice, + /// /// Attaching video from the gallery. /// Video, + /// /// Attaching audio from my files. /// Audio, + /// /// Attaching calendar data from the calendar. /// Calendar, + /// /// Attaching contact data from the contacts. /// Contact, + /// /// Attaching files data from my files. /// Myfiles, + /// /// Taking a video clip to attach. /// VideoRecorder, + /// /// Attaching files from the document list. /// Document, + /// /// Launching apps to take pictures will be attached. /// TakePicture, + /// /// Attaching memo data from the memo. /// diff --git a/src/Tizen.Applications.AttachPanel/Tizen.Applications.AttachPanel/EventType.cs b/src/Tizen.Applications.AttachPanel/Tizen.Applications.AttachPanel/EventType.cs index a4f76da..f5906a6 100755 --- a/src/Tizen.Applications.AttachPanel/Tizen.Applications.AttachPanel/EventType.cs +++ b/src/Tizen.Applications.AttachPanel/Tizen.Applications.AttachPanel/EventType.cs @@ -10,14 +10,17 @@ namespace Tizen.Applications.AttachPanel /// Attach panel starts the effect to show. /// ShowStart = 1, + /// /// Attach panel finishes the effect to show. /// ShowFinish, + /// /// Attach panel starts the effect to hide the panel. /// HideStart, + /// /// Attach panel finishes the effect to hide the panel. /// diff --git a/src/Tizen.Applications.AttachPanel/Tizen.Applications.AttachPanel/StateType.cs b/src/Tizen.Applications.AttachPanel/Tizen.Applications.AttachPanel/StateType.cs index 770e46f..da250b6 100755 --- a/src/Tizen.Applications.AttachPanel/Tizen.Applications.AttachPanel/StateType.cs +++ b/src/Tizen.Applications.AttachPanel/Tizen.Applications.AttachPanel/StateType.cs @@ -10,10 +10,12 @@ namespace Tizen.Applications.AttachPanel /// Attach panel is not visible. /// Hidden = 0, + /// /// Attach panel is in the partial window mode. /// Partial, + /// /// Attach panel is in the full screen mode. /// -- 2.7.4