2 * Copyright (c) 2017 Samsung Electronics Co., Ltd.
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.
19 using System.Runtime.InteropServices;
21 using Tizen.NUI.UIComponents;
22 using Tizen.NUI.BaseComponents;
23 using Tizen.NUI.Constants;
24 //using Tizen.Applications;
26 //------------------------------------------------------------------------------
27 // <manual-generated />
29 // This file can only run on Tizen target. You should compile it with DaliApplication.cs, and
30 // add tizen c# application related library as reference.
31 //------------------------------------------------------------------------------
34 class Example : NUIApplication
36 private Animation _animation;
37 private TextLabel _text;
38 private Window _window;
40 public Example():base()
44 public Example(string stylesheet):base(stylesheet)
48 public Example(string stylesheet, WindowMode windowMode):base(stylesheet, windowMode)
52 protected override void OnCreate()
58 private void Initialize()
60 // Connect the signal callback for window touched signal
61 _window = Window.Instance;
62 _window.TouchEvent += OnWindowTouched;
64 // Add a _text label to the window
65 _text = new TextLabel("Hello Mono World");
66 _text.ParentOrigin = ParentOrigin.Center;
67 _text.PivotPoint = PivotPoint.Center;
68 _text.HorizontalAlignment = HorizontalAlignment.Center;
69 _text.PointSize = 32.0f;
74 // Callback for _animation finished signal handling
75 private void AnimationFinished(object sender, EventArgs e)
79 Tizen.Log.Debug("NUI", "Duration= " + _animation.Duration);
80 Tizen.Log.Debug("NUI", "EndAction= " + _animation.EndAction);
84 // Callback for window touched signal handling
85 private void OnWindowTouched(object sender, Window.TouchEventArgs e)
87 // Only animate the _text label when touch down happens
88 if (e.Touch.GetState(0) == PointStateType.Down)
90 // Create a new _animation
96 _animation = new Animation(1000); // 1 second of duration
98 _animation.AnimateTo(_text, "Orientation", new Rotation(new Radian(new Degree(180.0f)), Vector3.XAxis), 0, 500);
99 _animation.AnimateTo(_text, "Orientation", new Rotation(new Radian(new Degree(0.0f)), Vector3.XAxis), 500, 1000);
100 _animation.EndAction = Animation.EndActions.Discard;
102 // Connect the signal callback for animaiton finished signal
103 _animation.Finished += AnimationFinished;
105 // Play the _animation
111 /// The main entry point for the application.
115 static void _Main(string[] args)
117 Tizen.Log.Debug("NUI", "Hello mono world.");
118 //Example example = new Example();
119 //Example example = new Example("stylesheet");
120 Example example = new Example("stylesheet", WindowMode.Transparent);