namespace Tizen.NUI
{
+ /// <summary>
+ /// Default FrameBroker of NUI Application.
+ /// </summary>
internal class DefaultFrameBroker : FrameBrokerBase
{
+ private const int DefaultTransitionDuration = 500;
+
private Window window;
private ImageView providerImage;
private bool isAnimating;
-
- public delegate void AnimationEventHandler(bool direction);
- internal event AnimationEventHandler AnimationInitialized;
- internal event AnimationEventHandler AnimationFinished;
-
- internal View mainView;
private bool direction;
+ private AnimationType animationType;
- internal Animation animation;
+ private TransitionSet transitionSet;
+ private Transition defaultTransition = new Transition()
+ {
+ TimePeriod = new TimePeriod(DefaultTransitionDuration),
+ AlphaFunction = new AlphaFunction(AlphaFunction.BuiltinFunctions.Default),
+ };
internal DefaultFrameBroker(Window window) : base(window)
{
isAnimating = false;
}
- protected override void OnFrameResumed(FrameData frame)
- {
- base.OnFrameResumed(frame);
+ /// <summary>
+ /// AnimationEvent Handler for broker animation
+ /// </summary>
+ internal delegate void AnimationEventHandler(bool direction);
- direction = frame.DirectionForward;
+ /// <summary>
+ /// Emits the event when the animation is started.
+ /// </summary>
+ internal event AnimationEventHandler AnimationInitialized;
- if (isAnimating)
- {
- return;
- }
- isAnimating = true;
+ /// <summary>
+ /// Emits the event when the animation is finished.
+ /// </summary>
+ internal event AnimationEventHandler AnimationFinished;
+
+ /// <summary>
+ /// Transition properties for the transition of Window during this application call new application.
+ /// </summary>
+ internal TransitionBase AppearingTransition { get; set; }
- AnimationInitialized?.Invoke(frame.DirectionForward);
+ /// <summary>
+ /// Transition properties for the transition of Window during new application is exited.
+ /// </summary>
+ internal TransitionBase DisappearingTransition { get; set; }
- if (frame.DirectionForward)
+ private void SetAnimationType()
+ {
+ if (ApplicationTransitionManager.Instance.SourceView != null)
{
- PlayAnimateTo(frame, ForwardAnimation);
+ animationType = direction ? AnimationType.SeamlessAnimationAppearing : AnimationType.SeamlessAnimationDisappearing;
+ }
+ else if (AppearingTransition != null || DisappearingTransition != null)
+ {
+ animationType = direction ? AnimationType.TransitionBaseAppearing : AnimationType.TransitionBaseDisappearing;
}
else
{
- PlayAnimateTo(frame, BackwardAnimation);
+ animationType = AnimationType.None;
}
-
- StartAnimation();
}
- protected override void OnFramePaused()
+ private void CreateProviderImage(FrameData frame)
{
- base.OnFramePaused();
- animation?.Stop();
+ providerImage = new ImageView();
+ providerImage.Size = new Size(window.WindowSize);
+ providerImage.ParentOrigin = ParentOrigin.Center;
+ providerImage.PivotPoint = PivotPoint.Center;
+ providerImage.PositionUsesPivotPoint = true;
+ providerImage.AddRenderer(GetRenderer(frame));
+ }
- ResetImage();
+ private void PlayTransitionAnimation()
+ {
+ transitionSet = CreateTransitionSet();
- isAnimating = false;
+ window.Add(providerImage);
+ transitionSet.Play();
+ // Notifies that the animation is started to provider.
+ StartAnimation();
}
- private void PlayAnimateTo(FrameData frame, TransitionAnimation transition)
+ private TransitionSet CreateTransitionSet()
{
- if (transition != null)
+ TransitionSet transitionSet = new TransitionSet();
+
+ if (animationType != AnimationType.None)
{
- //ResetImage();
- if (!providerImage)
- {
- providerImage = new ImageView(transition.DefaultImageStyle);
- providerImage.ParentOrigin = transition.DefaultImageStyle.ParentOrigin;
- providerImage.PivotPoint = transition.DefaultImageStyle.PivotPoint;
- providerImage.PositionUsesPivotPoint = true;
- providerImage.AddRenderer(GetRenderer(frame));
- if (mainView != null)
- {
- mainView.Add(providerImage);
- providerImage.LowerToBottom();
- }
- else
- {
- window.Add(providerImage);
- }
- }
- else
+ TransitionItemBase transitionItem = null;
+ switch (animationType)
{
- providerImage.ApplyStyle(transition.DefaultImageStyle.Clone());
+ case AnimationType.SeamlessAnimationAppearing:
+ transitionItem = defaultTransition.CreateTransition(ApplicationTransitionManager.Instance.SourceView, providerImage, true);
+ break;
+ case AnimationType.SeamlessAnimationDisappearing:
+ transitionItem = defaultTransition.CreateTransition(providerImage, ApplicationTransitionManager.Instance.SourceView, false);
+ break;
+ case AnimationType.TransitionBaseAppearing:
+ transitionItem = AppearingTransition.CreateTransition(providerImage, true);
+ break;
+ case AnimationType.TransitionBaseDisappearing:
+ transitionItem = DisappearingTransition.CreateTransition(providerImage, false);
+ break;
}
-
- providerImage.Show();
- int propertyCount = transition.AnimationDataList.Count;
- animation = new Animation(transition.DurationMilliSeconds + 80);
-
- for (int i = 0; i < propertyCount; i++)
+ if (transitionItem != null)
{
- animation.PropertyList.Add(transition.AnimationDataList[i].Property);
- animation.DestValueList.Add(transition.AnimationDataList[i].DestinationValue);
- animation.StartTimeList.Add(80 + transition.AnimationDataList[i].StartTime);
- animation.EndTimeList.Add(80 + transition.AnimationDataList[i].EndTime);
+ transitionSet.AddTransition(transitionItem);
+ transitionSet.Finished += TransitionSetFinished;
+ transitionItem.Dispose();
+ transitionItem = null;
}
- animation.PlayAnimateTo(providerImage);
- animation.Finished += Ani_Finished;
- }
- else
- {
- FinishAnimation();
}
+ return transitionSet;
}
-
- private TransitionAnimation forwardAnimation;
- internal TransitionAnimation ForwardAnimation
+ private void TransitionSetFinished(object sender, EventArgs e)
{
- get
- {
- return forwardAnimation;
- }
- set
- {
- forwardAnimation = value;
- }
+ (sender as TransitionSet).Finished -= TransitionSetFinished;
+ providerImage.Unparent();
+ providerImage.Dispose();
+ providerImage = null;
+
+ FinishAnimation();
+ AnimationFinished?.Invoke(direction);
+ isAnimating = false;
}
- private TransitionAnimation backwardAnimation;
- internal TransitionAnimation BackwardAnimation
+ /// <summary>
+ /// Occurs Whenever the frame is resumed.
+ /// </summary>
+ /// <param name="frame">The frame data.</param>
+ /// <remarks>
+ /// When the frame has been prepared, this function is called.
+ /// The caller can start animations, To notify that the animation is started, the caller should call StartAnimation().
+ /// After the animation is finished, the caller should call FinishAnimation() to notify.
+ /// </remarks>
+ protected override void OnFrameResumed(FrameData frame)
{
- get
- {
- return backwardAnimation;
- }
- set
+ Log.Info("NUI", "OnFrameResumed : " + frame.DirectionForward);
+ direction = frame.DirectionForward;
+
+ if (isAnimating)
{
- backwardAnimation = value;
+ Log.Warn("NUI", "The OnFrameResumed() : Playing...");
+ return;
}
- }
-
- private void Ani_Finished(object sender, EventArgs e)
- {
- FinishAnimation();
+ Log.Info("NUI", "The OnFrameResumed() : Play Application Transition Animation");
+ isAnimating = true;
+ AnimationInitialized?.Invoke(direction);
- AnimationFinished?.Invoke(direction);
+ SetAnimationType();
+ CreateProviderImage(frame);
+ PlayTransitionAnimation();
}
- private void ResetImage()
+ private enum AnimationType
{
- if (providerImage != null)
- {
- providerImage.Hide();
- //providerImage.Unparent();
- //providerImage.Dispose();
- //providerImage = null;
- }
+ None = 0,
+ SeamlessAnimationAppearing = 1,
+ SeamlessAnimationDisappearing = 2,
+ TransitionBaseAppearing = 3,
+ TransitionBaseDisappearing = 4,
}
}
}
/// To launch a service application, an explicit launch request with the application ID given by property ApplicationId MUST be sent.
/// </remarks>
/// <param name="appControl">The AppControl.</param>
- /// <param name="toProvider"> The flag, if it's true, the launch request is sent to the frame provider application.</param>
/// <returns>A task with the result of the launch request.</returns>
/// <exception cref="ArgumentException">Thrown when failed because of the argument is invalid.</exception>
/// <exception cref="AppNotFoundException">Thrown when the application to run is not found.</exception>
/// <exception cref="LaunchRejectedException">Thrown when the launch request is rejected.</exception>
/// <privilege>http://tizen.org/privilege/appmanager.launch</privilege>
- internal Task<FrameBrokerBaseResult> SendLaunchRequest(AppControl appControl, bool toProvider)
+ internal Task<FrameBrokerBaseResult> SendLaunchRequest(AppControl appControl)
{
if (appControl == null)
{
}
Interop.FrameBroker.ErrorCode err;
- if (toProvider)
- err = Interop.FrameBroker.SendLaunchRequestToProvider(handle, appControl.SafeAppControlHandle, resultCallbackMaps[requestId], null, (IntPtr)requestId);
- else
- err = Interop.FrameBroker.SendLaunchRequest(handle, appControl.SafeAppControlHandle, resultCallbackMaps[requestId], null, (IntPtr)requestId);
+ err = Interop.FrameBroker.SendLaunchRequest(handle, appControl.SafeAppControlHandle, resultCallbackMaps[requestId], null, (IntPtr)requestId);
if (err != Interop.FrameBroker.ErrorCode.None)
{
/* Create Property buffer */
PropertyValue value = new PropertyValue((int)PropertyType.Vector2);
PropertyMap vertexFormat = new PropertyMap();
- PropertyBuffer vertexBuffer = new PropertyBuffer(vertexFormat);
-
vertexFormat.Add("aPosition", value);
+
+ PropertyBuffer vertexBuffer = new PropertyBuffer(vertexFormat);
vertexBuffer.SetData(RectangleDataPtr(), 4);
Geometry geometry = new Geometry();
+++ /dev/null
-/*
- * Copyright(c) 2021 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-using System;
-using System.Collections.Generic;
-using System.ComponentModel;
-using Tizen.NUI.BaseComponents;
-
-namespace Tizen.NUI
-{
- /// <summary>
- /// Data of animation data for transition
- /// </summary>
- [EditorBrowsable(EditorBrowsableState.Never)]
- public class TransitionAnimationData
- {
- /// <summary>
- /// start time of animation
- /// </summary>
- [EditorBrowsable(EditorBrowsableState.Never)]
- public int StartTime { get; set; }
-
- /// <summary>
- /// end time of animation
- /// </summary>
- [EditorBrowsable(EditorBrowsableState.Never)]
- public int EndTime { get; set; }
-
- /// <summary>
- /// property of animation
- /// </summary>
- [EditorBrowsable(EditorBrowsableState.Never)]
- public string Property { get; set; }
-
- /// <summary>
- /// destination value of animation
- /// </summary>
- [EditorBrowsable(EditorBrowsableState.Never)]
- public string DestinationValue { get; set; }
- }
-
- /// <summary>
- /// Transition animation effect.
- /// This is normally used to specify transitions for a NUIApplication.
- /// </summary>
- /// <seealso cref="TransitionOptions.ForwardAnimation" />
- /// <seealso cref="TransitionOptions.BackwardAnimation" />
- /// <seealso cref="NUIApplication.TransitionOptions" />
- [EditorBrowsable(EditorBrowsableState.Never)]
- public class TransitionAnimation : IDisposable
- {
- private bool disposed = false;
- private ImageViewStyle defaultImageStyle;
- private List<TransitionAnimationData> animationDataList;
-
-
- /// <summary>
- /// Create an instance of Transition.
- /// </summary>
- [EditorBrowsable(EditorBrowsableState.Never)]
- public TransitionAnimation(int durationMilliSeconds)
- {
- DurationMilliSeconds = durationMilliSeconds;
- if (animationDataList == null)
- {
- animationDataList = new List<TransitionAnimationData>();
- }
- }
-
- /// <summary>
- /// total time of animation.
- /// </summary>
- [EditorBrowsable(EditorBrowsableState.Never)]
- public int DurationMilliSeconds { get; set; }
-
- /// <summary>
- /// Default style of animate image view.
- /// </summary>
- [EditorBrowsable(EditorBrowsableState.Never)]
- public List<TransitionAnimationData> AnimationDataList
- {
- get
- {
- return animationDataList;
- }
- }
-
-
- /// <summary>
- /// Add data of transition animation
- /// </summary>
- [EditorBrowsable(EditorBrowsableState.Never)]
- public void AddAnimationData(TransitionAnimationData data)
- {
- if (data == null)
- {
- throw new ArgumentNullException(nameof(data));
- }
-
- animationDataList?.Add(data);
- }
-
- /// <summary>
- /// Remove data of transition animation
- /// </summary>
- [EditorBrowsable(EditorBrowsableState.Never)]
- public void RemoveAnimationData(TransitionAnimationData data)
- {
- animationDataList?.Remove(data);
- }
-
- /// <summary>
- /// Clear data list of transition animation
- /// </summary>
- [EditorBrowsable(EditorBrowsableState.Never)]
- public void ClearAnimationData()
- {
- animationDataList?.Clear();
- }
-
- /// <summary>
- /// Setting default style of ImageView
- /// </summary>
- [EditorBrowsable(EditorBrowsableState.Never)]
- public ImageViewStyle DefaultImageStyle
- {
- get
- {
- if (defaultImageStyle == null)
- {
- defaultImageStyle = new ImageViewStyle();
- defaultImageStyle.Size = new Size(0, 0);
- defaultImageStyle.Position = new Position(0, 0);
- defaultImageStyle.ParentOrigin = ParentOrigin.Center;
- defaultImageStyle.PivotPoint = PivotPoint.Center;
- defaultImageStyle.PositionUsesPivotPoint = true;
- }
- return defaultImageStyle;
- }
- set
- {
- defaultImageStyle = value;
- }
- }
-
-
- [EditorBrowsable(EditorBrowsableState.Never)]
- protected virtual void Dispose(bool disposing)
- {
- if (disposed)
- {
- return;
- }
- if (disposing)
- {
- defaultImageStyle?.Dispose();
- }
- disposed = true;
- }
-
- [EditorBrowsable(EditorBrowsableState.Never)]
- public void Dispose()
- {
- Dispose(true);
- global::System.GC.SuppressFinalize(this);
- }
- }
-
- /// <summary>
- /// Screen slides are transitions between one entire screen to another
- /// </summary>
- [EditorBrowsable(EditorBrowsableState.Never)]
- public class SlideIn : TransitionAnimation
- {
- private int defaultInitValue = 0;
-
- /// <summary>
- /// Create an instance of SlideIn.
- /// </summary>
- [EditorBrowsable(EditorBrowsableState.Never)]
- public SlideIn(int durationMilliSeconds) : base(durationMilliSeconds)
- {
- defaultInitValue = -Window.Instance.GetWindowSize().Width;
-
- DefaultImageStyle.Position = new Position(defaultInitValue, 0);
- DefaultImageStyle.Size = Window.Instance.GetWindowSize();
-
- TransitionAnimationData data = new TransitionAnimationData();
- data.StartTime = 0;
- data.EndTime = durationMilliSeconds;
- data.Property = "PositionX";
- data.DestinationValue = "0";
- AddAnimationData(data);
- }
- }
-
-
- /// <summary>
- /// Screen slides are transitions between one entire screen to another
- /// </summary>
- [EditorBrowsable(EditorBrowsableState.Never)]
- public class SlideOut : TransitionAnimation
- {
- private int defaultInitValue = 0;
-
- /// <summary>
- /// Create an instance of SlideOut.
- /// </summary>
- [EditorBrowsable(EditorBrowsableState.Never)]
- public SlideOut(int durationMilliSeconds) : base(durationMilliSeconds)
- {
- defaultInitValue = 0;
-
- DefaultImageStyle.Position = new Position(defaultInitValue, 0);
- DefaultImageStyle.Size = Window.Instance.GetWindowSize();
-
- TransitionAnimationData data = new TransitionAnimationData();
- data.StartTime = 0;
- data.EndTime = durationMilliSeconds;
- data.Property = "PositionX";
- data.DestinationValue = Window.Instance.GetWindowSize().Width.ToString();
- AddAnimationData(data);
- }
- }
-}
public class TransitionOptions : IDisposable
{
private bool disposed = false;
- private FrameProvider frameProvider;
- private DefaultFrameBroker frameBroker;
- private bool enableTransition = false;
- private Window mainWindow;
- private View animatedTarget;
-
- /// <summary>
- /// Initializes the TransitionOptions class.
- /// </summary>
- /// <param name="window">The window instance of NUI Window</param>
- [EditorBrowsable(EditorBrowsableState.Never)]
- public TransitionOptions(Window window)
- {
- mainWindow = window;
- }
/// <summary>
/// Initializes the TransitionOptions class.
}
/// <summary>
- /// Set animated view of seamless animation.
- /// </summary>
- [EditorBrowsable(EditorBrowsableState.Never)]
- public View AnimatedTarget
- {
- get
- {
- return animatedTarget;
- }
- set
- {
- animatedTarget = value;
- }
- }
-
- /// <summary>
- /// Gets or sets transition enable
- /// </summary>
- [EditorBrowsable(EditorBrowsableState.Never)]
- public bool EnableTransition
- {
- get
- {
- return enableTransition;
- }
-
- set
- {
- if (value)
- {
- frameBroker = new DefaultFrameBroker(mainWindow);
- frameBroker.mainView = animatedTarget;
- frameBroker.AnimationInitialized += FrameBroker_TransitionAnimationInitialized;
- frameBroker.AnimationFinished += FrameBroker_TransitionAnimationFinished;
- EnableProvider();
- }
- enableTransition = value;
- }
- }
-
- private void EnableProvider()
- {
- frameProvider = new FrameProvider(mainWindow);
- frameProvider.Shown += FrameProvider_Shown;
- frameProvider.Hidden += FrameProvider_Hidden;
- }
-
- /// <summary>
/// String tag to find View pair to be used in Page transition.
/// If there is a View have same TransitionTag in a next or previous Page.
/// The View will be pair for transition.
public bool TransitionWithChild { set; get; } = false;
/// <summary>
- /// Gets or sets the forward animation of launching
- /// </summary>
- [EditorBrowsable(EditorBrowsableState.Never)]
- public TransitionAnimation ForwardAnimation
- {
- get
- {
- return frameBroker?.ForwardAnimation;
- }
- set
- {
- if (frameBroker != null)
- {
- frameBroker.ForwardAnimation = value;
- }
- }
- }
-
- /// <summary>
- /// Gets or sets the backward animation of launching
- /// </summary>
- [EditorBrowsable(EditorBrowsableState.Never)]
- public TransitionAnimation BackwardAnimation
-
- {
- get
- {
- return frameBroker?.BackwardAnimation;
- }
- set
- {
- if (frameBroker != null)
- {
- frameBroker.BackwardAnimation = value;
- }
- }
- }
-
- /// <summary>
- /// Emits the event when the animation is started.
- /// </summary>
- [EditorBrowsable(EditorBrowsableState.Never)]
- public delegate void AnimationEventHandler(bool direction);
-
- /// <summary>
- /// Emits the event when the animation is started.
- /// </summary>
- [EditorBrowsable(EditorBrowsableState.Never)]
- public event AnimationEventHandler AnimationInitialized;
-
- /// <summary>
- /// Emits the event when the animation is finished.
- /// </summary>
- [EditorBrowsable(EditorBrowsableState.Never)]
- public event AnimationEventHandler AnimationFinished;
-
- private void FrameBroker_TransitionAnimationFinished(bool direction)
- {
- AnimationFinished?.Invoke(direction);
- }
-
- private void FrameBroker_TransitionAnimationInitialized(bool direction)
- {
- AnimationInitialized?.Invoke(direction);
- }
-
- /// <summary>
- /// Occurs whenever the window is shown on caller application.
- /// </summary>
- [EditorBrowsable(EditorBrowsableState.Never)]
- public event EventHandler CallerScreenShown;
-
- /// <summary>
- /// Occurs whenever the window is hidden on caller application.
- /// </summary>
- [EditorBrowsable(EditorBrowsableState.Never)]
- public event EventHandler CallerScreenHidden;
-
- private void FrameProvider_Shown(object sender, EventArgs e)
- {
- Bundle bundle = new Bundle();
- //Set information of shared object
- frameProvider?.NotifyShowStatus(bundle);
-
- CallerScreenShown?.Invoke(this, e);
- bundle.Dispose();
- bundle = null;
- }
-
- private void FrameProvider_Hidden(object sender, EventArgs e)
- {
- Bundle bundle = new Bundle();
- //Set information of shared object
- frameProvider?.NotifyHideStatus(bundle);
-
- CallerScreenHidden?.Invoke(this, e);
- bundle.Dispose();
- bundle = null;
- }
-
- internal void SendLaunchRequest(AppControl appControl)
- {
- this.frameBroker.SendLaunchRequest(appControl, true);
- }
-
- /// <summary>
/// Hidden API (Inhouse API).
/// Dispose.
/// </summary>
{
if (!disposed)
{
- if (frameBroker != null)
- {
- frameBroker.Dispose();
- }
-
- if (frameProvider != null)
- {
- frameProvider.Dispose();
- }
disposed = true;
}
}
}
/// <summary>
- /// This is used to improve application launch performance.
- /// </summary>
- [EditorBrowsable(EditorBrowsableState.Never)]
- public void SendLaunchRequest(AppControl appControl)
- {
- TransitionOptions?.SendLaunchRequest(appControl);
- }
-
- /// <summary>
- /// This is used to improve application launch performance.
- /// </summary>
- [EditorBrowsable(EditorBrowsableState.Never)]
- public TransitionOptions TransitionOptions { get; set; }
-
- /// <summary>
/// Check if it is loaded as dotnet-loader-nui.
/// </summary>
static internal bool IsPreload { get; set; }
--- /dev/null
+/*
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+using System;
+using System.ComponentModel;
+using Tizen.Applications;
+using Tizen.NUI.BaseComponents;
+
+namespace Tizen.NUI
+{
+ /// <summary>
+ /// This ApplicationTransitionManager class is a class to control transition motion of application.
+ /// </summary>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public class ApplicationTransitionManager : IDisposable
+ {
+ private bool disposed = false;
+ private FrameProvider frameProvider;
+ private DefaultFrameBroker frameBroker;
+ private Window mainWindow;
+ private FrameType? frameType;
+ private View sourceView;
+
+ private static ApplicationTransitionManager instance;
+
+ /// <summary>
+ /// ApplicationTransitionManager Instance for singleton
+ /// </summary>
+ public static ApplicationTransitionManager Instance
+ {
+ get
+ {
+ if (instance == null)
+ {
+ instance = new ApplicationTransitionManager();
+ }
+ return instance;
+ }
+ }
+
+ /// <summary>
+ /// Initializes the ApplicationTransitionManager class.
+ /// </summary>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ private ApplicationTransitionManager()
+ {
+ mainWindow = Window.Instance;
+ }
+
+ /// <summary>
+ /// Gets or sets SourceView, it is a view for seamless transition of application.
+ /// If you set SourceView, SourceView is changed to a screen of the application executing.
+ /// </summary>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public View SourceView
+ {
+ get
+ {
+ return sourceView;
+ }
+ set
+ {
+ sourceView = value;
+ }
+ }
+
+ /// <summary>
+ /// Configures the transition window.
+ /// </summary>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public Window TransitionWindow
+ {
+ get
+ {
+ return mainWindow;
+ }
+ set
+ {
+ if (mainWindow == value)
+ {
+ Tizen.Log.Info("NUI", "mainWindow has already same window");
+ return;
+ }
+
+ if (value == null)
+ {
+ Tizen.Log.Info("NUI", "value is null");
+ return;
+ }
+
+ mainWindow = value;
+
+ //Reset FrmaeBroker or FrameProvider
+ if (frameBroker != null)
+ {
+ frameBroker.Dispose();
+ frameBroker = null;
+ frameBroker = new DefaultFrameBroker(mainWindow);
+ }
+
+ if (frameProvider != null)
+ {
+ frameProvider.Dispose();
+ frameProvider = null;
+ frameProvider = new FrameProvider(mainWindow);
+ }
+ }
+ }
+
+ /// <summary>
+ /// Enable FrameBroker(Caller) or FrameProvider(Callee)
+ /// </summary>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public FrameType? ApplicationFrameType
+ {
+ get
+ {
+ return frameType;
+ }
+ set
+ {
+ if (frameType != null)
+ {
+ Tizen.Log.Info("NUI", "FrameType is already set");
+ return;
+ }
+
+ if (frameType == value)
+ {
+ Tizen.Log.Info("NUI", "FameType has already same type");
+ return;
+ }
+
+ if (value == null)
+ {
+ Tizen.Log.Info("NUI", "value is null");
+ return;
+ }
+
+ frameType = value;
+ switch (frameType)
+ {
+ case FrameType.FrameBroker:
+ EnableFrameBroker();
+ break;
+
+ case FrameType.FrameProvider:
+ EnableFrameProvider();
+ break;
+ }
+ }
+ }
+
+ /// <summary>
+ /// Transition properties for the transition of Window during this application call new application.
+ /// </summary>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public TransitionBase AppearingTransition
+ {
+ get
+ {
+ return frameBroker?.AppearingTransition;
+ }
+ set
+ {
+ if (frameBroker != null)
+ {
+ frameBroker.AppearingTransition = value;
+ }
+ }
+ }
+
+ /// <summary>
+ /// Transition properties for the transition of Window during new application is exited.
+ /// </summary>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public TransitionBase DisappearingTransition
+ {
+ get
+ {
+ return frameBroker?.DisappearingTransition;
+ }
+ set
+ {
+ if (frameBroker != null)
+ {
+ frameBroker.DisappearingTransition = value;
+ }
+ }
+ }
+
+ /// <summary>
+ /// AnimationEventHandler for FrameBroker animation
+ /// </summary>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public delegate void AnimationEventHandler(bool direction);
+
+ /// <summary>
+ /// Emits the event when the animation is started.
+ /// </summary>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public event AnimationEventHandler FrameBrokerAnimationInitialized;
+
+ /// <summary>
+ /// Emits the event when the animation is finished.
+ /// </summary>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public event AnimationEventHandler FrameBrokerAnimationFinished;
+
+ /// <summary>
+ /// Occurs whenever the window is shown on caller application.
+ /// </summary>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public event EventHandler FrameProviderShown;
+
+ /// <summary>
+ /// Occurs whenever the window is hidden on caller application.
+ /// </summary>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public event EventHandler FrameProviderHidden;
+
+ private void FrameBroker_TransitionAnimationInitialized(bool direction)
+ {
+ FrameBrokerAnimationInitialized?.Invoke(direction);
+ }
+
+ private void FrameBroker_TransitionAnimationFinished(bool direction)
+ {
+ FrameBrokerAnimationFinished?.Invoke(direction);
+ }
+
+ private void FrameProvider_Shown(object sender, EventArgs e)
+ {
+ FrameProviderShown?.Invoke(this, e);
+
+ //Set information of shared object
+ Bundle bundle = new Bundle();
+ frameProvider?.NotifyShowStatus(bundle);
+
+ bundle.Dispose();
+ bundle = null;
+ }
+
+ private void FrameProvider_Hidden(object sender, EventArgs e)
+ {
+ FrameProviderHidden?.Invoke(this, e);
+
+ //Set information of shared object
+ Bundle bundle = new Bundle();
+ frameProvider?.NotifyHideStatus(bundle);
+
+ bundle.Dispose();
+ bundle = null;
+ }
+
+ private void EnableFrameBroker()
+ {
+ if (frameBroker == null)
+ {
+ frameBroker = new DefaultFrameBroker(mainWindow);
+ frameBroker.AnimationInitialized += FrameBroker_TransitionAnimationInitialized;
+ frameBroker.AnimationFinished += FrameBroker_TransitionAnimationFinished;
+ }
+ }
+
+ private void EnableFrameProvider()
+ {
+ if (frameProvider == null)
+ {
+ frameProvider = new FrameProvider(mainWindow);
+ frameProvider.Shown += FrameProvider_Shown;
+ frameProvider.Hidden += FrameProvider_Hidden;
+ }
+ }
+
+ /// <summary>
+ /// Launch an application using transition animation.
+ /// </summary>
+ /// <param name="appControl"></param>
+ /// <privilege>http://tizen.org/privilege/appmanager.launch</privilege>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public void LaunchRequestWithTransition(AppControl appControl)
+ {
+ frameBroker.SendLaunchRequest(appControl);
+ }
+
+
+ /// <summary>
+ /// Hidden API (Inhouse API).
+ /// Dispose.
+ /// </summary>
+ /// <param name="disposing"></param>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ protected virtual void Dispose(bool disposing)
+ {
+ if (!disposed)
+ {
+ if (frameBroker != null)
+ {
+ frameBroker.Dispose();
+ }
+
+ if (frameProvider != null)
+ {
+ frameProvider.Dispose();
+ }
+ disposed = true;
+ }
+ }
+
+ /// <summary>
+ /// Dispose for IDisposable pattern
+ /// </summary>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public void Dispose()
+ {
+ Dispose(true);
+ GC.SuppressFinalize(this);
+ }
+
+ }
+
+ /// <summary>
+ /// Enable FrameBroker(Caller) or FrameProvider(Callee)
+ /// </summary>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public enum FrameType
+ {
+ /// <summary>
+ /// FrameBroker type - Caller application.
+ /// </summary>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ FrameBroker,
+ /// <summary>
+ /// FrameProvider type - Callee application.
+ /// </summary>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ FrameProvider,
+ }
+}