X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=src%2FTizen.Applications.Notification%2FTizen.Applications.Notifications%2FNotification.cs;h=8c12f401f23f3eaf002fa52f48af3fa8e87f8b80;hb=95bdc3b58c1511c21d02ad8c7feba75a89cfba02;hp=ec7202a89c090ba2ef34d7b985155f84b2c4a101;hpb=09522e322c3272c3d48bdfbec3edd9b22a0822d0;p=platform%2Fcore%2Fcsapi%2Ftizenfx.git diff --git a/src/Tizen.Applications.Notification/Tizen.Applications.Notifications/Notification.cs b/src/Tizen.Applications.Notification/Tizen.Applications.Notifications/Notification.cs index ec7202a..8c12f40 100755 --- a/src/Tizen.Applications.Notification/Tizen.Applications.Notifications/Notification.cs +++ b/src/Tizen.Applications.Notification/Tizen.Applications.Notifications/Notification.cs @@ -21,7 +21,7 @@ namespace Tizen.Applications.Notifications using System.ComponentModel; /// - /// Class containing common properties and methods of Notifications + /// This class contains common properties and methods of notifications. /// /// /// A notification is a message that is displayed on the notification area. @@ -36,7 +36,7 @@ namespace Tizen.Applications.Notifications private bool disposed = false; private IDictionary styleDictionary; - private IDictionary extenderDictionary; + private IDictionary extraDataDictionary; private int count = 0; /// @@ -45,53 +45,55 @@ namespace Tizen.Applications.Notifications public Notification() { styleDictionary = new Dictionary(); - extenderDictionary = new Dictionary(); + extraDataDictionary = new Dictionary(); } /// - /// Gets or sets Tag of Notification. + /// Gets or sets the tag of notification. /// public string Tag { get; set; } = string.Empty; /// - /// Gets or sets Title of Notification. + /// Gets or sets the title of notification. /// public string Title { get; set; } = string.Empty; /// - /// Gets or sets icon of Notification. + /// Gets or sets the icon of notification. + /// You should set an absolute path for an image file. /// public string Icon { get; set; } = string.Empty; /// - /// Gets or sets sub icon of Notification. + /// Gets or sets the sub icon of notification. /// This SubIcon is displayed in Icon you set. + /// You should set an absolute path for an image file. /// public string SubIcon { get; set; } = string.Empty; /// - /// Gets or sets content of Notification. + /// Gets or sets the content of notification. /// public string Content { get; set; } = string.Empty; /// - /// Gets or sets a value indicating whether TimeStamp of Notification is Visible or not. + /// Gets or sets a value indicating whether TimeStamp of the notification is Visible or not. /// Default to true. /// public bool IsTimeStampVisible { get; set; } = true; /// - /// Gets or sets TimeStamp of Notification. + /// Gets or sets the TimeStamp of notification. /// /// - /// If you don't set TimeStamp, It will be set value that time when the notification is posted. + /// If you don't set TimeStamp, it will set the value when the notification is posted. /// TimeStamp requires NotificationManager.Post() to be called. - /// If you set IsVisibleTimeStamp property is false, TimeStamp is not Visible in Notification. + /// If you set IsVisibleTimeStamp property to false, TimeStamp is not visible in notification. /// public DateTime TimeStamp { get; set; } /// - /// Gets or sets Action which is invoked when notification is clicked + /// Gets or sets action, which is invoked when the notification is clicked. /// /// /// If you set it to null, the already set AppControl will be removed and nothing will happen when you click on notification. @@ -100,13 +102,13 @@ namespace Tizen.Applications.Notifications public AppControl Action { get; set; } /// - /// Gets or sets Count which is displayed at the right side of notification. + /// Gets or sets count, which is displayed at the right side of the notification. /// /// /// You must set only positive number. - /// If you set count to negative number, This property throw exception. + /// If you set count to negative number, this property throws exception. /// - /// Thrown when argument is invalid + /// Thrown when argument is invalid. public int Count { get @@ -126,23 +128,27 @@ namespace Tizen.Applications.Notifications } } + /// + /// Gets or sets a value indicating whether the notification is Onging or not. + /// Default value is false. + /// [EditorBrowsable(EditorBrowsableState.Never)] public bool IsOngoing { get; set; } = false; /// - /// Gets or sets property + /// Gets or sets property. /// /// public NotificationProperty Property { get; set; } = NotificationProperty.None; /// - /// Gets or sets object for display at notification + /// Gets or sets object for display at notification. /// /// public ProgressType Progress { get; set; } /// - /// Gets or sets which is included vibration, led and sound option to be applied at Notification. + /// Gets or sets which is included vibration, LED and sound option to be applied at notification. /// /// /// If you set it to null, the already set AccessorySet will be initialized. @@ -176,13 +182,13 @@ namespace Tizen.Applications.Notifications public AccessorySet Accessory { get; set; } /// - /// Gets or sets a value indicating whether notification is displayed on default viewer. + /// Gets or sets a value indicating whether notification is displayed on the default viewer. /// If you set false and add style, you can see only style notification. /// - public bool IsDisplay { get; set; } = true; + public bool IsVisible { get; set; } = true; /// - /// Gets or sets NotificationSafeHandle + /// Gets or sets NotificationSafeHandle. /// internal NotificationSafeHandle Handle { @@ -204,19 +210,19 @@ namespace Tizen.Applications.Notifications } /// - /// Gets or sets Private ID + /// Gets or sets private ID. /// internal int PrivID { get; set; } = -1; /// - /// Method to add various style to be applied to notification. + /// Method for adding various styles to be applied to notification. /// /// - /// The user always see about valid notification style. If you add style which is not supported in platform, + /// The user always see about valid notification style. If you add a style which is not supported in platform, /// this method has no effect. /// - /// The style to be applied to notification - /// Thrown when argument is invalid + /// The style to be applied to notification. + /// Thrown when argument is invalid. /// /// /// Notification notification = new Notification @@ -260,8 +266,8 @@ namespace Tizen.Applications.Notifications /// /// Method to remove style you already added. /// - /// Type of notification style to be queried - /// Thrown when argument is invalid + /// Type of notification style to be queried. + /// Thrown when argument is invalid. public void RemoveStyle() where T : Notification.StyleBase, new() { T type = new T(); @@ -280,11 +286,11 @@ namespace Tizen.Applications.Notifications /// /// Method to get style you already added. /// - /// Type of notification style to be queried + /// Type of notification style to be queried. /// - /// The Notification.Style object associated with the given style + /// The Notification.Style object associated with the given style. /// - /// Thrown when argument is invalid + /// Thrown when argument is invalid. public T GetStyle() where T : Notification.StyleBase, new() { T type = new T(); @@ -304,14 +310,14 @@ namespace Tizen.Applications.Notifications } /// - /// Method to set extender data to add extra data + /// Method to set extra data to add extra data. /// /// - /// The type of extra data is Bundle. + /// The type of extra data is bundle. /// /// The key of the extra data you want to add. /// The value you want to add. - /// Thrown when argument is invalid + /// Thrown when argument is invalid. /// /// /// Notification notification = new Notification @@ -324,46 +330,46 @@ namespace Tizen.Applications.Notifications /// Bundle bundle = new Bundle(); /// bundle.AddItem("key", "value"); /// - /// notification.SetExtender("firstKey", bundle); + /// notification.SetExtraData("firstKey", bundle); /// /// - public void SetExtender(string key, Bundle value) + public void SetExtraData(string key, Bundle value) { if (value == null || value.SafeBundleHandle.IsInvalid || string.IsNullOrEmpty(key)) { throw NotificationErrorFactory.GetException(NotificationError.InvalidParameter, "invalid parameter entered"); } - if (extenderDictionary.ContainsKey(key) == true) + if (extraDataDictionary.ContainsKey(key) == true) { Log.Info(LogTag, "The key is existed, so extender data is replaced"); - extenderDictionary.Remove(key); - extenderDictionary.Add(key, value); + extraDataDictionary.Remove(key); + extraDataDictionary.Add(key, value); } else { - extenderDictionary.Add(key, value); + extraDataDictionary.Add(key, value); } } /// - /// Method to remove extender you already added. + /// Method to remove extra you already added. /// /// - /// The type of extra data is Bundle. + /// The type of extra data is bundle. /// /// The key of the extra data to add. - /// Thrown when argument is invalid - public void RemoveExtender(string key) + /// Thrown when argument is invalid. + public void RemoveExtraData(string key) { if (string.IsNullOrEmpty(key)) { throw NotificationErrorFactory.GetException(NotificationError.InvalidParameter, "invalid parameter entered"); } - if (extenderDictionary.ContainsKey(key)) + if (extraDataDictionary.ContainsKey(key)) { - extenderDictionary.Remove(key); + extraDataDictionary.Remove(key); } else { @@ -372,12 +378,12 @@ namespace Tizen.Applications.Notifications } /// - /// Method to get extender data you already set + /// Method to get extra data you already set. /// /// The key of the extra data to get. - /// Bundle Object that include extender data - /// Thrown when argument is invalid - public Bundle GetExtender(string key) + /// Bundle Object that include extra data + /// Thrown when argument is invalid. + public Bundle GetExtraData(string key) { if (string.IsNullOrEmpty(key)) { @@ -385,7 +391,7 @@ namespace Tizen.Applications.Notifications } Bundle bundle; - if (extenderDictionary.TryGetValue(key, out bundle) == false) + if (extraDataDictionary.TryGetValue(key, out bundle) == false) { throw NotificationErrorFactory.GetException(NotificationError.InvalidParameter, "invalid parameter entered : " + key); } @@ -409,7 +415,7 @@ namespace Tizen.Applications.Notifications return; } - if (disposing) + if (disposing && Handle != null && Handle.IsInvalid == false) { Handle.Dispose(); } @@ -422,9 +428,9 @@ namespace Tizen.Applications.Notifications return styleDictionary; } - internal IDictionary GetExtenderDictionary() + internal IDictionary GetextraDataDictionary() { - return extenderDictionary; + return extraDataDictionary; } internal StyleBase GetStyle(string key) @@ -448,10 +454,10 @@ namespace Tizen.Applications.Notifications { NotificationBinder.BindObject(this); - foreach (string key in GetExtenderDictionary().Keys) + foreach (string key in GetextraDataDictionary().Keys) { Log.Info(LogTag, "Start to bind Notification.ExtenderData to SafeHandle"); - Interop.Notification.SetExtentionData(Handle, key, extenderDictionary[key].SafeBundleHandle); + Interop.Notification.SetExtentionData(Handle, key, extraDataDictionary[key].SafeBundleHandle); } foreach (Notification.StyleBase style in styleDictionary.Values) @@ -487,9 +493,12 @@ namespace Tizen.Applications.Notifications Bundle bundle = new Bundle(new SafeBundleHandle(extention, false)); foreach (string key in bundle.Keys) { + if (key.StartsWith("_NOTIFICATION_EXTENSION_EVENT_")) + continue; + SafeBundleHandle sbh; Interop.Notification.GetExtentionData(Handle, key, out sbh); - extenderDictionary.Add(key, new Bundle(sbh)); + extraDataDictionary.Add(key, new Bundle(sbh)); } }