|
1 | | -using System; |
2 | | - |
3 | | -using Tizen.NUI; |
4 | | -using Tizen.NUI.BaseComponents; |
| 1 | +using Tizen.UI; |
| 2 | +using Tizen.UI.Components; |
| 3 | +using Tizen.UI.Components.Material; |
5 | 4 |
|
6 | 5 | namespace TizenApp1 |
7 | 6 | { |
8 | | - class Program : NUIApplication |
| 7 | + class Program : MaterialApplication |
9 | 8 | { |
10 | 9 | protected override void OnCreate() |
11 | 10 | { |
12 | 11 | base.OnCreate(); |
13 | | - Initialize(); |
14 | | - } |
15 | | - |
16 | | - void Initialize() |
17 | | - { |
18 | | - Window.Default.KeyEvent += OnKeyEvent; |
19 | | - |
20 | | - TextLabel text = new TextLabel("Hello Tizen") { |
21 | | - HorizontalAlignment = HorizontalAlignment.Center, |
22 | | - VerticalAlignment = VerticalAlignment.Center, |
23 | | - TextColor = Color.Blue, |
24 | | - PointSize = 12.0f, |
25 | | - HeightResizePolicy = ResizePolicyType.FillToParent, |
26 | | - WidthResizePolicy = ResizePolicyType.FillToParent |
27 | | - }; |
28 | | - Window.Default.GetDefaultLayer().Add(text); |
29 | | - |
30 | | - Animation animation = new Animation(2000); |
31 | | - animation.AnimateTo(text, "Orientation", new Rotation(new Radian(new Degree(180.0f)), PositionAxis.X), 0, 500); |
32 | | - animation.AnimateTo(text, "Orientation", new Rotation(new Radian(new Degree(0.0f)), PositionAxis.X), 500, 1000); |
33 | | - animation.Looping = true; |
34 | | - animation.Play(); |
35 | | - } |
36 | | - |
37 | | - public void OnKeyEvent(object sender, Window.KeyEventArgs e) |
38 | | - { |
39 | | - if (e.Key.State == Key.StateType.Down && (e.Key.KeyPressedName == "XF86Back" || e.Key.KeyPressedName == "Escape")) |
| 12 | + FocusManager.Instance.EnableDefaultFocusAlgorithm(true); |
| 13 | + Window.Default.AddAvailableOrientation(WindowOrientation.Portrait); |
| 14 | + Window.Default.AddAvailableOrientation(WindowOrientation.Landscape); |
| 15 | + Window.Default.AddAvailableOrientation(WindowOrientation.PortraitInverse); |
| 16 | + Window.Default.AddAvailableOrientation(WindowOrientation.LandscapeInverse); |
| 17 | + Window.Default.KeyEvent += (s, e) => |
40 | 18 | { |
41 | | - Exit(); |
42 | | - } |
| 19 | + if (e.KeyEvent.State == KeyState.Up && (e.KeyEvent.KeyPressedName == "BackSpace" || e.KeyEvent.KeyPressedName == "XF86Back")) |
| 20 | + { |
| 21 | + if (!RootNavigateBack()) |
| 22 | + { |
| 23 | + Window.Default.Dispose(); |
| 24 | + Exit(); |
| 25 | + } |
| 26 | + } |
| 27 | + }; |
| 28 | + var navigator = new Navigator(); |
| 29 | + Window.Default.DefaultLayer.Add(navigator); |
| 30 | + navigator.PushAsync(new MainView()); |
43 | 31 | } |
44 | 32 |
|
45 | 33 | static void Main(string[] args) |
|
0 commit comments