X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=plugins%2Fdali-swig%2Fexamples%2Fhello-world.cs;h=be7a11ba0d734c6ac19cead599cc5d9757fac33f;hb=65c8ea87d01df59b7131610364319fd977de7e3d;hp=d96d9777daa78425c9e0947bce4ffb13921c3af4;hpb=e2ab03b7246a8621d025f02a0a2f9325748f993c;p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git diff --git a/plugins/dali-swig/examples/hello-world.cs b/plugins/dali-swig/examples/hello-world.cs index d96d977..be7a11b 100755 --- a/plugins/dali-swig/examples/hello-world.cs +++ b/plugins/dali-swig/examples/hello-world.cs @@ -23,15 +23,6 @@ namespace MyCSharpExample { class Example { - [UnmanagedFunctionPointer(CallingConvention.StdCall)] - delegate void CallbackDelegate(IntPtr data); - - [UnmanagedFunctionPointer(CallingConvention.StdCall)] - delegate void TouchCallbackDelegate(IntPtr data); - - [UnmanagedFunctionPointer(CallingConvention.StdCall)] - delegate void AnimationCallbackDelegate(IntPtr data); - private Dali.Application _application; private Animation _animation; @@ -40,19 +31,16 @@ namespace MyCSharpExample public Example(Dali.Application application) { _application = application; - - CallbackDelegate initializeCallback = new CallbackDelegate( Initialize ); - _application.InitSignal().Connect( initializeCallback ); + _application.Initialized += Initialize; } - private void Initialize(IntPtr appPtr) + public void Initialize(object source, AUIApplicationInitEventArgs e) { + Console.WriteLine("Customized Application Initialize event handler"); Stage stage = Stage.GetCurrent(); - stage.SetBackgroundColor( NDalic.WHITE ); + stage.BackgroundColor = Color.Green; - // Connect the signal callback for stage touched signal - TouchCallbackDelegate stageTouchedCallback = new TouchCallbackDelegate( OnStageTouched ); - stage.TouchSignal().Connect( stageTouchedCallback ); + stage.Touched += OnStageTouched; // Add a _text label to the stage _text = new TextLabel("Hello Mono World"); @@ -65,20 +53,22 @@ namespace MyCSharpExample } // Callback for _animation finished signal handling - private void AnimationFinished(IntPtr data) + public void AnimationFinished(object source, Animation.FinishedEventArgs e) { - Animation _animation = Animation.GetAnimationFromPtr( data ); - Console.WriteLine("Animation finished: duration = " + _animation.GetDuration()); + Console.WriteLine("Customized Animation Finished Event handler"); + Console.WriteLine("Animation finished: duration = " + e.Animation.Duration); + Console.WriteLine("End Action = " + e.Animation.GetEndAction()); } // Callback for stage touched signal handling - private void OnStageTouched(IntPtr data) + public void OnStageTouched(object source, Stage.TouchEventArgs e) { - TouchData touchData = TouchData.GetTouchDataFromPtr( data ); + //TouchData touchData = TouchData.GetTouchDataFromPtr( data ); // Only animate the _text label when touch down happens - if( touchData.GetState(0) == PointStateType.DOWN ) + if( e.TouchData.GetState(0) == PointStateType.DOWN ) { + Console.WriteLine("Customized Stage Touch event handler"); // Create a new _animation if( _animation ) { @@ -87,15 +77,17 @@ namespace MyCSharpExample _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(_text, Animation.Orientation, new Quaternion( new Radian( new Degree( 180.0f ) ), Vector3.XAXIS ), new AlphaFunction(Dali.Constants.AlphaFunction.BuiltinFunction.Linear), new TimePeriod(0.0f, 0.5f)); + + _animation.AnimateTo(_text, Animation.Orientation, new Quaternion( new Radian( new Degree( 0.0f ) ), Vector3.XAXIS ), new AlphaFunction(Dali.Constants.AlphaFunction.BuiltinFunction.Linear), new TimePeriod(0.5f, 0.5f)); // Connect the signal callback for animaiton finished signal - AnimationCallbackDelegate animFinishedDelegate = new AnimationCallbackDelegate( AnimationFinished ); - _animation.FinishedSignal().Connect( animFinishedDelegate ); + _animation.Finished += AnimationFinished; // Play the _animation _animation.Play(); + + Console.WriteLine("Looping:" + _animation.Looping); } }