2 * Copyright(c) 2019 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.
21 using System.ComponentModel;
22 using System.Runtime.InteropServices;
23 using Tizen.NUI.BaseComponents;
25 using System.Collections;
26 using System.Collections.Generic;
28 using System.Reflection;
30 using Tizen.NUI.Binding.Internals;
31 using Tizen.NUI.Binding;
32 using System.Globalization;
33 using Tizen.NUI.Xaml.Internals;
36 /// Animation can be used to animate the properties of any number of objects, typically view.<br />
37 /// If the "Finished" event is connected to a member function of an object, it must be disconnected before the object is destroyed.<br />
38 /// This is typically done in the object destructor, and requires either the animation handle to be stored.<br />
39 /// The overall animation time is superseded by the values given in the animation time used when calling the AnimateTo(), AnimateBy(), AnimateBetween() and AnimatePath() methods.<br />
40 /// If any of the individual calls to those functions exceeds the overall animation time (Duration), then the overall animation time is automatically extended.<br />
42 /// <since_tizen> 3 </since_tizen>
43 public class Animation : BaseHandle
45 private static bool? disableAnimation = null;
48 private AnimationFinishedEventCallbackType _animationFinishedEventCallback;
49 private System.IntPtr _finishedCallbackOfNative;
51 private AnimationProgressReachedEventCallbackType _animationProgressReachedEventCallback;
53 private string[] _properties = null;
54 private string[] _destValue = null;
55 private int[] _startTime = null;
56 private int[] _endTime = null;
59 /// Creates an initialized animation.<br />
60 /// The animation will not loop.<br />
61 /// The default end action is "Cancel".<br />
62 /// The default alpha function is linear.<br />
64 /// <remarks>DurationmSeconds must be greater than zero.</remarks>
65 /// <param name="durationMilliSeconds">The duration in milliseconds.</param>
66 /// <since_tizen> 3 </since_tizen>
67 public Animation(int durationMilliSeconds) : this(Interop.Animation.Animation_New((float)durationMilliSeconds / 1000.0f), true)
69 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
72 internal Animation(global::System.IntPtr cPtr, bool cMemoryOwn) : base(Interop.Animation.Animation_SWIGUpcast(cPtr), cMemoryOwn)
75 _animationFinishedEventCallback = OnFinished;
76 _finishedCallbackOfNative = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate<System.Delegate>(_animationFinishedEventCallback);
79 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
80 private delegate void AnimationFinishedEventCallbackType(IntPtr data);
82 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
83 private delegate void AnimationProgressReachedEventCallbackType(IntPtr data);
85 private event EventHandler _animationFinishedEventHandler;
88 * @brief Event for the finished signal which can be used to subscribe or unsubscribe the event handler.
89 * The finished signal is emitted when an animation's animations have finished.
91 /// <since_tizen> 3 </since_tizen>
92 public event EventHandler Finished
96 if (_animationFinishedEventHandler == null && disposed == false)
98 FinishedSignal().Connect(_finishedCallbackOfNative);
100 _animationFinishedEventHandler += value;
104 _animationFinishedEventHandler -= value;
106 if (_animationFinishedEventHandler == null && FinishedSignal().Empty() == false)
108 FinishedSignal().Disconnect(_finishedCallbackOfNative);
113 private event EventHandler _animationProgressReachedEventHandler;
116 * @brief Event for the ProgressReached signal, which can be used to subscribe or unsubscribe the event handler.
117 * The ProgressReached signal is emitted when the animation has reached a given progress percentage, this is set in the api SetProgressNotification.
119 /// <since_tizen> 3 </since_tizen>
120 public event EventHandler ProgressReached
124 if (_animationProgressReachedEventHandler == null)
126 _animationProgressReachedEventCallback = OnProgressReached;
127 ProgressReachedSignal().Connect(_animationProgressReachedEventCallback);
130 _animationProgressReachedEventHandler += value;
134 _animationProgressReachedEventHandler -= value;
136 if (_animationProgressReachedEventHandler == null && ProgressReachedSignal().Empty() == false)
138 ProgressReachedSignal().Disconnect(_animationProgressReachedEventCallback);
144 /// Enumeration for what to do when the animation ends, stopped, or destroyed.
146 /// <since_tizen> 3 </since_tizen>
147 public enum EndActions
150 /// When the animation ends, the animated property values are saved.
154 /// When the animation ends, the animated property values are forgotten.
158 /// If the animation is stopped, the animated property values are saved as if the animation had run to completion, otherwise behaves like cancel.
164 /// Enumeration for what interpolation method to use on key-frame animations.
166 /// <since_tizen> 3 </since_tizen>
167 public enum Interpolation
170 /// Values in between key frames are interpolated using a linear polynomial. (Default)
174 /// Values in between key frames are interpolated using a cubic polynomial.
180 /// Enumeration for what state the animation is in.
182 /// <remarks>Calling Reset() on this class will not reset the animation. It will call the BaseHandle.Reset() which drops the object handle.</remarks>
183 /// <since_tizen> 3 </since_tizen>
187 /// The animation has stopped.
191 /// The animation is playing.
195 /// The animation is paused.
201 /// Gets or sets the duration in milliseconds of the animation.
203 /// <since_tizen> 3 </since_tizen>
208 SetDuration(MilliSecondsToSeconds(value));
212 return SecondsToMilliSeconds(GetDuration());
217 /// Gets or sets the default alpha function for the animation.
219 /// <since_tizen> 3 </since_tizen>
220 public AlphaFunction DefaultAlphaFunction
224 SetDefaultAlphaFunction(value);
228 AlphaFunction ret = GetDefaultAlphaFunction();
234 /// Queries the state of the animation.
236 /// <since_tizen> 3 </since_tizen>
246 /// Set: Enables looping for a specified number of repeats. A zero is the same as Looping = true; i.e., repeat forever.<br />
247 /// This property resets the looping value and should not be used with the Looping property.<br />
248 /// Setting this parameter does not cause the animation to Play().<br />
249 /// Get: Gets the loop count. A zero is the same as Looping = true; i.e., repeat forever.<br />
250 /// The loop count is initially 1 for play once.<br />
252 /// <since_tizen> 3 </since_tizen>
261 int ret = GetLoopCount();
267 /// Gets or sets the status of whether the animation will loop.<br />
268 /// This property resets the loop count and should not be used with the LoopCount property.<br />
269 /// Setting this parameter does not cause the animation to Play().<br />
271 /// <since_tizen> 3 </since_tizen>
280 bool ret = IsLooping();
287 /// Gets or sets the end action of the animation.<br />
288 /// This action is performed when the animation ends or if it is stopped.<br />
289 /// The default end action is cancel.<br />
291 /// <since_tizen> 3 </since_tizen>
292 public EndActions EndAction
300 return GetEndAction();
305 /// Gets the current loop count.<br />
306 /// A value 0 indicating the current loop count when looping.<br />
308 /// <since_tizen> 3 </since_tizen>
309 public int CurrentLoop
313 return GetCurrentLoop();
318 /// Gets or sets the disconnect action.<br />
319 /// If any of the animated property owners are disconnected from the stage while the animation is being played, then this action is performed.<br />
320 /// The default action is cancel.<br />
322 /// <since_tizen> 3 </since_tizen>
323 public EndActions DisconnectAction
327 Interop.Animation.Animation_SetDisconnectAction(swigCPtr, (int)value);
328 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
332 Animation.EndActions ret = (Animation.EndActions)Interop.Animation.Animation_GetDisconnectAction(swigCPtr);
333 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
340 /// Gets or sets the progress of the animation.<br />
341 /// The animation will play (or continue playing) from this point.<br />
342 /// The progress must be in the 0-1 interval or in the play range interval if defined<br />
343 /// otherwise, it will be ignored.<br />
345 /// <since_tizen> 3 </since_tizen>
346 public float CurrentProgress
350 Interop.Animation.Animation_SetCurrentProgress(swigCPtr, value);
351 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
355 float ret = Interop.Animation.Animation_GetCurrentProgress(swigCPtr);
356 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
362 /// Gets or sets specificifications of a speed factor for the animation.<br />
363 /// The speed factor is a multiplier of the normal velocity of the animation.<br />
364 /// Values between [0, 1] will slow down the animation and values above one will speed up the animation.<br />
365 /// It is also possible to specify a negative multiplier to play the animation in reverse.<br />
367 /// <since_tizen> 3 </since_tizen>
368 public float SpeedFactor
372 Interop.Animation.Animation_SetSpeedFactor(swigCPtr, value);
373 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
377 float ret = Interop.Animation.Animation_GetSpeedFactor(swigCPtr);
378 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
384 /// Gets or sets the playing range.<br />
385 /// Animation will play between the values specified. Both values (range.x and range.y ) should be between 0-1,
386 /// otherwise they will be ignored. If the range provided is not in proper order (minimum, maximum ), it will be reordered.<br />
388 /// <since_tizen> 3 </since_tizen>
389 public RelativeVector2 PlayRange
393 Interop.Animation.Animation_SetPlayRange(swigCPtr, Vector2.getCPtr(value));
394 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
398 Vector2 ret = new Vector2(Interop.Animation.Animation_GetPlayRange(swigCPtr), true);
399 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
406 /// Gets or sets the progress notification marker which triggers the ProgressReachedSignal.<br />
407 /// Percentage of animation progress should be greater than 0 and less than 1, for example, 0.3 for 30% <br />
408 /// One notification can be set on each animation.
410 /// <since_tizen> 3 </since_tizen>
411 public float ProgressNotification
415 Interop.Animation.Animation_SetProgressNotification(swigCPtr, value);
416 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
420 float ret = Interop.Animation.Animation_GetProgressNotification(swigCPtr);
421 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
427 /// Gets or sets the properties of the animation.
429 public string[] Properties
442 /// Gets or sets the destination value for each property of the animation.
444 public string[] DestValue
457 /// Gets or sets the start time for each property of the animation.
459 public int[] StartTime
472 /// Gets or sets the end time for each property of the animation.
486 private bool DisableAnimation
490 if (disableAnimation.HasValue == false)
492 string type = Environment.GetEnvironmentVariable("PlatformSmartType");
494 disableAnimation = true;
496 disableAnimation = false;
498 return disableAnimation.Value;
503 /// Downcasts a handle to animation handle.<br />
504 /// If handle points to an animation object, the downcast produces a valid handle.<br />
505 /// If not, the returned handle is left uninitialized.<br />
507 /// <param name="handle">Handle to an object.</param>
508 /// <returns>Handle to an animation object or an uninitialized handle.</returns>
509 /// <since_tizen> 3 </since_tizen>
510 [Obsolete("Deprecated in API6, Will be removed in API9, Please use as keyword instead!")]
511 [EditorBrowsable(EditorBrowsableState.Never)]
512 public static Animation DownCast(BaseHandle handle)
514 Animation ret = Registry.GetManagedBaseHandleFromNativePtr(handle) as Animation;
515 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
520 /// Stops the animation.
522 /// <param name="action">The end action can be set.</param>
523 /// <since_tizen> 3 </since_tizen>
524 public void Stop(EndActions action = EndActions.Cancel)
526 SetEndAction(action);
527 Interop.Animation.Animation_Stop(swigCPtr);
528 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
532 /// Animates a property value by a relative amount.<br />
534 /// <param name="target">The target object to animate.</param>
535 /// <param name="property">The target property to animate.</param>
536 /// <param name="relativeValue">The property value will change by this amount.</param>
537 /// <param name="alphaFunction">The alpha function to apply.</param>
538 /// <since_tizen> 3 </since_tizen>
539 public void AnimateBy(View target, string property, object relativeValue, AlphaFunction alphaFunction = null)
541 Property _prop = PropertyHelper.GetPropertyFromString(target, property);
542 relativeValue = AvoidFloatPropertyHasIntegerValue(target, _prop, relativeValue);
543 PropertyValue val = PropertyValue.CreateFromObject(relativeValue);
545 if (alphaFunction != null)
547 AnimateBy(_prop, val, alphaFunction);
551 AnimateBy(_prop, val);
556 /// Animates a property value by a relative amount.<br />
558 /// <param name="target">The target object to animate.</param>
559 /// <param name="property">The target property to animate.</param>
560 /// <param name="relativeValue">The property value will change by this amount.</param>
561 /// <param name="startTime">The start time of the animation.</param>
562 /// <param name="endTime">The end time of the animation.</param>
563 /// <param name="alphaFunction">The alpha function to apply.</param>
564 /// <since_tizen> 3 </since_tizen>
565 public void AnimateBy(View target, string property, object relativeValue, int startTime, int endTime, AlphaFunction alphaFunction = null)
567 Property _prop = PropertyHelper.GetPropertyFromString(target, property);
568 relativeValue = AvoidFloatPropertyHasIntegerValue(target, _prop, relativeValue);
569 PropertyValue val = PropertyValue.CreateFromObject(relativeValue);
571 if (alphaFunction != null)
573 Tizen.NUI.TimePeriod time = new Tizen.NUI.TimePeriod(MilliSecondsToSeconds(startTime), MilliSecondsToSeconds(endTime - startTime));
574 AnimateBy(_prop, val, alphaFunction, time);
578 Tizen.NUI.TimePeriod time = new Tizen.NUI.TimePeriod(MilliSecondsToSeconds(startTime), MilliSecondsToSeconds(endTime - startTime));
579 AnimateBy(_prop, val, time);
584 /// Animates a property to a destination value.<br />
586 /// <param name="target">The target object to animate.</param>
587 /// <param name="property">The target property to animate.</param>
588 /// <param name="destinationValue">The destination value.</param>
589 /// <param name="alphaFunction">The alpha function to apply.</param>
590 /// <since_tizen> 3 </since_tizen>
591 public void AnimateTo(View target, string property, object destinationValue, AlphaFunction alphaFunction = null)
593 Property _prop = PropertyHelper.GetPropertyFromString(target, property);
594 destinationValue = AvoidFloatPropertyHasIntegerValue(target, _prop, destinationValue);
595 PropertyValue val = PropertyValue.CreateFromObject(destinationValue);
597 if (alphaFunction != null)
599 AnimateTo(_prop, val, alphaFunction);
603 AnimateTo(_prop, val);
608 /// Animates one or more properties to a destination value.<br />
610 /// <param name="target">The target object to animate.</param>
611 public void PlayAnimateTo(View target)
614 if (_properties.Length == _destValue.Length && _startTime.Length == _endTime.Length && _properties.Length == _startTime.Length)
616 int length = _properties.Length;
617 for (int index = 0; index < length; index++)
619 //object destinationValue = _destValue[index];
620 var elementType = target.GetType();
621 PropertyInfo propertyInfo = elementType.GetProperties().FirstOrDefault(fi => fi.Name == _properties[index]);
622 //var propertyInfo = elementType.GetRuntimeProperties().FirstOrDefault(p => p.Name == localName);
623 if (propertyInfo != null)
625 object destinationValue = ConvertTo(_destValue[index], propertyInfo.PropertyType);
627 if (destinationValue != null)
629 AnimateTo(target, _properties[index], destinationValue, _startTime[index], _endTime[index]);
638 /// Animates a property to a destination value.<br />
640 /// <param name="target">The target object to animate.</param>
641 /// <param name="property">The target property to animate.</param>
642 /// <param name="destinationValue">The destination value.</param>
643 /// <param name="startTime">The start time of the animation.</param>
644 /// <param name="endTime">The end time of the animation.</param>
645 /// <param name="alphaFunction">The alpha function to apply.</param>
646 /// <since_tizen> 3 </since_tizen>
647 public void AnimateTo(View target, string property, object destinationValue, int startTime, int endTime, AlphaFunction alphaFunction = null)
649 Property _prop = PropertyHelper.GetPropertyFromString(target, property);
650 destinationValue = AvoidFloatPropertyHasIntegerValue(target, _prop, destinationValue);
651 PropertyValue val = PropertyValue.CreateFromObject(destinationValue);
653 if (alphaFunction != null)
655 Tizen.NUI.TimePeriod time = new Tizen.NUI.TimePeriod(MilliSecondsToSeconds(startTime), MilliSecondsToSeconds(endTime - startTime));
656 AnimateTo(_prop, val, alphaFunction, time);
660 Tizen.NUI.TimePeriod time = new Tizen.NUI.TimePeriod(MilliSecondsToSeconds(startTime), MilliSecondsToSeconds(endTime - startTime));
661 AnimateTo(_prop, val, time);
666 /// Animates a property between keyframes.
668 /// <param name="target">The target object to animate.</param>
669 /// <param name="property">The target property to animate.</param>
670 /// <param name="keyFrames">The set of time or value pairs between which to animate.</param>
671 /// <param name="interpolation">The method used to interpolate between values.</param>
672 /// <param name="alphaFunction">The alpha function to apply.</param>
673 /// <since_tizen> 3 </since_tizen>
674 public void AnimateBetween(View target, string property, KeyFrames keyFrames, Interpolation interpolation = Interpolation.Linear, AlphaFunction alphaFunction = null)
676 Property _prop = PropertyHelper.GetPropertyFromString(target, property);
678 if (_prop.propertyIndex == Property.INVALID_INDEX)
680 throw new System.ArgumentException("second argument string property is invalid parameter!");
683 if (alphaFunction != null)
685 AnimateBetween(_prop, keyFrames, alphaFunction, interpolation);
689 AnimateBetween(_prop, keyFrames, interpolation);
694 /// Animates a property between keyframes.
696 /// <param name="target">The target object to animate</param>
697 /// <param name="property">The target property to animate</param>
698 /// <param name="keyFrames">The set of time/value pairs between which to animate</param>
699 /// <param name="startTime">The start time of animation in milliseconds.</param>
700 /// <param name="endTime">The end time of animation in milliseconds.</param>
701 /// <param name="interpolation">The method used to interpolate between values.</param>
702 /// <param name="alphaFunction">The alpha function to apply.</param>
703 /// <since_tizen> 3 </since_tizen>
704 public void AnimateBetween(View target, string property, KeyFrames keyFrames, int startTime, int endTime, Interpolation interpolation = Interpolation.Linear, AlphaFunction alphaFunction = null)
706 Property _prop = PropertyHelper.GetPropertyFromString(target, property);
708 Tizen.NUI.TimePeriod time = new Tizen.NUI.TimePeriod(MilliSecondsToSeconds(startTime), MilliSecondsToSeconds(endTime - startTime));
709 if (alphaFunction != null)
711 AnimateBetween(_prop, keyFrames, alphaFunction, time, interpolation);
715 AnimateBetween(_prop, keyFrames, time, interpolation);
720 /// Animates the view's position and orientation through a predefined path.<br />
721 /// The view will rotate to orient the supplied forward vector with the path's tangent.<br />
722 /// If forward is the zero vector then no rotation will happen.<br />
724 /// <param name="view">The view to animate.</param>
725 /// <param name="path">It defines position and orientation.</param>
726 /// <param name="forward">The vector (in local space coordinate system) will be oriented with the path's tangent direction.</param>
727 /// <param name="alphaFunction">The alpha function to apply.</param>
728 /// <since_tizen> 3 </since_tizen>
729 public void AnimatePath(View view, Path path, Vector3 forward, AlphaFunction alphaFunction = null)
731 if (alphaFunction == null)
733 Animate(view, path, forward);
737 Animate(view, path, forward, alphaFunction);
742 /// Animates the view's position and orientation through a predefined path.<br />
743 /// The view will rotate to orient the supplied forward vector with the path's tangent.<br />
744 /// If forward is the zero vector then no rotation will happen.<br />
746 /// <param name="view">The view to animate.</param>
747 /// <param name="path">It defines position and orientation.</param>
748 /// <param name="forward">The vector (in local space coordinate system) will be oriented with the path's tangent direction.</param>
749 /// <param name="startTime">The start time of the animation.</param>
750 /// <param name="endTime">The end time of the animation.</param>
751 /// <param name="alphaFunction">The alpha function to apply.</param>
752 /// <since_tizen> 3 </since_tizen>
753 public void AnimatePath(View view, Path path, Vector3 forward, int startTime, int endTime, AlphaFunction alphaFunction = null)
755 TimePeriod time = new TimePeriod(MilliSecondsToSeconds(startTime), MilliSecondsToSeconds(endTime - startTime));
756 if (alphaFunction == null)
758 Animate(view, path, forward, time);
762 Animate(view, path, forward, alphaFunction, time);
767 /// Creates an initialized animation.<br />
768 /// The animation will not loop.<br />
769 /// The default end action is "Cancel".<br />
770 /// The default alpha function is linear.<br />
772 /// <since_tizen> 3 </since_tizen>
773 public Animation() : this(Interop.Animation.Animation_New(0.0f), true)
775 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
779 /// Plays the animation.
781 /// <since_tizen> 3 </since_tizen>
784 Interop.Animation.Animation_Play(swigCPtr);
785 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
787 if (DisableAnimation == true)
788 Stop(EndActions.StopFinal);
792 /// Plays the animation from a given point.<br />
793 /// The progress must be in the 0-1 interval or in the play range interval if defined,
794 /// otherwise, it will be ignored.<br />
796 /// <param name="progress">A value between [0,1], or between the play range if specified, from where the animation should start playing.</param>
797 /// <since_tizen> 3 </since_tizen>
798 public void PlayFrom(float progress)
800 Interop.Animation.Animation_PlayFrom(swigCPtr, progress);
801 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
805 /// Plays the animation after a given delay time.<br/>
806 /// The delay time is not included in the looping time.<br/>
807 /// When the delay time is a negative value, it would treat as play immediately.<br/>
809 /// <param name="delayMilliseconds">The delay time.</param>
810 /// <since_tizen> 4 </since_tizen>
811 public void PlayAfter(int delayMilliseconds)
813 Interop.Animation.Animation_PlayAfter(swigCPtr, MilliSecondsToSeconds(delayMilliseconds));
814 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
818 /// Pauses the animation.
820 /// <since_tizen> 3 </since_tizen>
823 Interop.Animation.Animation_Pause(swigCPtr);
824 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
828 /// Stops the animation.
830 /// <since_tizen> 3 </since_tizen>
833 Interop.Animation.Animation_Stop(swigCPtr);
834 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
838 /// Clears the animation.<br />
839 /// This disconnects any objects that were being animated, effectively stopping the animation.<br />
841 /// <since_tizen> 3 </since_tizen>
844 Interop.Animation.Animation_Clear(swigCPtr);
845 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
848 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Animation obj)
850 return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
853 internal object ConvertTo(object value, Type toType)
855 Func<object> getConverter = () =>
857 string converterTypeName = GetTypeConverterTypeName(toType.GetTypeInfo().CustomAttributes);
858 if (converterTypeName == null)
861 Type convertertype = Type.GetType(converterTypeName);
862 return Activator.CreateInstance(convertertype);
865 return ConvertTo(value, toType, getConverter);
868 internal object ConvertTo(object value, Type toType, Func<object> getConverter)
873 var str = value as string;
876 //If there's a [TypeConverter], use it
877 object converter = getConverter?.Invoke();
878 var xfTypeConverter = converter as Tizen.NUI.Binding.TypeConverter;
879 if (xfTypeConverter != null)
880 return value = xfTypeConverter.ConvertFromInvariantString(str);
881 var converterType = converter?.GetType();
882 if (converterType != null)
884 var convertFromStringInvariant = converterType.GetRuntimeMethod("ConvertFromInvariantString",
885 new[] { typeof(string) });
886 if (convertFromStringInvariant != null)
887 return value = convertFromStringInvariant.Invoke(converter, new object[] { str });
890 //If the type is nullable, as the value is not null, it's safe to assume we want the built-in conversion
891 if (toType.GetTypeInfo().IsGenericType && toType.GetGenericTypeDefinition() == typeof(Nullable<>))
892 toType = Nullable.GetUnderlyingType(toType);
894 //Obvious Built-in conversions
895 if (toType.GetTypeInfo().IsEnum)
896 return Enum.Parse(toType, str, true);
897 if (toType == typeof(SByte))
898 return SByte.Parse(str, CultureInfo.InvariantCulture);
899 if (toType == typeof(Int16))
900 return Int16.Parse(str, CultureInfo.InvariantCulture);
901 if (toType == typeof(Int32))
902 return Int32.Parse(str, CultureInfo.InvariantCulture);
903 if (toType == typeof(Int64))
904 return Int64.Parse(str, CultureInfo.InvariantCulture);
905 if (toType == typeof(Byte))
906 return Byte.Parse(str, CultureInfo.InvariantCulture);
907 if (toType == typeof(UInt16))
908 return UInt16.Parse(str, CultureInfo.InvariantCulture);
909 if (toType == typeof(UInt32))
910 return UInt32.Parse(str, CultureInfo.InvariantCulture);
911 if (toType == typeof(UInt64))
912 return UInt64.Parse(str, CultureInfo.InvariantCulture);
913 if (toType == typeof(Single))
914 return Single.Parse(str, CultureInfo.InvariantCulture);
915 if (toType == typeof(Double))
916 return Double.Parse(str, CultureInfo.InvariantCulture);
917 if (toType == typeof(Boolean))
918 return Boolean.Parse(str);
919 if (toType == typeof(TimeSpan))
920 return TimeSpan.Parse(str, CultureInfo.InvariantCulture);
921 if (toType == typeof(DateTime))
922 return DateTime.Parse(str, CultureInfo.InvariantCulture);
923 if (toType == typeof(Char))
926 Char.TryParse(str, out c);
929 if (toType == typeof(String) && str.StartsWith("{}", StringComparison.Ordinal))
930 return str.Substring(2);
931 if (toType == typeof(String))
933 if (toType == typeof(Decimal))
934 return Decimal.Parse(str, CultureInfo.InvariantCulture);
937 //if the value is not assignable and there's an implicit conversion, convert
938 if (value != null && !toType.IsAssignableFrom(value.GetType()))
940 var opImplicit = GetImplicitConversionOperator(value.GetType(), value.GetType(), toType)
941 ?? GetImplicitConversionOperator(toType, value.GetType(), toType);
942 //var opImplicit = value.GetType().GetImplicitConversionOperator(fromType: value.GetType(), toType: toType)
943 // ?? toType.GetImplicitConversionOperator(fromType: value.GetType(), toType: toType);
945 if (opImplicit != null)
947 value = opImplicit.Invoke(null, new[] { value });
955 internal string GetTypeConverterTypeName(IEnumerable<CustomAttributeData> attributes)
957 var converterAttribute =
958 attributes.FirstOrDefault(cad => Tizen.NUI.Binding.TypeConverterAttribute.TypeConvertersType.Contains(cad.AttributeType.FullName));
959 if (converterAttribute == null)
961 if (converterAttribute.ConstructorArguments[0].ArgumentType == typeof(string))
962 return (string)converterAttribute.ConstructorArguments[0].Value;
963 if (converterAttribute.ConstructorArguments[0].ArgumentType == typeof(Type))
964 return ((Type)converterAttribute.ConstructorArguments[0].Value).AssemblyQualifiedName;
968 internal MethodInfo GetImplicitConversionOperator(Type onType, Type fromType, Type toType)
971 var mi = onType.GetRuntimeMethod("op_Implicit", new[] { fromType });
973 var bindingFlags = BindingFlags.Public | BindingFlags.Static | BindingFlags.FlattenHierarchy;
974 var mi = onType.GetMethod("op_Implicit", bindingFlags, null, new[] { fromType }, null);
976 if (mi == null) return null;
977 if (!mi.IsSpecialName) return null;
978 if (!mi.IsPublic) return null;
979 if (!mi.IsStatic) return null;
980 if (!toType.IsAssignableFrom(mi.ReturnType)) return null;
985 internal Animation(float durationSeconds) : this(Interop.Animation.Animation_New(durationSeconds), true)
987 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
991 internal Animation(Animation handle) : this(Interop.Animation.new_Animation__SWIG_1(Animation.getCPtr(handle)), true)
993 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
996 internal Animation Assign(Animation rhs)
998 Animation ret = new Animation(Interop.Animation.Animation_Assign(swigCPtr, Animation.getCPtr(rhs)), false);
999 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1003 internal void SetDuration(float seconds)
1005 Interop.Animation.Animation_SetDuration(swigCPtr, seconds);
1006 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1009 internal float GetDuration()
1011 float ret = Interop.Animation.Animation_GetDuration(swigCPtr);
1012 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1016 internal void SetLooping(bool looping)
1018 Interop.Animation.Animation_SetLooping(swigCPtr, looping);
1019 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1022 internal void SetLoopCount(int count)
1024 Interop.Animation.Animation_SetLoopCount(swigCPtr, count);
1025 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1028 internal int GetLoopCount()
1030 int ret = Interop.Animation.Animation_GetLoopCount(swigCPtr);
1031 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1035 internal int GetCurrentLoop()
1037 int ret = Interop.Animation.Animation_GetCurrentLoop(swigCPtr);
1038 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1042 internal bool IsLooping()
1044 bool ret = Interop.Animation.Animation_IsLooping(swigCPtr);
1045 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1049 internal void SetEndAction(Animation.EndActions action)
1051 Interop.Animation.Animation_SetEndAction(swigCPtr, (int)action);
1052 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1055 internal Animation.EndActions GetEndAction()
1057 Animation.EndActions ret = (Animation.EndActions)Interop.Animation.Animation_GetEndAction(swigCPtr);
1058 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1062 internal void SetDisconnectAction(Animation.EndActions disconnectAction)
1064 Interop.Animation.Animation_SetDisconnectAction(swigCPtr, (int)disconnectAction);
1065 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1068 internal Animation.EndActions GetDisconnectAction()
1070 Animation.EndActions ret = (Animation.EndActions)Interop.Animation.Animation_GetDisconnectAction(swigCPtr);
1071 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1075 internal void SetDefaultAlphaFunction(AlphaFunction alpha)
1077 Interop.Animation.Animation_SetDefaultAlphaFunction(swigCPtr, AlphaFunction.getCPtr(alpha));
1078 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1081 internal AlphaFunction GetDefaultAlphaFunction()
1083 AlphaFunction ret = new AlphaFunction(Interop.Animation.Animation_GetDefaultAlphaFunction(swigCPtr), true);
1084 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1088 internal void SetCurrentProgress(float progress)
1090 Interop.Animation.Animation_SetCurrentProgress(swigCPtr, progress);
1091 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1094 internal float GetCurrentProgress()
1096 float ret = Interop.Animation.Animation_GetCurrentProgress(swigCPtr);
1097 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1101 internal void SetSpeedFactor(float factor)
1103 Interop.Animation.Animation_SetSpeedFactor(swigCPtr, factor);
1104 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1107 internal float GetSpeedFactor()
1109 float ret = Interop.Animation.Animation_GetSpeedFactor(swigCPtr);
1110 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1114 internal void SetPlayRange(Vector2 range)
1116 Interop.Animation.Animation_SetPlayRange(swigCPtr, Vector2.getCPtr(range));
1117 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1120 internal Vector2 GetPlayRange()
1122 Vector2 ret = new Vector2(Interop.Animation.Animation_GetPlayRange(swigCPtr), true);
1123 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1127 internal Animation.States GetState()
1129 Animation.States ret = (Animation.States)Interop.Animation.Animation_GetState(swigCPtr);
1130 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1134 internal AnimationSignal FinishedSignal()
1136 AnimationSignal ret = new AnimationSignal(Interop.Animation.Animation_FinishedSignal(swigCPtr), false);
1137 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1141 internal AnimationSignal ProgressReachedSignal()
1143 AnimationSignal ret = new AnimationSignal(Interop.Animation.Animation_ProgressReachedSignal(swigCPtr), false);
1144 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1148 internal void AnimateBy(Property target, PropertyValue relativeValue)
1150 Interop.Animation.Animation_AnimateBy__SWIG_0(swigCPtr, Property.getCPtr(target), PropertyValue.getCPtr(relativeValue));
1151 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1154 internal void AnimateBy(Property target, PropertyValue relativeValue, AlphaFunction alpha)
1156 Interop.Animation.Animation_AnimateBy__SWIG_1(swigCPtr, Property.getCPtr(target), PropertyValue.getCPtr(relativeValue), AlphaFunction.getCPtr(alpha));
1157 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1160 internal void AnimateBy(Property target, PropertyValue relativeValue, TimePeriod period)
1162 Interop.Animation.Animation_AnimateBy__SWIG_2(swigCPtr, Property.getCPtr(target), PropertyValue.getCPtr(relativeValue), TimePeriod.getCPtr(period));
1163 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1166 internal void AnimateBy(Property target, PropertyValue relativeValue, AlphaFunction alpha, TimePeriod period)
1168 Interop.Animation.Animation_AnimateBy__SWIG_3(swigCPtr, Property.getCPtr(target), PropertyValue.getCPtr(relativeValue), AlphaFunction.getCPtr(alpha), TimePeriod.getCPtr(period));
1169 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1172 internal void AnimateTo(Property target, PropertyValue destinationValue)
1174 Interop.Animation.Animation_AnimateTo__SWIG_0(swigCPtr, Property.getCPtr(target), PropertyValue.getCPtr(destinationValue));
1175 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1178 internal void AnimateTo(Property target, PropertyValue destinationValue, AlphaFunction alpha)
1180 Interop.Animation.Animation_AnimateTo__SWIG_1(swigCPtr, Property.getCPtr(target), PropertyValue.getCPtr(destinationValue), AlphaFunction.getCPtr(alpha));
1181 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1184 internal void AnimateTo(Property target, PropertyValue destinationValue, TimePeriod period)
1186 Interop.Animation.Animation_AnimateTo__SWIG_2(swigCPtr, Property.getCPtr(target), PropertyValue.getCPtr(destinationValue), TimePeriod.getCPtr(period));
1187 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1190 internal void AnimateTo(Property target, PropertyValue destinationValue, AlphaFunction alpha, TimePeriod period)
1192 Interop.Animation.Animation_AnimateTo__SWIG_3(swigCPtr, Property.getCPtr(target), PropertyValue.getCPtr(destinationValue), AlphaFunction.getCPtr(alpha), TimePeriod.getCPtr(period));
1193 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1196 internal void AnimateBetween(Property target, KeyFrames keyFrames)
1198 Interop.Animation.Animation_AnimateBetween__SWIG_0(swigCPtr, Property.getCPtr(target), KeyFrames.getCPtr(keyFrames));
1199 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1202 internal void AnimateBetween(Property target, KeyFrames keyFrames, Animation.Interpolation interpolation)
1204 Interop.Animation.Animation_AnimateBetween__SWIG_1(swigCPtr, Property.getCPtr(target), KeyFrames.getCPtr(keyFrames), (int)interpolation);
1205 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1208 internal void AnimateBetween(Property target, KeyFrames keyFrames, AlphaFunction alpha)
1210 Interop.Animation.Animation_AnimateBetween__SWIG_2(swigCPtr, Property.getCPtr(target), KeyFrames.getCPtr(keyFrames), AlphaFunction.getCPtr(alpha));
1211 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1214 internal void AnimateBetween(Property target, KeyFrames keyFrames, AlphaFunction alpha, Animation.Interpolation interpolation)
1216 Interop.Animation.Animation_AnimateBetween__SWIG_3(swigCPtr, Property.getCPtr(target), KeyFrames.getCPtr(keyFrames), AlphaFunction.getCPtr(alpha), (int)interpolation);
1217 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1220 internal void AnimateBetween(Property target, KeyFrames keyFrames, TimePeriod period)
1222 Interop.Animation.Animation_AnimateBetween__SWIG_4(swigCPtr, Property.getCPtr(target), KeyFrames.getCPtr(keyFrames), TimePeriod.getCPtr(period));
1223 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1226 internal void AnimateBetween(Property target, KeyFrames keyFrames, TimePeriod period, Animation.Interpolation interpolation)
1228 Interop.Animation.Animation_AnimateBetween__SWIG_5(swigCPtr, Property.getCPtr(target), KeyFrames.getCPtr(keyFrames), TimePeriod.getCPtr(period), (int)interpolation);
1229 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1232 internal void AnimateBetween(Property target, KeyFrames keyFrames, AlphaFunction alpha, TimePeriod period)
1234 Interop.Animation.Animation_AnimateBetween__SWIG_6(swigCPtr, Property.getCPtr(target), KeyFrames.getCPtr(keyFrames), AlphaFunction.getCPtr(alpha), TimePeriod.getCPtr(period));
1235 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1238 internal void AnimateBetween(Property target, KeyFrames keyFrames, AlphaFunction alpha, TimePeriod period, Animation.Interpolation interpolation)
1240 Interop.Animation.Animation_AnimateBetween__SWIG_7(swigCPtr, Property.getCPtr(target), KeyFrames.getCPtr(keyFrames), AlphaFunction.getCPtr(alpha), TimePeriod.getCPtr(period), (int)interpolation);
1241 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1244 internal void Animate(View view, Path path, Vector3 forward)
1246 Interop.Animation.Animation_Animate__SWIG_0(swigCPtr, View.getCPtr(view), Path.getCPtr(path), Vector3.getCPtr(forward));
1247 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1250 internal void Animate(View view, Path path, Vector3 forward, AlphaFunction alpha)
1252 Interop.Animation.Animation_Animate__SWIG_1(swigCPtr, View.getCPtr(view), Path.getCPtr(path), Vector3.getCPtr(forward), AlphaFunction.getCPtr(alpha));
1253 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1256 internal void Animate(View view, Path path, Vector3 forward, TimePeriod period)
1258 Interop.Animation.Animation_Animate__SWIG_2(swigCPtr, View.getCPtr(view), Path.getCPtr(path), Vector3.getCPtr(forward), TimePeriod.getCPtr(period));
1259 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1262 internal void Animate(View view, Path path, Vector3 forward, AlphaFunction alpha, TimePeriod period)
1264 Interop.Animation.Animation_Animate__SWIG_3(swigCPtr, View.getCPtr(view), Path.getCPtr(path), Vector3.getCPtr(forward), AlphaFunction.getCPtr(alpha), TimePeriod.getCPtr(period));
1265 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1268 internal void Show(View view, float delaySeconds)
1270 Interop.Animation.Animation_Show(swigCPtr, View.getCPtr(view), delaySeconds);
1271 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1274 internal void Hide(View view, float delaySeconds)
1276 Interop.Animation.Animation_Hide(swigCPtr, View.getCPtr(view), delaySeconds);
1277 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1281 /// To make animation instance be disposed.
1283 /// <since_tizen> 3 </since_tizen>
1284 protected override void Dispose(DisposeTypes type)
1291 if (_animationFinishedEventHandler != null)
1293 FinishedSignal().Disconnect(_finishedCallbackOfNative);
1294 _animationFinishedEventHandler = null;
1297 if (_animationProgressReachedEventCallback != null)
1300 ProgressReachedSignal().Disconnect(_animationProgressReachedEventCallback);
1301 _animationProgressReachedEventCallback = null;
1307 /// This will not be public opened.
1308 [EditorBrowsable(EditorBrowsableState.Never)]
1309 protected override void ReleaseSwigCPtr(System.Runtime.InteropServices.HandleRef swigCPtr)
1311 if(swigCPtr.Handle == IntPtr.Zero || this.HasBody() == false)
1313 Tizen.Log.Fatal("NUI", $"[ERROR] Animation ReleaseSwigCPtr()! IntPtr=0x{swigCPtr.Handle:X} HasBody={this.HasBody()}");
1316 Interop.Animation.delete_Animation(swigCPtr);
1319 private void OnFinished(IntPtr data)
1321 if (_animationFinishedEventHandler != null)
1323 //here we send all data to user event handlers
1324 _animationFinishedEventHandler(this, null);
1328 private void OnProgressReached(IntPtr data)
1330 if (_animationProgressReachedEventHandler != null)
1332 //here we send all data to user event handlers
1333 _animationProgressReachedEventHandler(this, null);
1337 private float MilliSecondsToSeconds(int millisec)
1339 return (float)millisec / 1000.0f;
1342 private int SecondsToMilliSeconds(float sec)
1344 return (int)(sec * 1000);
1347 private object AvoidFloatPropertyHasIntegerValue(View target, Property property, object value)
1349 PropertyType propertyType = target.GetPropertyType(property.propertyIndex);
1350 if (propertyType.Equals(PropertyType.Float))
1352 System.Type type = value.GetType();
1353 if (type.Equals(typeof(System.Int32)) || type.Equals(typeof(int)))
1355 int num = (int)value;