Revert "[Tizen] make SetClass() as public"
[platform/core/csapi/nui.git] / NUISample2 / NUISample2 / NUISample2.Tizen / NUISample2.Tizen.cs
1 /*\r
2  * Copyright (c) 2017 Samsung Electronics Co., Ltd.\r
3  *\r
4  * Licensed under the Apache License, Version 2.0 (the "License");\r
5  * you may not use this file except in compliance with the License.\r
6  * You may obtain a copy of the License at\r
7  *\r
8  * http://www.apache.org/licenses/LICENSE-2.0\r
9  *\r
10  * Unless required by applicable law or agreed to in writing, software\r
11  * distributed under the License is distributed on an "AS IS" BASIS,\r
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
13  * See the License for the specific language governing permissions and\r
14  * limitations under the License.\r
15  *\r
16  */\r
17 \r
18 using System;\r
19 using Tizen.NUI;\r
20 \r
21 namespace ControlDashboard\r
22 {\r
23     class Example : NUIApplication\r
24     {\r
25         // This is simple structure to contain Control name and implement state at once\r
26         // name : control name\r
27         // isImplemented : the state which the control is implemented in public or not\r
28         private struct Item\r
29         {\r
30             public String name;\r
31             public bool isImplemented;\r
32 \r
33             public Item(String name, bool isImplemented)\r
34             {\r
35                 this.name = name;\r
36                 this.isImplemented = isImplemented;\r
37             }\r
38         }\r
39 \r
40         private TableView _contentContainer;\r
41         private Timer _timer;\r
42         private Stage _stage;\r
43         private Popup _popup;\r
44         private ProgressBar _progressBar;\r
45         private const string _resPath = "/home/owner/apps_rw/NUISample2.Tizen/res";\r
46 \r
47         // List of items\r
48         private Item[] mViewList = {\r
49       new Item("PushButton", true),  new Item("DropDown", false),    new Item("Toggle", true),\r
50       new Item("InputField", false),  new Item("AnimateGif", false),  new Item("Loading", false),\r
51       new Item("ProgressBar", true), new Item("CheckBox", false),    new Item("RadioButton", true),\r
52       new Item("Tooltip", true),     new Item("Popup", true),       new Item("Toast", true),\r
53       new Item("ItemView", false),    new Item("CheckBox", true)\r
54     };\r
55 \r
56         public Example() : base()\r
57         {\r
58         }\r
59 \r
60         public Example(string stylesheet) : base(stylesheet)\r
61         {\r
62         }\r
63 \r
64         public Example(string stylesheet, NUIApplication.WindowMode windowMode) : base(stylesheet, windowMode)\r
65         {\r
66         }\r
67 \r
68         protected override void OnCreate()\r
69         {\r
70             base.OnCreate();\r
71             Initialize();\r
72         }\r
73 \r
74         protected override void OnTerminate()\r
75         {\r
76             base.OnTerminate();\r
77         }\r
78 \r
79         public void Initialize()\r
80         {\r
81             Console.WriteLine("Customized Application Initialize event handler");\r
82             _stage = Stage.Instance;\r
83             _stage.BackgroundColor = Color.White;\r
84             _stage.Key += _stage_Key;\r
85 \r
86             // Top label\r
87             TextLabel topLabel = new TextLabel();\r
88             topLabel.WidthResizePolicy = ResizePolicyType.FillToParent;\r
89             topLabel.HeightResizePolicy = ResizePolicyType.SizeRelativeToParent;\r
90             topLabel.PivotPoint = PivotPoint.TopCenter;\r
91             topLabel.PositionUsesPivotPoint = true;\r
92             topLabel.ParentOrigin = ParentOrigin.TopCenter;\r
93             topLabel.SetSizeModeFactor(new Vector3(0.0f, 0.1f, 0.0f));\r
94             topLabel.BackgroundColor = new Color(43.0f / 255.0f, 145.0f / 255.0f, 175.0f / 255.0f, 1.0f);\r
95             topLabel.TextColor = Color.White;\r
96             topLabel.Text = " DALi Views";\r
97             topLabel.HorizontalAlignment = "BEGIN";\r
98             topLabel.VerticalAlignment = "CENTER";\r
99             topLabel.PointSize = 42.0f;\r
100             _stage.GetDefaultLayer().Add(topLabel);\r
101             //StyleManager.Get().ApplyStyle(topLabel, _resPath + "/json/control-dashboard-theme.json", "TextFieldFontSize4");\r
102             topLabel.SetStyleName("TextFieldFontSize4");\r
103 \r
104             // Grid container to contain items. Use tableView because FlexContainer support focus navigation just two direction ( up/down or left/right )\r
105             _contentContainer = new TableView(6, 5);\r
106             _contentContainer.WidthResizePolicy = ResizePolicyType.FillToParent;\r
107             _contentContainer.HeightResizePolicy = ResizePolicyType.SizeRelativeToParent;\r
108             _contentContainer.SetSizeModeFactor(new Vector3(0.0f, 0.9f, 0.0f));\r
109             _contentContainer.PivotPoint = PivotPoint.BottomCenter;\r
110             _contentContainer.PositionUsesPivotPoint = true;\r
111             _contentContainer.ParentOrigin = ParentOrigin.BottomCenter;\r
112             _contentContainer.SetRelativeHeight(0, 0.07f);\r
113             _contentContainer.SetRelativeHeight(1, 0.26f);\r
114             _contentContainer.SetRelativeHeight(2, 0.07f);\r
115             _contentContainer.SetRelativeHeight(3, 0.26f);\r
116             _contentContainer.SetRelativeHeight(4, 0.07f);\r
117             _contentContainer.SetRelativeHeight(5, 0.26f);\r
118             _contentContainer.Focusable = (true);\r
119             _stage.GetDefaultLayer().Add(_contentContainer);\r
120 \r
121             CreateContent();\r
122 \r
123             FocusManager.Instance.PreFocusChange += OnPreFocusChange;\r
124         }\r
125 \r
126         private void _stage_Key(object sender, Stage.KeyEventArgs e)\r
127         {\r
128             if (e.Key.KeyPressedName == "XF86Back")\r
129             {\r
130                 OnTerminate();\r
131             }\r
132         }\r
133 \r
134         // Callback for KeyboardFocusManager\r
135         private View OnPreFocusChange(object source, FocusManager.PreFocusChangeEventArgs e)\r
136         {\r
137             if (!e.ProposedView && !e.CurrentView)\r
138             {\r
139                 e.ProposedView = View.DownCast(_contentContainer.GetChildAt(1));\r
140             }\r
141             return e.ProposedView;\r
142         }\r
143 \r
144         private void CreateContent()\r
145         {\r
146             for (int i = 0; i < mViewList.Length; i++)\r
147             {\r
148                 CreateItem(mViewList[i], i);\r
149             }\r
150         }\r
151 \r
152         private void CreateItem(Item item, int idx)\r
153         {\r
154             // Make label for item\r
155             TextLabel itemLabel = new TextLabel("    " + item.name);\r
156             itemLabel.Size = new Vector3(_stage.Size.Width * 0.2f, _stage.Size.Height * 0.05f, 0.0f);\r
157             itemLabel.HorizontalAlignment = "BEGIN";\r
158             itemLabel.VerticalAlignment = "BOTTOM";\r
159             //itemLabel.PointSize = 18.0f;\r
160             _contentContainer.AddChild(itemLabel, new TableView.CellPosition(((uint)idx / 5) * 2, (uint)idx % 5));\r
161 \r
162             // If item is implemented in public, attach it on stage\r
163             if (item.isImplemented)\r
164             {\r
165                 if (item.name.CompareTo("PushButton") == 0)\r
166                 {\r
167                     PushButton pushButton = new PushButton();\r
168                     pushButton.LabelText = "Push Button";\r
169                     pushButton.WidthResizePolicy = ResizePolicyType.FillToParent;\r
170                     pushButton.HeightResizePolicy = ResizePolicyType.FillToParent;\r
171                     pushButton.UnselectedColor = new Vector4(1.0f, 0.0f, 0.0f, 1.0f);\r
172                     pushButton.SelectedColor = new Vector4(0.0f, 1.0f, 0.0f, 1.0f);\r
173                     pushButton.Clicked += (obj, e) =>\r
174                     {\r
175                         Button sender = obj as Button;\r
176                         sender.LabelText = "Click Me";\r
177                         sender.UnselectedColor = new Vector4(0.0f, 0.0f, 1.0f, 1.0f);\r
178                         return true;\r
179                     };\r
180 \r
181                     _contentContainer.AddChild(pushButton, new TableView.CellPosition(((uint)idx / 5) * 2 + 1, (uint)idx % 5));\r
182                 }\r
183                 if (item.name.CompareTo("DropDown") == 0)\r
184                 {\r
185 \r
186                 }\r
187                 if (item.name.CompareTo("Toggle") == 0)\r
188                 {\r
189                     ToggleButton toggleButton = new ToggleButton();\r
190                     PropertyArray array = new PropertyArray();\r
191                     array.Add(new PropertyValue(_resPath + "/images/star-highlight.png"));\r
192                     array.Add(new PropertyValue(_resPath + "/images/star-mod.png"));\r
193                     array.Add(new PropertyValue(_resPath + "/images/star-dim.png"));\r
194                     toggleButton.StateVisuals = array;\r
195 \r
196                     PropertyArray tooltips = new PropertyArray();\r
197                     tooltips.Add(new PropertyValue("State A"));\r
198                     tooltips.Add(new PropertyValue("State B"));\r
199                     tooltips.Add(new PropertyValue("State C"));\r
200                     toggleButton.Tooltips = tooltips;\r
201 \r
202                     toggleButton.WidthResizePolicy = ResizePolicyType.FillToParent;\r
203                     toggleButton.HeightResizePolicy = ResizePolicyType.FillToParent;\r
204                     toggleButton.Clicked += (obj, e) =>\r
205                     {\r
206                         Console.WriteLine("Toggle button state changed.");\r
207                         return true;\r
208                     };\r
209 \r
210                     _contentContainer.AddChild(toggleButton, new TableView.CellPosition(((uint)idx / 5) * 2 + 1, (uint)idx % 5));\r
211                 }\r
212                 if (item.name.CompareTo("InputField") == 0)\r
213                 {\r
214 \r
215                 }\r
216                 if (item.name.CompareTo("AnimateGif") == 0)\r
217                 {\r
218 \r
219                 }\r
220                 if (item.name.CompareTo("Loading") == 0)\r
221                 {\r
222 \r
223                 }\r
224                 if (item.name.CompareTo("ProgressBar") == 0)\r
225                 {\r
226                     _progressBar = new ProgressBar();\r
227                     _progressBar.WidthResizePolicy = ResizePolicyType.FillToParent;\r
228                     _progressBar.HeightResizePolicy = ResizePolicyType.Fixed;\r
229                     _progressBar.Size2D = new Size2D(0, 100);\r
230 \r
231                     _progressBar.ValueChanged += OnProgressBarValueChanged;\r
232 \r
233                     _timer = new Timer(100);\r
234                     _timer.Tick += (obj, e) =>\r
235                     {\r
236                         float progress = (float)Math.Round(_progressBar.ProgressValue, 2);\r
237 \r
238                         if (progress == 1.0f)\r
239                         {\r
240                             _progressBar.ProgressValue = 0.0f;\r
241                             _progressBar.SecondaryProgressValue = 0.01f;\r
242                         }\r
243                         else\r
244                         {\r
245                             _progressBar.ProgressValue = progress + 0.01f;\r
246                             _progressBar.SecondaryProgressValue = progress + 0.21f;\r
247                         }\r
248                         return true;\r
249                     };\r
250                     _timer.Start();\r
251 \r
252                     _contentContainer.AddChild(_progressBar, new TableView.CellPosition(((uint)idx / 5) * 2 + 1, (uint)idx % 5));\r
253                 }\r
254                 if (item.name.CompareTo("ScrollBar") == 0)\r
255                 {\r
256 \r
257                 }\r
258                 if (item.name.CompareTo("CheckBox") == 0)\r
259                 {\r
260                     CheckBoxButton checkBoxButton = new CheckBoxButton();\r
261                     checkBoxButton.LabelText = "Yes";\r
262 \r
263                     _contentContainer.AddChild(checkBoxButton, new TableView.CellPosition(((uint)idx / 5) * 2 + 1, (uint)idx % 5));\r
264                 }\r
265                 if (item.name.CompareTo("RadioButton") == 0)\r
266                 {\r
267                     TableView tableView = new TableView(2, 1);\r
268                     tableView.WidthResizePolicy = ResizePolicyType.FillToParent;\r
269                     tableView.HeightResizePolicy = ResizePolicyType.FillToParent;\r
270 \r
271                     RadioButton rButton = new RadioButton();\r
272                     rButton.LabelText = "Yes";\r
273                     rButton.Selected = true;\r
274                     tableView.AddChild(rButton, new TableView.CellPosition(0, 0));\r
275 \r
276                     rButton = new RadioButton();\r
277                     rButton.LabelText = "No";\r
278 \r
279                     tableView.AddChild(rButton, new TableView.CellPosition(1, 0));\r
280 \r
281                     _contentContainer.AddChild(tableView, new TableView.CellPosition(((uint)idx / 5) * 2 + 1, (uint)idx % 5));\r
282                 }\r
283                 if (item.name.CompareTo("Tooltip") == 0)\r
284                 {\r
285                     TableView tableView = new TableView(2, 1);\r
286                     tableView.WidthResizePolicy = ResizePolicyType.FillToParent;\r
287                     tableView.HeightResizePolicy = ResizePolicyType.FillToParent;\r
288 \r
289                     // Create two push buttons and add them to a table view\r
290                     PushButton buttonWithSimpleTooltip = new PushButton();\r
291                     buttonWithSimpleTooltip.LabelText = "Tooltip with text only";\r
292                     buttonWithSimpleTooltip.UnselectedColor = new Vector4(0.5f, 0.5f, 0.7f, 1.0f);\r
293                     buttonWithSimpleTooltip.SelectedColor = new Vector4(0.7f, 0.5f, 0.7f, 1.0f);\r
294                     buttonWithSimpleTooltip.WidthResizePolicy = ResizePolicyType.FillToParent;\r
295                     tableView.AddChild(buttonWithSimpleTooltip, new TableView.CellPosition(0, 0));\r
296 \r
297                     PushButton buttonWithIconTooltip = new PushButton();\r
298                     buttonWithIconTooltip.LabelText = "Tooltip with Text and Icon";\r
299                     buttonWithIconTooltip.WidthResizePolicy = ResizePolicyType.FillToParent;\r
300                     buttonWithIconTooltip.UnselectedColor = new Vector4(0.5f, 0.5f, 0.7f, 1.0f);\r
301                     buttonWithIconTooltip.SelectedColor = new Vector4(0.7f, 0.5f, 0.7f, 1.0f);\r
302                     tableView.AddChild(buttonWithIconTooltip, new TableView.CellPosition(1, 0));\r
303 \r
304                     // Add a simple text only tooltip to the first push button\r
305                     buttonWithSimpleTooltip.TooltipText = "Simple Tooltip";\r
306 \r
307                     // Create a property map for a tooltip with one icon and one text\r
308                     PropertyArray iconTooltipContent = new PropertyArray();\r
309 \r
310                     PropertyMap iconVisual = new PropertyMap();\r
311                     iconVisual.Add(Tizen.NUI.Constants.Visual.Property.Type, new PropertyValue((int)Tizen.NUI.Constants.Visual.Type.Image))\r
312                       .Add(Tizen.NUI.Constants.ImageVisualProperty.URL, new PropertyValue(_resPath + "/images/star-highlight.png"));\r
313                     iconTooltipContent.Add(new PropertyValue(iconVisual));\r
314 \r
315                     PropertyMap textVisual = new PropertyMap();\r
316                     textVisual.Add(Tizen.NUI.Constants.Visual.Property.Type, new PropertyValue((int)Tizen.NUI.Constants.Visual.Type.Text))\r
317                       .Add(Tizen.NUI.Constants.TextVisualProperty.Text, new PropertyValue("Tooltip with Icon"));\r
318                     iconTooltipContent.Add(new PropertyValue(textVisual));\r
319 \r
320                     PropertyMap iconTooltip = new PropertyMap();\r
321                     iconTooltip.Add(Tizen.NUI.Constants.Tooltip.Property.Content, new PropertyValue(iconTooltipContent))\r
322                       .Add(Tizen.NUI.Constants.Tooltip.Property.Tail, new PropertyValue(true));\r
323 \r
324                     // Add the tooltip with icon and text to the second push button\r
325                     buttonWithIconTooltip.Tooltip = iconTooltip;\r
326 \r
327                     _contentContainer.AddChild(tableView, new TableView.CellPosition(((uint)idx / 5) * 2 + 1, (uint)idx % 5));\r
328                 }\r
329                 if (item.name.CompareTo("Popup") == 0)\r
330                 {\r
331                     PushButton button = new PushButton();\r
332                     button.LabelText = "Popup";\r
333                     button.ParentOrigin = ParentOrigin.Center;\r
334                     button.PivotPoint = PivotPoint.Center;\r
335                     button.PositionUsesPivotPoint = true;\r
336                     button.MaximumSize = new Size2D(150, 100);\r
337                     _popup = CreatePopup();\r
338                     _popup.SetTitle(CreateTitle("Popup"));\r
339 \r
340                     TextLabel text = new TextLabel("This will erase the file permanently. Are you sure?");\r
341                     text.BackgroundColor = Color.White;\r
342                     text.MultiLine = true;\r
343                     text.WidthResizePolicy = ResizePolicyType.FillToParent;\r
344                     text.HeightResizePolicy = ResizePolicyType.DimensionDependency;\r
345                     text.SetPadding(new PaddingType(10.0f, 10.0f, 20.0f, 0.0f));\r
346                     _popup.SetContent(text);\r
347                     _popup.Focusable = (true);\r
348                     _popup.SetDisplayState(Popup.DisplayStateType.Hidden);\r
349 \r
350                     button.Clicked += (obj, ee) =>\r
351                     {\r
352                         _stage.GetDefaultLayer().Add(_popup);\r
353                         _popup.SetDisplayState(Popup.DisplayStateType.Shown);\r
354                         FocusManager.Instance.SetCurrentFocusView(View.DownCast((_popup.FindChildByName("Footer")).FindChildByName("OKButton")));\r
355                         return true;\r
356                     };\r
357                     _contentContainer.AddChild(button, new TableView.CellPosition(((uint)idx / 5) * 2 + 1, (uint)idx % 5));\r
358                 }\r
359                 if (item.name.CompareTo("Toast") == 0)\r
360                 {\r
361                     PushButton button = new PushButton();\r
362                     button.LabelText = "Toast";\r
363                     button.ParentOrigin = ParentOrigin.Center;\r
364                     button.PivotPoint = PivotPoint.Center;\r
365                     button.PositionUsesPivotPoint = true;\r
366                     button.Clicked += (obj, ee) =>\r
367                     {\r
368                         TypeInfo typeInfo = new TypeInfo(TypeRegistry.Get().GetTypeInfo("PopupToast"));\r
369                         if (typeInfo)\r
370                         {\r
371                             BaseHandle baseHandle = typeInfo.CreateInstance();\r
372                             if (baseHandle)\r
373                             {\r
374                                 Popup toast = Popup.DownCast(baseHandle);\r
375                                 TextLabel text = new TextLabel("This is a Toast.\nIt will auto-hide itself");\r
376                                 text.TextColor = Color.White;\r
377                                 text.MultiLine = true;\r
378                                 text.HorizontalAlignment = "center";\r
379                                 toast.SetTitle(text);\r
380                                 _stage.GetDefaultLayer().Add(toast);\r
381                                 toast.SetDisplayState(Popup.DisplayStateType.Shown);\r
382                             }\r
383                         }\r
384                         return true;\r
385                     };\r
386                     _contentContainer.AddChild(button, new TableView.CellPosition(((uint)idx / 5) * 2 + 1, (uint)idx % 5));\r
387                 }\r
388                 if (item.name.CompareTo("ItemView") == 0)\r
389                 {\r
390 \r
391                 }\r
392             }\r
393             else\r
394             {\r
395                 ImageView notSupportView = new ImageView(_resPath + "/images/not_yet_sign.png");\r
396                 notSupportView.Size = new Vector3(_stage.Size.Width * 0.2f, _stage.Size.Height * 0.25f, 0.0f);\r
397                 notSupportView.Focusable = (true);\r
398                 _contentContainer.AddChild(notSupportView, new TableView.CellPosition(((uint)idx / 5) * 2 + 1, (uint)idx % 5));\r
399             }\r
400         }\r
401         Popup CreatePopup()\r
402         {\r
403             Popup confirmationPopup = new Popup();\r
404 \r
405             Actor footer = new Actor();\r
406             footer.Name = ("Footer");\r
407             footer.WidthResizePolicy = ResizePolicyType.FillToParent;\r
408             footer.HeightResizePolicy = ResizePolicyType.Fixed;\r
409             footer.Size = new Size(0.0f, 80.0f, 0.0f);\r
410             footer.ParentOrigin = ParentOrigin.Center;\r
411             footer.PivotPoint = PivotPoint.Center;\r
412             footer.PositionUsesPivotPoint = true;\r
413 \r
414             PushButton okButton = CreateOKButton();\r
415             okButton.ParentOrigin = ParentOrigin.Center;\r
416             okButton.PivotPoint = PivotPoint.Center;\r
417             okButton.PositionUsesPivotPoint = true;\r
418             okButton.WidthResizePolicy = ResizePolicyType.SizeFixedOffsetFromParent;\r
419             okButton.HeightResizePolicy = ResizePolicyType.SizeFixedOffsetFromParent;\r
420             okButton.SetSizeModeFactor(new Vector3(-20.0f, -20.0f, 0.0f));\r
421 \r
422             PushButton cancelButton = CreateCancelButton();\r
423             cancelButton.ParentOrigin = ParentOrigin.Center;\r
424             cancelButton.PivotPoint = PivotPoint.Center;\r
425             cancelButton.PositionUsesPivotPoint = true;\r
426             cancelButton.WidthResizePolicy = ResizePolicyType.SizeFixedOffsetFromParent;\r
427             cancelButton.HeightResizePolicy = ResizePolicyType.SizeFixedOffsetFromParent;\r
428             cancelButton.SetSizeModeFactor(new Vector3(-20.0f, -20.0f, 0.0f));\r
429 \r
430             TableView controlLayout = new TableView(1, 2);\r
431             controlLayout.ParentOrigin = ParentOrigin.Center;\r
432             controlLayout.PivotPoint = PivotPoint.Center;\r
433             controlLayout.PositionUsesPivotPoint = true;\r
434             controlLayout.WidthResizePolicy = ResizePolicyType.FillToParent;\r
435             controlLayout.HeightResizePolicy = ResizePolicyType.FillToParent;\r
436             controlLayout.SetCellPadding(new Size2D(10, 10));\r
437             controlLayout.SetRelativeWidth(0, 0.5f);\r
438             controlLayout.SetRelativeWidth(1, 0.5f);\r
439             controlLayout.SetCellAlignment(new TableView.CellPosition(0, 0), HorizontalAlignmentType.Center, VerticalAlignmentType.Center);\r
440             controlLayout.SetCellAlignment(new TableView.CellPosition(0, 1), HorizontalAlignmentType.Center, VerticalAlignmentType.Center);\r
441             controlLayout.AddChild(okButton, new TableView.CellPosition(0, 0));\r
442             controlLayout.AddChild(cancelButton, new TableView.CellPosition(0, 1));\r
443 \r
444             footer.Add(controlLayout);\r
445 \r
446             confirmationPopup.SetFooter(footer);\r
447             return confirmationPopup;\r
448         }\r
449         Actor CreateTitle(string title)\r
450         {\r
451             TextLabel titleActor = new TextLabel(title);\r
452             titleActor.TextColor = Color.White;\r
453             titleActor.MultiLine = true;\r
454             titleActor.HorizontalAlignment = "center";\r
455             return titleActor;\r
456         }\r
457 \r
458         PushButton CreateOKButton()\r
459         {\r
460             PushButton okayButton = new PushButton();\r
461             okayButton.Name = ("OKButton");\r
462             okayButton.LabelText = "OK";\r
463             okayButton.Focusable = (true);\r
464             okayButton.Clicked += (obj, ee) =>\r
465             {\r
466                 _popup.SetDisplayState(Popup.DisplayStateType.Hidden);\r
467                 return true;\r
468             };\r
469             return okayButton;\r
470         }\r
471         PushButton CreateCancelButton()\r
472         {\r
473             PushButton cancelButton = new PushButton();\r
474             cancelButton.LabelText = "Cancel";\r
475             cancelButton.Focusable = (true);\r
476             cancelButton.Clicked += (obj, ee) =>\r
477             {\r
478                 _popup.SetDisplayState(Popup.DisplayStateType.Hidden);\r
479                 return true;\r
480             };\r
481             return cancelButton;\r
482         }\r
483 \r
484         void OnProgressBarValueChanged(object source, ProgressBar.ValueChangedEventArgs e)\r
485         {\r
486             PropertyMap labelVisual = new PropertyMap();\r
487             labelVisual.Add(Tizen.NUI.Constants.Visual.Property.Type, new PropertyValue((int)Tizen.NUI.Constants.Visual.Type.Text))\r
488               .Add(Tizen.NUI.Constants.TextVisualProperty.Text, new PropertyValue(Math.Round(e.ProgressBar.ProgressValue, 2) + " / " + Math.Round(e.ProgressBar.SecondaryProgressValue, 2)))\r
489               .Add(Tizen.NUI.Constants.TextVisualProperty.PointSize, new PropertyValue(10.0f));\r
490             e.ProgressBar.LabelVisual = labelVisual;\r
491             return;\r
492         }\r
493 \r
494 \r
495         /// <summary>\r
496         /// The main entry point for the application.\r
497         /// </summary>\r
498 \r
499         [STAThread]\r
500         static void Main(string[] args)\r
501         {\r
502             Tizen.Log.Debug("NUI", "control-dashboard app Main()");\r
503 \r
504             Example example = new Example("/home/owner/apps_rw/NUISample2.Tizen/res/json/control-dashboard-theme.json");\r
505             example.Run(args);\r
506         }\r
507     }\r
508 }\r