X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=blobdiff_plain;f=plugins%2Fdali-swig%2Fexamples%2Fhello-world.cs;h=60c779129ed110ef9f31f0ba81887fc1fe60cde8;hp=8437e3ae5eff4730552ed49d441335beff33e856;hb=1730389b12a4a189b54c04ce357a7dba026dd7b8;hpb=5bd894028f19daf459f08340a1482aeb679a87f8 diff --git a/plugins/dali-swig/examples/hello-world.cs b/plugins/dali-swig/examples/hello-world.cs index 8437e3a..60c7791 100755 --- a/plugins/dali-swig/examples/hello-world.cs +++ b/plugins/dali-swig/examples/hello-world.cs @@ -22,146 +22,113 @@ using Dali.Constants; namespace MyCSharpExample { - class Example - { - private Dali.Application _application; - private Animation _animation; - private TextLabel _text; - - public Example(Dali.Application application) + class Example { - _application = application; - _application.Initialized += Initialize; - } - - public void Initialize(object source, AUIApplicationInitEventArgs e) - { - Console.WriteLine("Customized Application Initialize event handler"); - Stage stage = Stage.GetCurrent(); - stage.BackgroundColor = Color.Cyan; - stage.TouchEvent += OnStageTouched; - stage.WheelEvent += OnStageWheelMoved; - stage.KeyEvent += OnStageKeyPressed; - stage.EventProcessingFinished += OnStageEventProcessingFinished; - - // Add a _text label to the stage - _text = new TextLabel("Hello Mono World"); - _text.ParentOrigin = ParentOrigin.Center; - _text.AnchorPoint = AnchorPoint.Center; - _text.HorizontalAlignment = "CENTER"; - _text.PointSize = 32.0f; - _text.TextColor = Color.Magenta; - stage.Add(_text); - } + private Dali.Application _application; + private Animation _animation; + private TextLabel _text; + private Stage _stage; - // Callback for _animation finished signal handling - public void AnimationFinished(object sender, EventArgs e) - { - Console.WriteLine("AnimationFinished()!"); - } - - // Callback for _animation finished signal handling - public void AnimationFinished2(object sender, EventArgs e) - { - Console.WriteLine("AnimationFinished2()!"); - if(_animation) - { - Console.WriteLine("Duration= " + _animation.Duration); - Console.WriteLine("EndAction= " + _animation.EndAction); - } - } - - public void OnStageEventProcessingFinished(object sender, EventArgs e) - { - Console.WriteLine("OnStageEventProcessingFinished()!"); - if( e != null) - { - Console.WriteLine("e != null !"); - } - } - - public void OnStageKeyPressed(object sender, Stage.KeyEventArgs e) - { - Console.WriteLine("OnStageKeyEventOccured()!"); - Console.WriteLine("keyPressedName=" + e.KeyEvent.keyPressedName); - Console.WriteLine("state=" + e.KeyEvent.state); - } + public Example(Dali.Application application) + { + _application = application; + _application.Initialized += Initialize; + } - public void OnStageWheelMoved(object sender, Stage.WheelEventArgs e) - { - Console.WriteLine("OnStageWheelEventOccured()!"); - Console.WriteLine("direction=" + e.WheelEvent.direction); - Console.WriteLine("type=" + e.WheelEvent.type); - } + public void Initialize(object source, NUIApplicationInitEventArgs e) + { + Console.WriteLine("Customized Application Initialize event handler"); + _stage = Stage.Instance; + _stage.BackgroundColor = Color.White; + _stage.Touch += OnStageTouched; + + // Add a _text label to the stage + _text = new TextLabel("Hello Mono World"); + _text.ParentOrigin = ParentOrigin.Center; + _text.AnchorPoint = AnchorPoint.Center; + _text.HorizontalAlignment = "CENTER"; + _text.PointSize = 32.0f; + _text.TextColor = Color.Magenta; + _stage.Add(_text); + + _animation = new Animation + { + StartTime = 0, + EndTime = 500, + TargetProperty = "Orientation", + Destination = new Rotation(new Radian(new Degree(180.0f)), PositionAxis.X) + }; + _animation.AnimateTo(_text); + + _animation.StartTime = 500; + _animation.EndTime = 1000; + _animation.TargetProperty = "Orientation"; + _animation.Destination = new Rotation(new Radian(new Degree(0.0f)), PositionAxis.X); + _animation.AnimateTo(_text); + + _animation.StartTime = 1000; + _animation.EndTime = 1500; + _animation.TargetProperty = "ScaleX"; + _animation.Destination = 3.0f; + _animation.AnimateBy(_text); + + _animation.StartTime = 1500; + _animation.EndTime = 2000; + _animation.TargetProperty = "ScaleY"; + _animation.Destination = 4.0f; + _animation.AnimateBy(_text); + + _animation.EndAction = Animation.EndActions.Discard; + + // Connect the signal callback for animaiton finished signal + _animation.Finished += AnimationFinished; + } - // Callback for stage touched signal handling - public void OnStageTouched(object sender, Stage.TouchEventArgs e) - { - // Only animate the _text label when touch down happens - if( e.TouchData.GetState(0) == PointStateType.DOWN ) - { - Console.WriteLine("Customized Stage Touch event handler"); - // Create a new _animation - if( _animation ) + // Callback for _animation finished signal handling + public void AnimationFinished(object sender, EventArgs e) { - //_animation.Stop(Dali.Constants.Animation.EndAction.Stop); - _animation.Reset(); + Console.WriteLine("AnimationFinished()!"); + if (_animation) + { + Console.WriteLine("Duration= " + _animation.Duration); + Console.WriteLine("EndAction= " + _animation.EndAction); + } } - _animation = new Animation { - Duration = 2000, - StartTime = 0, - EndTime = 500, - TargetPoperty = "Orientation", - Destination = new Quaternion( new Radian( new Degree( 180.0f ) ), Vect3.Xaxis) - }; - _animation.AnimateTo(_text); - - _animation.StartTime = 500; - _animation.EndTime = 1000; - _animation.TargetPoperty = "Orientation"; - _animation.Destination = new Quaternion( new Radian( new Degree( 0.0f ) ), Vect3.Xaxis ); - _animation.AnimateTo(_text); - - _animation.StartTime = 1000; - _animation.EndTime = 1500; - _animation.TargetPoperty = "ScaleX"; - _animation.Destination = 3.0f; - _animation.AnimateBy(_text); - - _animation.StartTime = 1500; - _animation.EndTime = 2000; - _animation.TargetPoperty = "ScaleY"; - _animation.Destination = 4.0f; - _animation.AnimateBy(_text); - - _animation.EndAction = Dali.Constants.Animation.EndAction.Discard; - - // Connect the signal callback for animaiton finished signal - _animation.Finished += AnimationFinished; - _animation.Finished += AnimationFinished2; - - // Play the _animation - _animation.Play(); - - } - } + // Callback for stage touched signal handling + public void OnStageTouched(object sender, Stage.TouchEventArgs e) + { + // Only animate the _text label when touch down happens + if (e.Touch.GetState(0) == PointStateType.DOWN) + { + Console.WriteLine("Customized Stage Touch event handler"); + + // Create a new _animation + if (_animation) + { + _animation.Stop(); + } + // Play the _animation + _animation.Play(); + } + } - public void MainLoop() - { - _application.MainLoop (); - } + public void MainLoop() + { + _application.MainLoop(); + } - /// - /// The main entry point for the application. - /// - [STAThread] - static void Main(string[] args) - { - Console.WriteLine ("Main() called!"); + /// + /// The main entry point for the application. + /// + [STAThread] + static void Main(string[] args) + { + Console.WriteLine("Main() called!"); - Example example = new Example(Application.NewApplication()); - example.MainLoop (); + Example example = new Example(Application.NewApplication()); + example.MainLoop(); + } } - } } +