[AttachPanel] Remove incorrect event args and Modify the property type 80/152980/2
authormoon87.park <moon87.park@samsung.com>
Wed, 27 Sep 2017 12:04:07 +0000 (21:04 +0900)
committerMoonkyoung Park <moon87.park@samsung.com>
Wed, 11 Oct 2017 08:33:41 +0000 (08:33 +0000)
Change-Id: Ifdb6cdb7b9ae708d69f896cb09da20f240b5e5ae
Signed-off-by: moon87.park <moon87.park@samsung.com>
src/Tizen.Applications.AttachPanel/Interop/Interop.AttachPanel.cs
src/Tizen.Applications.AttachPanel/Interop/Interop.Libraries.cs
src/Tizen.Applications.AttachPanel/Tizen.Applications.AttachPanel.csproj
src/Tizen.Applications.AttachPanel/Tizen.Applications.AttachPanel.sln
src/Tizen.Applications.AttachPanel/Tizen.Applications.AttachPanel/AttachPanel.cs
src/Tizen.Applications.AttachPanel/Tizen.Applications.AttachPanel/AttachPanelInternal.cs
src/Tizen.Applications.AttachPanel/Tizen.Applications.AttachPanel/ResultEventArgs.cs
src/Tizen.Applications.AttachPanel/Tizen.Applications.AttachPanel/StateEventArgs.cs

index 3718191..6d0d864 100755 (executable)
@@ -2,8 +2,14 @@ using System;
 using System.Runtime.InteropServices;
 using Tizen.Applications;
 
+/// <summary>
+/// Interoperability support class for Tizen APIs
+/// </summary>
 internal static partial class Interop
 {
+    /// <summary>
+    /// Interoperability support class for the attach panel APIs
+    /// </summary>
     internal static partial class AttachPanel
     {
         internal enum ErrorCode : int
index 4b4049b..b0f7efa 100755 (executable)
@@ -1,5 +1,11 @@
+/// <summary>
+/// Interoperability support class for the attach panel APIs
+/// </summary>
 internal static partial class Interop
 {
+    /// <summary>
+    /// Interoperability support class for the API library
+    /// </summary>
     internal static partial class Libraries
     {
         public const string AttachPanel = "libattach-panel.so.0.1.0";
index 020b2cb..b16fa50 100755 (executable)
@@ -5,6 +5,7 @@
   </PropertyGroup>
 
   <ItemGroup>
+    <ProjectReference Include="..\ElmSharp\ElmSharp.csproj" />
     <ProjectReference Include="..\Tizen.Applications.Common\Tizen.Applications.Common.csproj" />
   </ItemGroup>
 
index 8eeff18..644bd5d 100755 (executable)
@@ -1,9 +1,12 @@
 
 Microsoft Visual Studio Solution File, Format Version 12.00
 # Visual Studio 15
-VisualStudioVersion = 15.0.26430.12
+VisualStudioVersion = 15.0.26730.12
 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}
+       EndProjectSection
 EndProject
 Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.Applications.Common", "..\Tizen.Applications.Common\Tizen.Applications.Common.csproj", "{D2B5F854-4FE1-473C-A8E3-53ABB0A966AA}"
 EndProject
@@ -11,6 +14,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen", "..\Tizen\Tizen.csp
 EndProject
 Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.Log", "..\Tizen.Log\Tizen.Log.csproj", "{AFF3D5BA-42DA-40CE-BC57-0DC1E92673B9}"
 EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ElmSharp", "..\ElmSharp\ElmSharp.csproj", "{AF2CEEB1-B3B2-4E2D-8854-A54871CD0D1C}"
+EndProject
 Global
        GlobalSection(SolutionConfigurationPlatforms) = preSolution
                Debug|Any CPU = Debug|Any CPU
@@ -33,8 +38,15 @@ Global
                {AFF3D5BA-42DA-40CE-BC57-0DC1E92673B9}.Debug|Any CPU.Build.0 = Debug|Any CPU
                {AFF3D5BA-42DA-40CE-BC57-0DC1E92673B9}.Release|Any CPU.ActiveCfg = Release|Any CPU
                {AFF3D5BA-42DA-40CE-BC57-0DC1E92673B9}.Release|Any CPU.Build.0 = Release|Any CPU
+               {AF2CEEB1-B3B2-4E2D-8854-A54871CD0D1C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+               {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
        EndGlobalSection
        GlobalSection(SolutionProperties) = preSolution
                HideSolutionNode = FALSE
        EndGlobalSection
+       GlobalSection(ExtensibilityGlobals) = postSolution
+               SolutionGuid = {7169FEAE-EE0D-4B29-B710-F504A6B82E8C}
+       EndGlobalSection
 EndGlobal
index 3c220bd..33c777b 100755 (executable)
@@ -1,3 +1,4 @@
+using ElmSharp;
 using System;
 
 namespace Tizen.Applications.AttachPanel
@@ -14,15 +15,49 @@ namespace Tizen.Applications.AttachPanel
         /// <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);
+
+            Tizen.Log.Debug("AttachPanelSharp", "Success to create an AttachPanel Instance");
+            isCreationSucceed = true;
+            _attachPanel = candidateAttachPanel;
+
+            if (_eventEventHandler == null)
+            {
+                StateEventListenStart();
+            }
+
+            if (_resultEventHandler == null)
+            {
+                ResultEventListenStart();
+            }
+        }
+
+        /// <summary>
+        /// Represents immutable class for attach panel.
+        /// </summary>
+        /// <since_tizen> 3 </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);
+            CheckException(err);
 
             Tizen.Log.Debug("AttachPanelSharp", "Success to create an AttachPanel Instance");
             isCreationSucceed = true;
@@ -48,7 +83,7 @@ namespace Tizen.Applications.AttachPanel
                 _attachPanel != IntPtr.Zero)
             {
                 Interop.AttachPanel.ErrorCode err = Interop.AttachPanel.DestroyAttachPanel(_attachPanel);
-                checkException(err);
+                CheckException(err);
                 _attachPanel = IntPtr.Zero;
             }
         }
@@ -57,13 +92,14 @@ namespace Tizen.Applications.AttachPanel
         /// Gets the state of the AttachPanel.
         /// </summary>
         /// <value>The AttachPanel window state</value>
-        public int State
+        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;
             }
         }
@@ -72,14 +108,14 @@ namespace Tizen.Applications.AttachPanel
         /// Gets the value that indicates whether the AttachPanel is visible.
         /// </summary>
         /// <value>visible value of AttachPanel state</value>
-        public int Visible
+        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);
             }
         }
 
@@ -121,8 +157,9 @@ namespace Tizen.Applications.AttachPanel
             {
                 bundle = extraData.SafeBundleHandle.DangerousGetHandle();
             }
+
             Interop.AttachPanel.ErrorCode err = Interop.AttachPanel.AddCategory(_attachPanel, (int)category, bundle);
-            checkException(err);
+            CheckException(err);
         }
 
         /// <summary>
@@ -134,7 +171,7 @@ namespace Tizen.Applications.AttachPanel
         public void RemoveCategory(ContentCategory category)
         {
             Interop.AttachPanel.ErrorCode err = Interop.AttachPanel.RemoveCategory(_attachPanel, (int)category);
-            checkException(err);
+            CheckException(err);
         }
 
         /// <summary>
@@ -147,9 +184,9 @@ namespace Tizen.Applications.AttachPanel
         /// <exception cref="OutOfMemoryException">Thrown when an attempt to allocate memory fails.</exception>
         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;
@@ -157,8 +194,9 @@ namespace Tizen.Applications.AttachPanel
             {
                 bundle = extraData.SafeBundleHandle.DangerousGetHandle();
             }
+
             Interop.AttachPanel.ErrorCode err = Interop.AttachPanel.SetExtraData(_attachPanel, (int)category, bundle);
-            checkException(err);
+            CheckException(err);
         }
 
         /// <summary>
@@ -168,24 +206,25 @@ namespace Tizen.Applications.AttachPanel
         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>
         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);
             }
         }
 
@@ -196,24 +235,25 @@ namespace Tizen.Applications.AttachPanel
         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>
         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);
             }
         }
 
@@ -228,8 +268,10 @@ namespace Tizen.Applications.AttachPanel
                 {
                     StateEventListenStart();
                 }
+
                 _eventEventHandler += value;
             }
+
             remove
             {
                 _eventEventHandler -= value;
@@ -251,8 +293,10 @@ namespace Tizen.Applications.AttachPanel
                 {
                     ResultEventListenStart();
                 }
+
                 _resultEventHandler += value;
             }
+
             remove
             {
                 _resultEventHandler -= value;
index e40af2d..7eaa1be 100755 (executable)
@@ -3,6 +3,9 @@ using System.Collections.Generic;
 
 namespace Tizen.Applications.AttachPanel
 {
+    /// <summary>
+    /// Attach panel internal implementation
+    /// </summary>
     public partial class AttachPanel
     {
         private static IntPtr _attachPanel;
@@ -20,16 +23,17 @@ namespace Tizen.Applications.AttachPanel
 
             SetEventListener = (attachPanel, eventType, eventInfo, userData) =>
             {
-                _eventEventHandler?.Invoke(null, new StateEventArgs(attachPanel, (EventType)eventType, eventInfo, userData));
+                _eventEventHandler?.Invoke(null, new StateEventArgs((EventType)eventType));
             };
             err = Interop.AttachPanel.SetEventCb(_attachPanel, SetEventListener, IntPtr.Zero);
-            checkException(err);
+            CheckException(err);
         }
+
         private void StateEventListenStop()
         {
             Interop.AttachPanel.ErrorCode err = 0;
-            err =  Interop.AttachPanel.UnsetEventCb(_attachPanel);
-            checkException(err);
+            err = Interop.AttachPanel.UnsetEventCb(_attachPanel);
+            CheckException(err);
         }
 
         private void ResultEventListenStart()
@@ -39,20 +43,20 @@ namespace Tizen.Applications.AttachPanel
             {
                 SafeAppControlHandle handle = new SafeAppControlHandle(resulthandler, false);
                 AppControl result = new AppControl(handle);
-                _resultEventHandler?.Invoke(null, new ResultEventArgs(attachPanel, (ContentCategory)category, result, (AppControlReplyResult)resultCode, userData));
+                _resultEventHandler?.Invoke(null, new ResultEventArgs((ContentCategory)category, result, (AppControlReplyResult)resultCode));
             };
             err = Interop.AttachPanel.SetResultCb(_attachPanel, SetResultListener, IntPtr.Zero);
-            checkException(err);
+            CheckException(err);
         }
 
         private void ResultEventListenStop()
         {
             Interop.AttachPanel.ErrorCode err = 0;
             err = Interop.AttachPanel.UnsetResultCb(_attachPanel);
-            checkException(err);
+            CheckException(err);
         }
 
-        internal static void checkException(Interop.AttachPanel.ErrorCode err)
+        internal static void CheckException(Interop.AttachPanel.ErrorCode err)
         {
             switch (err)
             {
index 6628b9d..9c933d7 100755 (executable)
@@ -7,45 +7,49 @@ namespace Tizen.Applications.AttachPanel
     /// </summary>
     public class ResultEventArgs : EventArgs
     {
-        private readonly IntPtr _attachPanel;
         private readonly ContentCategory _category;
         private readonly AppControl _result;
         private readonly AppControlReplyResult _resultCode;
-        private readonly IntPtr _userData;
 
-        internal ResultEventArgs(IntPtr attachPanel, ContentCategory category, AppControl result, AppControlReplyResult resultCode, IntPtr userData)
+        internal ResultEventArgs(ContentCategory category, AppControl result, AppControlReplyResult resultCode)
         {
-            _attachPanel = attachPanel;
             _category = category;
             _result = result;
             _resultCode = resultCode;
-            _userData = userData;
         }
 
         /// <summary>
-        ///  Property for attach panel object.
-        /// </summary>
-        public IntPtr AttachPanel { get { return _attachPanel; } }
-
-        /// <summary>
         /// Results are from the content category.
         /// </summary>
-        public ContentCategory Category { get { return _category; } }
+        public ContentCategory Category
+        {
+            get
+            {
+                return _category;
+            }
+        }
 
         /// <summary>
         /// Property for result
         /// The caller app has to use ExtraData property to get received data.
         /// </summary>
-        public AppControl Result {  get { return _result; } }
+        public AppControl Result
+        {
+            get
+            {
+                return _result;
+            }
+        }
 
         /// <summary>
         /// Property for result of AppControl
         /// </summary>
-        public AppControlReplyResult ResultCode { get { return _resultCode; } }
-
-        /// <summary>
-        /// Property for user data
-        /// </summary>
-        public IntPtr UserData { get { return _userData; } }
+        public AppControlReplyResult ResultCode
+        {
+            get
+            {
+                return _resultCode;
+            }
+        }
     }
 }
index 5354c5f..4373e27 100755 (executable)
@@ -7,38 +7,22 @@ namespace Tizen.Applications.AttachPanel
     /// </summary>
     public class StateEventArgs : EventArgs
     {
-        private readonly IntPtr _attachPanel;
         private readonly EventType _eventType;
-        private readonly IntPtr _eventInfo;
-        private readonly IntPtr _userData;
 
-        internal StateEventArgs(IntPtr attachPanel, EventType eventType, IntPtr eventInfo, IntPtr userData)
+        internal StateEventArgs(EventType eventType)
         {
-            _attachPanel = attachPanel;
             _eventType = eventType;
-            _eventInfo = eventInfo;
-            _userData = userData;
         }
 
         /// <summary>
-        /// Property for attach panel object
-        /// </summary>
-        public IntPtr AttachPanel { get { return _attachPanel;  } }
-
-        /// <summary>
         /// Property for event type.
         /// </summary>
-        public EventType EventType { get { return _eventType;  } }
-
-        /// <summary>
-        /// Additional event information.
-        /// This can be NULL if there are no necessary information.
-        /// </summary>
-        public IntPtr EventInfo {  get { return _eventInfo;  } }
-
-        /// <summary>
-        /// Property for user data.
-        /// </summary>
-        public IntPtr UserData { get { return _userData; } }
+        public EventType EventType
+        {
+            get
+            {
+                return _eventType;
+            }
+        }
     }
 }