2 using System.Collections.Generic;
3 using Tizen.Applications;
5 using Tizen.NUI.BaseComponents;
7 namespace NUIComponentApplicationSample
9 public class Program : NUIComponentApplication
11 public static MyFrameComponent myFrame1 = null;
12 public static MyFrameComponent2 myFrame2 = null;
14 public Program(IDictionary<Type, string> typeInfo) : base(typeInfo)
18 public class MyFrameComponent : NUIFrameComponent
20 private TextLabel text;
21 private Animation animation;
23 public override bool OnCreate()
26 Tizen.Log.Error("MYLOG", "MyFrameComponent OnCreate");
28 Window.BackgroundColor = Color.White;
29 text = new TextLabel("First Frame");
30 text.HorizontalAlignment = HorizontalAlignment.Center;
31 text.VerticalAlignment = VerticalAlignment.Bottom;
32 text.TextColor = Color.Blue;
33 text.PointSize = 12.0f;
34 text.HeightResizePolicy = ResizePolicyType.FillToParent;
35 text.WidthResizePolicy = ResizePolicyType.FillToParent;
38 animation = new Animation(2000);
39 animation.AnimateTo(text, "Orientation", new Rotation(new Radian(new Degree(180.0f)), PositionAxis.X), 0, 500);
40 animation.AnimateTo(text, "Orientation", new Rotation(new Radian(new Degree(0.0f)), PositionAxis.X), 500, 1000);
41 animation.Looping = true;
47 public override void OnDestroy()
49 Tizen.Log.Error("MYLOG", "MyFrameComponent OnDestroy");
54 public override void OnPause()
56 Tizen.Log.Error("MYLOG", "MyFrameComponent OnPause");
59 public override void OnResume()
61 Tizen.Log.Error("MYLOG", "MyFrameComponent OnResume");
64 public override void OnStart(AppControl appControl, bool restarted)
66 Tizen.Log.Error("MYLOG", "MyFrameComponent OnStart");
69 public override void OnStop()
71 Tizen.Log.Error("MYLOG", "MyFrameComponent OnStop");
74 public void ChangeSharedText(string strText)
80 public class MyFrameComponent2 : NUIFrameComponent
82 private TextLabel text;
83 private Animation animation;
85 public override bool OnCreate()
88 Tizen.Log.Error("MYLOG", "MyFrameComponent2 OnCreate");
89 Window.BackgroundColor = Color.Red;
90 Window.WindowSize = new Size(360, 180);
91 Window.Instance.TouchEvent += Instance_TouchEvent;
92 text = new TextLabel("Second Frame");
93 text.HorizontalAlignment = HorizontalAlignment.Center;
94 text.VerticalAlignment = VerticalAlignment.Center;
95 text.TextColor = Color.Blue;
96 text.PointSize = 12.0f;
97 text.HeightResizePolicy = ResizePolicyType.FillToParent;
98 text.WidthResizePolicy = ResizePolicyType.FillToParent;
103 private void Instance_TouchEvent(object sender, Window.TouchEventArgs e)
105 if(e.Touch.GetState(0) == PointStateType.Up)
107 myFrame1?.ChangeSharedText("Change - text");
111 public override void OnDestroy()
113 Tizen.Log.Error("MYLOG", "MyFrameComponent2 OnDestroy");
118 public override void OnPause()
120 Tizen.Log.Error("MYLOG", "MyFrameComponent2 OnPause");
123 public override void OnResume()
125 Tizen.Log.Error("MYLOG", "MyFrameComponent2 OnResume");
128 public override void OnStart(AppControl appControl, bool restarted)
130 Tizen.Log.Error("MYLOG", "MyFrameComponent2 OnStart");
133 public override void OnStop()
135 Tizen.Log.Error("MYLOG", "MyFrameComponent2 OnStop");
139 static void Main(string[] args)
141 Dictionary<Type, string> dict = new Dictionary<Type, string>();
142 dict.Add(typeof(MyFrameComponent), "csharp_frame");
143 dict.Add(typeof(MyFrameComponent2), "csharp_frame2");
144 var app = new Program(dict);