2 * Copyright (c) 2018 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.
18 using System.Collections.Generic;
21 namespace Tizen.Applications.WatchfaceComplication
24 /// Represents the RangedValueData class for the RangedValue type complication.
26 /// <since_tizen> 6 </since_tizen>
27 public class RangedValueData : ComplicationData
30 /// Initializes the RangedValueData class.
32 /// <param name="currentValue">The current value.</param>
33 /// <param name="minValue">The minimum value.</param>
34 /// <param name="maxValue">The max value.</param>
35 /// <param name="shortText">The short text.</param>
36 /// <param name="iconPath">The icon path.</param>
37 /// <param name="title">The title.</param>
38 /// <param name="extraData">The extra data.</param>
39 /// <exception cref="ArgumentException">Thrown when parameter is invalid.</exception>
42 /// protected override ComplicationData OnDataUpdateRequested(string reqestAppId, ComplicationTypes type, Bundle contextData)
44 /// if (type == ComplicationTypes.RangedValue)
46 /// return new RangedValueData(50, 0, 100, "short", "icon path", "title", "extra");
48 /// else if (type == ComplicationTypes.LongText)
50 /// return new LongTextData("longlong", "icon path", "title", null);
55 /// <since_tizen> 6 </since_tizen>
56 public RangedValueData(double currentValue, double minValue, double maxValue, string shortText, string iconPath, string title, string extraData)
58 if (minValue > maxValue || currentValue < minValue || currentValue > maxValue)
59 ErrorFactory.ThrowException(ComplicationError.InvalidParam, "Invalid value range min(" + minValue + "), cur(" + currentValue + "), max(" + maxValue + ")");
60 Type = ComplicationTypes.RangedValue;
61 base.RangeMin = minValue;
62 base.RangeMax = maxValue;
63 base.RangeCurrent = currentValue;
64 ShortText = shortText;
67 ExtraData = extraData;
71 /// The information about the current range value of complication data.
73 /// <exception cref="ArgumentException">Thrown when try to set invalid value.</exception>
74 /// <since_tizen> 6 </since_tizen>
75 public new double RangeCurrent
79 return base.RangeCurrent;
83 if (value > base.RangeMax)
84 ErrorFactory.ThrowException(ComplicationError.InvalidParam,
85 "invalid min(" + value + "), current value can not bigger than max(" + base.RangeMax + ")");
86 if (value < base.RangeMin)
87 ErrorFactory.ThrowException(ComplicationError.InvalidParam,
88 "invalid min(" + value + "), min value can not smaller than min(" + base.RangeMin + ")");
89 base.RangeCurrent = value;
94 /// The information about the min range value of complication data.
96 /// <exception cref="ArgumentException">Thrown when try to set invalid value.</exception>
97 /// <since_tizen> 6 </since_tizen>
98 public new double RangeMin
102 return base.RangeMin;
106 if (value > base.RangeCurrent)
107 ErrorFactory.ThrowException(ComplicationError.InvalidParam,
108 "invalid min(" + value + "), min value can not bigger than current(" + base.RangeCurrent + ")");
109 base.RangeMin = value;
114 /// The information about the max range value of complication data.
116 /// <exception cref="ArgumentException">Thrown when try to set invalid value.</exception>
117 /// <since_tizen> 6 </since_tizen>
118 public new double RangeMax
122 return base.RangeMax;
126 if (value < base.RangeCurrent)
127 ErrorFactory.ThrowException(ComplicationError.InvalidParam,
128 "invalid min(" + value + "), min value can not smaller than current(" + base.RangeCurrent + ")");
129 base.RangeMax = value;
134 /// The short text data.
136 /// <exception cref="ArgumentException">Thrown when try to set invalid value.</exception>
137 /// <since_tizen> 6 </since_tizen>
138 public new string ShortText
142 return base.ShortText;
147 ErrorFactory.ThrowException(ComplicationError.InvalidParam, "fail to create short text");
148 base.ShortText = value;
153 /// The icon path data.
155 /// <since_tizen> 6 </since_tizen>
156 public new string IconPath
160 return base.IconPath;
164 base.IconPath = value;
171 /// <since_tizen> 6 </since_tizen>
172 public new string Title
187 /// <since_tizen> 6 </since_tizen>
188 public new string ExtraData
192 return base.ExtraData;
196 base.ExtraData = value;
201 /// The information about the screen reader text of complication data.
203 /// <since_tizen> 6 </since_tizen>
204 public new string ScreenReaderText
208 return base.ScreenReaderText;
212 base.ScreenReaderText = value;