/* * Copyright (c) 2017 Samsung Electronics Co., Ltd All Rights Reserved * * Licensed under the Apache License, Version 2.0 (the License); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an AS IS BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ namespace Tizen.Applications.NotificationEventListener { using System; using System.Collections.Generic; using System.ComponentModel; /// /// This class provides the methods and properties to get information about the posted or updated notification. /// public partial class NotificationEventArgs : EventArgs { private const string LogTag = "Tizen.Applications.NotificationEventListener"; internal IDictionary Style; internal IDictionary ExtraData; internal Interop.NotificationEventListener.NotificationSafeHandle Handle; /// /// Initializes a new instance of the class. /// /// 4 public NotificationEventArgs() { Style = new Dictionary(); ExtraData = new Dictionary(); } /// /// Gets the unique ID of the notification. /// /// 4 public int UniqueNumber { get; internal set; } /// /// Gets the appId of the notification. /// /// 4 public string AppID { get; internal set; } /// /// Gets the title of the notification. /// /// 4 public string Title { get; internal set; } /// /// Gets the content text of the notification. /// /// 4 public string Content { get; internal set; } /// /// Gets the icon's path of the notification. /// /// 4 public string Icon { get; internal set; } /// /// Gets the sub icon path of the notification. /// /// 4 public string SubIcon { get; internal set; } /// /// Gets the timestamp if the notification is visible or not. /// /// 4 public bool IsTimeStampVisible { get; internal set; } /// /// Gets TimeStamp of notification. /// /// /// If IsTimeStampVisible property is set false, this TimeStamp property is meaningless. /// /// 4 public DateTime TimeStamp { get; internal set; } /// /// Gets the count, which is displayed at the right side of notification. /// /// 4 public int Count { get; internal set; } /// /// Gets the tag of notification. /// /// 4 public string Tag { get; internal set; } /// /// Gets a value indicating whether the notification is Onging or not. /// /// 4 [EditorBrowsable(EditorBrowsableState.Never)] public bool IsOngoing { get; internal set; } = false; /// /// Gets a value that determines whether notification is displayed on the default viewer. /// If IsDisplay property is set as false and add style, you can see only style notification. /// /// 4 public bool IsVisible { get; internal set; } = true; /// /// Gets the event flag. /// If this flag is true, you can do SendEvent. /// /// 4 [EditorBrowsable(EditorBrowsableState.Never)] public bool HasEventFlag { get; internal set; } = false; /// /// Gets the AppControl, which is invoked when notification is clicked. /// /// 4 public AppControl Action { get; internal set; } /// /// Gets the object of the progress notification. /// /// 4 public ProgressArgs Progress { get; internal set; } /// /// Gets the AccessoryArgs, which has option of sound, vibration, and LED. /// /// 4 public AccessoryArgs Accessory { get; internal set; } /// /// Gets the key for extra data. /// /// 4 public ICollection ExtraDataKey { get { return ExtraData.Keys; } } /// /// Gets the property. /// /// 4 public NotificationProperty Property { get; internal set; } /// /// Gets the styleArgs of active, lock, indicator, and bigpicture. /// /// Type of notification style to be queried. /// The NotificationEventListener.StyleArgs object associated with the given style. /// Thrown when an argument is invalid. /// 4 public T GetStyle() where T : StyleArgs, new() { T type = new T(); StyleArgs style = null; Style.TryGetValue(type.Key, out style); if (style == null) { Log.Error(LogTag, "Invalid Style"); throw NotificationEventListenerErrorFactory.GetException(Interop.NotificationEventListener.ErrorCode.InvalidParameter, "invalid parameter entered"); } else { return style as T; } } /// /// Gets the ExtraDataArgs. /// /// The key that specifies which extra data. /// Returns the bundle for key. /// 4 public Bundle GetExtraData(string key) { Bundle bundle; if (string.IsNullOrEmpty(key)) { throw NotificationEventListenerErrorFactory.GetException(Interop.NotificationEventListener.ErrorCode.InvalidParameter, "invalid parameter entered"); } if (ExtraData.TryGetValue(key, out bundle) == false) { throw NotificationEventListenerErrorFactory.GetException(Interop.NotificationEventListener.ErrorCode.InvalidParameter, "invalid parameter entered : " + key); } return bundle; } } }