Revert "[NUI] Dialog and AlertDialog code refactoring with adding DialogPage"
[platform/core/csapi/tizenfx.git] / test / Tizen.NUI.Samples / Tizen.NUI.Samples / Samples / ThemeResourceSample.cs
1 using System.Collections.Generic;
2 using Tizen.NUI;
3 using Tizen.NUI.BaseComponents;
4 using Tizen.NUI.Components;
5
6 namespace Tizen.NUI.Samples
7 {
8     public class ThemeResourceSample : IExample
9     {
10         Dictionary<string, string> DefaultThemeResources { get; } = new Dictionary<string, string>()
11         {
12             {"ButtonBackgroundColorNormal", "0.054, 0.631, 0.921, 1" },
13             {"ButtonBackgroundColorPressed", "0.454, 0.752, 0.905, 1" },
14             {"ButtonBackgroundColorDisabled", "0.88, 0.88, 0.88, 1" },
15         };
16         Dictionary<string, string> DarkThemeResources { get; } = new Dictionary<string, string>()
17         {
18             {"ButtonBackgroundColorNormal", "0.309, 0.309, 0.309, 1" },
19             {"ButtonBackgroundColorPressed", "0.631, 0.631, 0.631, 1" },
20             {"ButtonBackgroundColorDisabled", "0.8, 0.8, 0.8, 1" },
21         };
22         public void Activate()
23         {
24             bool isCurrentThemeDefault = true;
25
26             View root = new View();
27             root.WidthSpecification = LayoutParamPolicies.MatchParent;
28             root.HeightSpecification = LayoutParamPolicies.MatchParent;
29             Window.Instance.GetDefaultLayer().Add(root);
30
31             Button button = new Button();
32             button.ThemeChangeSensitive = true;
33             button.Size = new Size2D(200, 200);
34             button.Clicked += (object sender, ClickedEventArgs e) =>
35             {
36                 if (isCurrentThemeDefault)
37                 {
38                     isCurrentThemeDefault = false;
39                     ThemeManager.UpdateCurrentThemeResources(DarkThemeResources);
40                 }
41                 else
42                 {
43                     isCurrentThemeDefault = true;
44                     ThemeManager.UpdateCurrentThemeResources(DefaultThemeResources);
45                 }
46             };
47             root.Add(button);
48         }
49
50         public void Deactivate() {}
51     }
52 }