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.Applications;
23 //------------------------------------------------------------------------------
24 // <manual-generated />
26 // This file can only run on Tizen target. You should compile it with DaliApplication.cs, and
27 // add tizen c# application related library as reference.
28 //------------------------------------------------------------------------------
31 class Example : NUIApplication
33 private Animation _animation;
34 private TextLabel _text;
37 public Example():base()
41 public Example(string stylesheet):base(stylesheet)
45 public Example(string stylesheet, WindowMode windowMode):base(stylesheet, windowMode)
49 protected override void OnCreate()
55 private void Initialize()
57 // Connect the signal callback for stage touched signal
58 _stage = Stage.Instance;
59 _stage.Touch += OnStageTouched;
61 // Add a _text label to the stage
62 _text = new TextLabel("Hello Mono World");
63 _text.ParentOrigin = ParentOrigin.Center;
64 _text.AnchorPoint = AnchorPoint.Center;
65 _text.HorizontalAlignment = "CENTER";
66 _text.PointSize = 32.0f;
68 _stage.GetDefaultLayer().Add(_text);
71 // Callback for _animation finished signal handling
72 private void AnimationFinished(object sender, EventArgs e)
76 Console.WriteLine("Duration= " + _animation.Duration);
77 Console.WriteLine("EndAction= " + _animation.EndAction);
81 // Callback for stage touched signal handling
82 private void OnStageTouched(object sender, Stage.TouchEventArgs e)
84 // Only animate the _text label when touch down happens
85 if (e.Touch.GetState(0) == PointStateType.Down)
87 // Create a new _animation
93 _animation = new Animation(1000); // 1 second of duration
95 _animation.AnimateTo(_text, "Orientation", new Rotation(new Radian(new Degree(180.0f)), Vector3.XAxis), 0, 500);
96 _animation.AnimateTo(_text, "Orientation", new Rotation(new Radian(new Degree(0.0f)), Vector3.XAxis), 500, 1000);
97 _animation.EndAction = Animation.EndActions.Discard;
99 // Connect the signal callback for animaiton finished signal
100 _animation.Finished += AnimationFinished;
102 // Play the _animation
108 /// The main entry point for the application.
112 static void _Main(string[] args)
114 Console.WriteLine("Hello mono world.");
115 //Example example = new Example();
116 //Example example = new Example("stylesheet");
117 Example example = new Example("stylesheet", WindowMode.Transparent);