2 * Copyright (c) 2017 Samsung Electronics Co., Ltd All Rights Reserved
4 * Licensed under the Apache License, Version 2.0 (the License);
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an AS IS BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 namespace Tizen.Applications.Notifications
22 /// This class contains common properties and methods of notifications.
25 /// A notification is a message that is displayed on the notification area.
26 /// It is created to notify information to the user through the application.
27 /// This class helps you to provide method and property for creating notification object.
29 public sealed partial class Notification
32 /// Class for displaying progress notification.
33 /// You must initialize progress category, current, and max value when you create an object.
35 public sealed class ProgressType : MakerBase
37 private double progressCurrent;
38 private double progressMax;
41 /// Initializes a new instance of the <see cref="ProgressType"/> class.
42 /// You must initialize category, current, and max value of the progress.
44 /// <param name="category">The category of progress that appeared on notification.</param>
45 /// <param name="current">The current value of the progress.</param>
46 /// <param name="max">The max value of the progress.</param>
47 /// <exception cref="ArgumentException">Thrown when an argument is invalid.</exception>
48 public ProgressType(ProgressCategory category, double current, double max)
50 if (IsNegativeNumber(current))
52 throw NotificationErrorFactory.GetException(NotificationError.InvalidParameter, "The current must be a positive integer.");
55 if (IsNegativeNumber(max))
57 throw NotificationErrorFactory.GetException(NotificationError.InvalidParameter, "The max must be a positive integer.");
61 ProgressCurrent = current;
66 /// Gets or sets category of ProgressType.
68 /// <seealso cref="Tizen.Applications.Notifications.ProgressCategory"></seealso>
69 public ProgressCategory Category { get; set; }
72 /// Gets or sets current value of ProgressType.
74 /// <exception cref="ArgumentException">Thrown when argument is invalid.</exception>
75 public double ProgressCurrent
79 return progressCurrent;
84 if (IsNegativeNumber(value))
86 throw NotificationErrorFactory.GetException(NotificationError.InvalidParameter, "The value must be a positive integer.");
89 progressCurrent = value;
94 /// Gets or sets max value of ProgressType.
96 /// <exception cref="ArgumentException">Thrown when argument is invalid.</exception>
97 public double ProgressMax
106 if (IsNegativeNumber(value))
108 throw NotificationErrorFactory.GetException(NotificationError.InvalidParameter, "The value must be a positive integer.");
115 internal override void Make(Notification notification)
117 ProgressBinder.BindObject(notification);
120 private bool IsNegativeNumber(double number)