2 * Copyright (c) 2016 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.Constants;
23 //using Tizen.Applications;
25 //------------------------------------------------------------------------------
26 // <manual-generated />
28 // This file can only run on Tizen target. You should compile it with DaliApplication.cs, and
29 // add tizen c# application related library as reference.
30 //------------------------------------------------------------------------------
33 class Example : NUIApplication
35 private Animation _animation;
36 private TextLabel _text;
39 public Example():base()
43 public Example(string stylesheet):base(stylesheet)
47 public Example(string stylesheet, WindowMode windowMode):base(stylesheet, windowMode)
51 protected override void OnCreate()
57 private void Initialize()
59 // Connect the signal callback for stage touched signal
60 _stage = Stage.Instance;
61 _stage.Touch += OnStageTouched;
63 // Add a _text label to the stage
64 _text = new TextLabel("Hello Mono World");
65 _text.ParentOrigin = ParentOrigin.Center;
66 _text.AnchorPoint = AnchorPoint.Center;
67 _text.HorizontalAlignment = HorizontalAlignment.Center;
68 _text.PointSize = 32.0f;
70 _stage.GetDefaultLayer().Add(_text);
73 // Callback for _animation finished signal handling
74 private void AnimationFinished(object sender, EventArgs e)
78 Tizen.Log.Debug("NUI", "Duration= " + _animation.Duration);
79 Tizen.Log.Debug("NUI", "EndAction= " + _animation.EndAction);
83 // Callback for stage touched signal handling
84 private void OnStageTouched(object sender, Stage.TouchEventArgs e)
86 // Only animate the _text label when touch down happens
87 if (e.Touch.GetState(0) == PointStateType.Down)
89 // Create a new _animation
95 _animation = new Animation(1000); // 1 second of duration
97 _animation.AnimateTo(_text, "Orientation", new Rotation(new Radian(new Degree(180.0f)), Vector3.XAxis), 0, 500);
98 _animation.AnimateTo(_text, "Orientation", new Rotation(new Radian(new Degree(0.0f)), Vector3.XAxis), 500, 1000);
99 _animation.EndAction = Animation.EndActions.Discard;
101 // Connect the signal callback for animaiton finished signal
102 _animation.Finished += AnimationFinished;
104 // Play the _animation
110 /// The main entry point for the application.
114 static void _Main(string[] args)
116 Tizen.Log.Debug("NUI", "Hello mono world.");
117 //Example example = new Example();
118 //Example example = new Example("stylesheet");
119 Example example = new Example("stylesheet", WindowMode.Transparent);