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 //------------------------------------------------------------------------------
29 namespace RelativeVectorTest
31 class Example : NUIApplication
33 private Animation _animation;
34 private ImageView _imageView;
36 private const string resources = "/home/owner/apps_rw/NUISamples.TizenTV/res";
38 public Example():base()
42 public Example(string stylesheet):base(stylesheet)
46 public Example(string stylesheet, WindowMode windowMode):base(stylesheet, windowMode)
50 protected override void OnCreate()
56 private void Initialize()
58 // Connect the signal callback for stage touched signal
59 InternalSetting.DefaultParentOriginAsTopLeft = false;
60 _stage = Stage.Instance;
61 _stage.Touch += OnStageTouched;
63 _imageView = new ImageView();
64 _imageView.ResourceUrl = resources+"/images/gallery-3.jpg";
65 _imageView.ParentOrigin = ParentOrigin.Center;
66 _imageView.AnchorPoint = AnchorPoint.Center;
67 _imageView.PixelArea = new RelativeVector4(0.0f, 0.0f, 0.0f, 0.0f);
69 _stage.GetDefaultLayer().Add(_imageView);
72 // Callback for stage touched signal handling
73 private void OnStageTouched(object sender, Stage.TouchEventArgs e)
75 // Only animate the _text label when touch down happens
76 if (e.Touch.GetState(0) == PointStateType.Down)
78 // Create a new _animation
84 _animation = new Animation(1000); // 1 second of duration
85 _animation.AnimateTo(_imageView, "PixelArea", new RelativeVector4(0.0f, 0.0f, 1.0f, 1.0f), 0, 1000);
86 _animation.EndAction = Animation.EndActions.Discard;
87 _animation.PlayRange = new RelativeVector2(0.2f, 0.8f);
89 // Play the _animation
95 /// The main entry point for the application.
99 static void _Main(string[] args)
101 Tizen.Log.Debug("NUI", "Hello mono world.");
102 Example example = new Example("stylesheet", WindowMode.Transparent);