Clean up Tizen.Applications.Messages
authorWonYoung Choi <wy80.choi@samsung.com>
Tue, 26 Apr 2016 11:40:55 +0000 (20:40 +0900)
committerWonYoung Choi <wy80.choi@samsung.com>
Tue, 26 Apr 2016 11:40:55 +0000 (20:40 +0900)
Change-Id: I7f732388d58053523b7901da816f5c2357479743

Tizen.Applications/Tizen.Applications.Messages/MessagePort.cs
Tizen.Applications/Tizen.Applications.Messages/MessagePortErrorFactory.cs
Tizen.Applications/Tizen.Applications.Messages/MessageReceivedEventArgs.cs
Tizen.Applications/Tizen.Applications.Messages/RemoteValues.cs

index 48b6cf1..2cd1d8d 100755 (executable)
@@ -1,11 +1,5 @@
 using System;
 using System.Collections.Generic;
-using System.IO;
-using System.Linq;
-using System.Runtime.InteropServices;
-using System.Text;
-using System.Threading.Tasks;
-using Tizen.Internals;
 
 namespace Tizen.Applications.Messages
 {
@@ -22,6 +16,20 @@ namespace Tizen.Applications.Messages
         private static readonly object s_lock = new object();
         private static readonly HashSet<string> s_portMap = new HashSet<string>();
 
+        // The name of the local message port
+        private readonly string _portName = null;
+
+        // If true the message port is a trusted port, otherwise false it is not
+        private readonly bool _trusted = false;
+
+        // The local message port ID
+        private int _portId = 0;
+
+        // If true the message port is listening, otherwise false it is not
+        private bool _listening = false;
+
+        private Interop.MessagePort.message_port_message_cb _messageCallBack;
+
         /// <summary>
         /// Initializes the instance of the MessagePort class.
         /// </summary>
@@ -83,28 +91,6 @@ namespace Tizen.Applications.Messages
         }
 
         /// <summary>
-        /// The local message port ID
-        /// </summary>
-        private int _portId = 0;
-
-        /// <summary>
-        /// The name of the local message port
-        /// </summary>
-        private readonly string _portName = null;
-
-        /// <summary>
-        /// If true the message port is a trusted port, otherwise false it is not
-        /// </summary>
-        private readonly bool _trusted = false;
-
-        /// <summary>
-        /// If true the message port is listening, otherwise false it is not
-        /// </summary>
-        private bool _listening = false;
-
-        private Interop.MessagePort.message_port_message_cb _messageCallBack;
-
-        /// <summary>
         /// Register the local message port.
         /// </summary>
         public void Listen()
@@ -131,7 +117,7 @@ namespace Tizen.Applications.Messages
                             Trusted = trusted
                         };
                     }
-                    RaiseMessageReceivedEvent(MessageReceived, args);
+                    MessageReceived?.Invoke(this, args);
                 };
 
                 _portId = _trusted ?
@@ -215,14 +201,6 @@ namespace Tizen.Applications.Messages
             }
         }
 
-        private void RaiseMessageReceivedEvent(EventHandler<MessageReceivedEventArgs> evt, MessageReceivedEventArgs args)
-        {
-            if (evt != null)
-            {
-                evt(this, args);
-            }
-        }
-
         /// <summary>
         /// Releases the unmanaged resourced used by the MessagePort class specifying whether to perform a normal dispose operation.
         /// </summary>
@@ -237,7 +215,7 @@ namespace Tizen.Applications.Messages
                 }
                 catch (Exception e)
                 {
-                    Tizen.Log.Warn(GetType().Namespace, "Exception in Dispose :" + e.Message);
+                    Log.Warn(GetType().Namespace, "Exception in Dispose :" + e.Message);
                 }
             }
         }
index ac8bf68..ed74f34 100755 (executable)
@@ -1,8 +1,4 @@
 using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
 using Tizen.Internals.Errors;
 
 namespace Tizen.Applications.Messages
@@ -19,6 +15,7 @@ namespace Tizen.Applications.Messages
         MaxExceeded = -0x01130000 | 0x03,
         ResourceUnavailable = -0x01130000 | 0x04
     }
+
     internal static class MessagePortErrorFactory
     {
         internal static void ThrowException(int errorCode, string errorMessage = null, string paramName = null)
index d3f9121..626886a 100755 (executable)
@@ -1,8 +1,4 @@
 using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
 
 namespace Tizen.Applications.Messages
 {
@@ -14,19 +10,11 @@ namespace Tizen.Applications.Messages
         /// <summary>
         /// Contains AppId, Port Name, Trusted
         /// </summary>
-        public RemoteValues Remote
-        {
-            get;
-            internal set;
-        }
+        public RemoteValues Remote { get; internal set; }
 
         /// <summary>
         /// The message passed from the remote application
         /// </summary>
-        public Bundle Message
-        {
-            get;
-            internal set;
-        }
+        public Bundle Message { get; internal set; }
     }
 }
index f11cfff..a2890a9 100755 (executable)
@@ -1,9 +1,3 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
 namespace Tizen.Applications.Messages
 {
     /// <summary>
@@ -14,25 +8,16 @@ namespace Tizen.Applications.Messages
         /// <summary>
         /// The ID of the remote application that sent this message
         /// </summary>
-        public string AppId
-        {
-            get; set;
-        }
+        public string AppId { get; set; }
+
         /// <summary>
         /// The name of the remote message port
         /// </summary>
-        public string PortName
-        {
-            get;
-            set;
-        }
+        public string PortName { get; set; }
+
         /// <summary>
         /// If true the remote port is a trusted port, otherwise if false it is not
         /// </summary>
-        public bool Trusted
-        {
-            get;
-            set;
-        }
+        public bool Trusted { get; set; }
     }
 }