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
20 /// Class containing common properties and methods of Notifications
23 /// A notification is a message that is displayed on the notification area.
24 /// It is created to notify information to the user through the application.
25 /// This class helps you to provide method and property for creating notification object.
27 public sealed partial class Notification
30 /// Class for displaying progress notification
31 /// You must initialize progress category, current, max value when you create object.
33 public sealed class ProgressType : MakerBase
35 private double progressCurrent;
36 private double progressMax;
39 /// Initializes a new instance of the <see cref="ProgressType"/> class.
40 /// You must initialize category, current, max value of progress.
42 /// <param name="category">The category of progress that appeared on Notification</param>
43 /// <param name="current">The current value of the progress</param>
44 /// <param name="max">The max value of the progress</param>
45 /// <exception cref="ArgumentException">Thrown when argument is invalid</exception>
46 public ProgressType(ProgressCategory category, double current, double max)
48 if (IsNegativeNumber(current))
50 throw NotificationErrorFactory.GetException(NotificationError.InvalidParameter, "The current must be a positive integer.");
53 if (IsNegativeNumber(max))
55 throw NotificationErrorFactory.GetException(NotificationError.InvalidParameter, "The max must be a positive integer.");
59 ProgressCurrent = current;
64 /// Gets or sets category of ProgressType.
66 /// <seealso cref="Tizen.Applications.Notifications.ProgressCategory"></seealso>
67 public ProgressCategory Category { get; set; }
70 /// Gets or sets current value of ProgressType
72 /// <exception cref="ArgumentException">Thrown when argument is invalid</exception>
73 public double ProgressCurrent
77 return progressCurrent;
82 if (IsNegativeNumber(value))
84 throw NotificationErrorFactory.GetException(NotificationError.InvalidParameter, "The value must be a positive integer.");
87 progressCurrent = value;
92 /// Gets or sets max value of ProgressType
94 /// <exception cref="ArgumentException">Thrown when argument is invalid</exception>
95 public double ProgressMax
104 if (IsNegativeNumber(value))
106 throw NotificationErrorFactory.GetException(NotificationError.InvalidParameter, "The value must be a positive integer.");
113 internal override void Make(Notification notification)
115 ProgressBinder.BindObject(notification);
118 private bool IsNegativeNumber(double number)