using System;
using System.Runtime.InteropServices;
using Dali;
-using Dali.CSharp;
namespace MyCSharpExample
{
}
- public void Initialize(object source, AUIApplicationInitEventArgs e)
+ public void Initialize(object source, NUIApplicationInitEventArgs e)
{
CreateScrollView();
}
private void CreateScrollView()
{
Stage stage = Stage.GetCurrent();
- stage.BackgroundColor = new Dali.CSharp.Color(Dali.CSharp.Colors.Green);
+ stage.BackgroundColor = Color.White;
// Create a scroll view
_scrollView = new ScrollView();
Size stageSize = stage.Size;
_scrollView.Size = new Position(stageSize.W, stageSize.H, 0.0f);
- _scrollView.ParentOrigin = new Position(NDalic.ParentOriginCenter);
- _scrollView.AnchorPoint = new Position(NDalic.AnchorPointCenter);
+ _scrollView.ParentOrigin = NDalic.ParentOriginCenter;
+ _scrollView.AnchorPoint = NDalic.AnchorPointCenter;
stage.Add(_scrollView);
// Add actors to a scroll view with 3 pages
{
View pageActor = new View();
pageActor.SetResizePolicy(ResizePolicyType.FILL_TO_PARENT, DimensionType.ALL_DIMENSIONS);
- pageActor.ParentOrigin = new Position(NDalic.ParentOriginCenter);
- pageActor.AnchorPoint = new Position(NDalic.AnchorPointCenter);
+ pageActor.ParentOrigin = NDalic.ParentOriginCenter;
+ pageActor.AnchorPoint = NDalic.AnchorPointCenter;
pageActor.Position = new Position(pageColumn * stageSize.W, pageRow * stageSize.H, 0.0f);
// Add images in a 3x4 grid layout for each page
{
int imageId = (row * imageColumns + column) % 2 + 1;
ImageView imageView = new ImageView("images/image-" + imageId + ".jpg");
- imageView.ParentOrigin = new Position(NDalic.ParentOriginCenter);
- imageView.AnchorPoint = new Position(NDalic.AnchorPointCenter);
+ imageView.ParentOrigin = NDalic.ParentOriginCenter;
+ imageView.AnchorPoint = NDalic.AnchorPointCenter;
imageView.Size = imageSize;
imageView.Position = new Position( margin * 0.5f + (imageSize.X + margin) * column - stageSize.W * 0.5f + imageSize.X * 0.5f,
margin * 0.5f + (imageSize.Y + margin) * row - stageSize.H * 0.5f + imageSize.Y * 0.5f, 0.0f );
// Create a horizontal scroll bar in the bottom of scroll view (which is optional)
_scrollBar = new ScrollBar();
- _scrollBar.ParentOrigin = new Position(NDalic.ParentOriginBottomLeft);
- _scrollBar.AnchorPoint = new Position(NDalic.AnchorPointTopLeft);
+ _scrollBar.ParentOrigin = NDalic.ParentOriginBottomLeft;
+ _scrollBar.AnchorPoint = NDalic.AnchorPointTopLeft;
_scrollBar.SetResizePolicy(ResizePolicyType.FIT_TO_CHILDREN, DimensionType.WIDTH);
_scrollBar.SetResizePolicy(ResizePolicyType.FILL_TO_PARENT, DimensionType.HEIGHT);
- _scrollBar.Orientation = new Quaternion( new Radian( new Degree( 270.0f ) ), Vector3.ZAXIS);
+ _scrollBar.Orientation = new Rotation( new Radian( new Degree( 270.0f ) ), Vector3.ZAXIS );
_scrollBar.SetScrollDirection(ScrollBar.Direction.Horizontal);
_scrollView.Add(_scrollBar);
_scrollView.WheelMoved += Onwheel;
_scrollView.KeyInputFocusGained += OnKey;
_text = new TextLabel("View Touch Event Handler Test");
- _text.ParentOrigin = new Position(NDalic.ParentOriginCenter);
- _text.AnchorPoint = new Position(NDalic.AnchorPointCenter);
+ _text.ParentOrigin = NDalic.ParentOriginCenter;
+ _text.AnchorPoint = NDalic.AnchorPointCenter;
_text.HorizontalAlignment = "CENTER";
_text.PointSize = 48.0f;
}
// Callback for _animation finished signal handling
- public void AnimationFinished(object source, Animation.FinishedEventArgs e)
+ public void AnimationFinished(object sender, EventArgs e)
{
Console.WriteLine("Customized Animation Finished Event handler");
- Console.WriteLine("Animation finished: duration = " + e.Animation.Duration);
}
private void OnKey(object source, View.KeyInputFocusGainedEventArgs e)
{
Console.WriteLine("View TOUCH EVENT callback....");
// Only animate the _text label when touch down happens
- if( e.TouchData.GetState(0) == PointStateType.DOWN )
+ if( e.Touch.GetState(0) == PointStateType.DOWN )
{
Console.WriteLine("Customized Stage Touch event handler");
// Create a new _animation
_animation = new Animation(1.0f); // 1 second of duration
- _animation.AnimateTo(new Property(_text, Actor.Property.ORIENTATION), new Property.Value(new Quaternion( new Radian( new Degree( 180.0f ) ), Vector3.XAXIS )), new AlphaFunction(AlphaFunction.BuiltinFunction.LINEAR), new TimePeriod(0.0f, 0.5f));
- _animation.AnimateTo(new Property(_text, Actor.Property.ORIENTATION), new Property.Value(new Quaternion( new Radian( new Degree( 0.0f ) ), Vector3.XAXIS )), new AlphaFunction(AlphaFunction.BuiltinFunction.LINEAR), new TimePeriod(0.5f, 0.5f));
+ _animation.AnimateTo(new Property(_text, Actor.Property.ORIENTATION), new Property.Value(new Rotation( new Radian( new Degree( 180.0f ) ), Vector3.XAXIS )), new AlphaFunction(AlphaFunction.BuiltinFunction.Linear), new TimePeriod(0.0f, 0.5f));
+ _animation.AnimateTo(new Property(_text, Actor.Property.ORIENTATION), new Property.Value(new Rotation( new Radian( new Degree( 0.0f ) ), Vector3.XAXIS )), new AlphaFunction(AlphaFunction.BuiltinFunction.Linear), new TimePeriod(0.5f, 0.5f));
// Connect the signal callback for animaiton finished signal
_animation.Finished += AnimationFinished;