2 * Copyright (c) 2020 Samsung Electronics Co., Ltd All Rights Reserved
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.
18 using System.Collections.Generic;
19 using System.ComponentModel;
21 using Tizen.Applications;
26 /// Setting screen transition options.
28 [EditorBrowsable(EditorBrowsableState.Never)]
29 public class TransitionOptions : IDisposable
31 private FrameProvider frameProvider;
32 private DefaultFrameBroker frameBroker;
34 private bool enableTransition = false;
35 private Window mainWindow;
36 private string sharedId;
39 /// Initializes the TransitionOptions class.
41 /// <param name="window">The window instance of NUI Window</param>
42 [EditorBrowsable(EditorBrowsableState.Never)]
43 public TransitionOptions(Window window)
49 /// Gets or sets transition enable
51 [EditorBrowsable(EditorBrowsableState.Never)]
52 public bool EnableTransition
56 return enableTransition;
63 frameBroker = new DefaultFrameBroker(mainWindow);
64 frameBroker.AnimationInitialized += FrameBroker_TransitionAnimationInitialized;
65 frameBroker.AnimationFinished += FrameBroker_TransitionAnimationFinished;
68 enableTransition = value;
72 private void EnableProvider()
74 frameProvider = new FrameProvider(mainWindow);
75 frameProvider.Shown += FrameProvider_Shown;
76 frameProvider.Hidden += FrameProvider_Hidden;
80 /// Gets or sets the Shared object Id
82 [EditorBrowsable(EditorBrowsableState.Never)]
83 public String SharedId
96 /// Gets or sets the forward animation of launching
98 [EditorBrowsable(EditorBrowsableState.Never)]
99 public TransitionAnimation ForwardAnimation
103 return frameBroker?.ForwardAnimation;
107 if (frameBroker != null)
109 frameBroker.ForwardAnimation = value;
115 /// Gets or sets the backward animation of launching
117 [EditorBrowsable(EditorBrowsableState.Never)]
118 public TransitionAnimation BackwardAnimation
123 return frameBroker?.BackwardAnimation;
127 if (frameBroker != null)
129 frameBroker.BackwardAnimation = value;
135 /// Emits the event when the animation is started.
137 [EditorBrowsable(EditorBrowsableState.Never)]
138 public event EventHandler AnimationInitialized;
141 /// Emits the event when the animation is finished.
143 [EditorBrowsable(EditorBrowsableState.Never)]
144 public event EventHandler AnimationFinished;
148 /// Dispose for IDisposable pattern
150 [EditorBrowsable(EditorBrowsableState.Never)]
151 public void Dispose()
153 if (frameBroker != null)
155 frameBroker.Dispose();
158 if (frameProvider != null)
160 frameProvider.Dispose();
164 private void FrameBroker_TransitionAnimationFinished()
166 AnimationFinished?.Invoke(this, EventArgs.Empty);
169 private void FrameBroker_TransitionAnimationInitialized()
171 AnimationInitialized?.Invoke(this, EventArgs.Empty);
175 /// Occurs whenever the window is shown on caller application.
177 [EditorBrowsable(EditorBrowsableState.Never)]
178 public event EventHandler CallerScreenShown;
181 /// Occurs whenever the window is hidden on caller application.
183 [EditorBrowsable(EditorBrowsableState.Never)]
184 public event EventHandler CallerScreenHidden;
186 private void FrameProvider_Shown(object sender, EventArgs e)
188 Bundle bundle = new Bundle();
189 //Set information of shared object
190 frameProvider?.NotifyShowStatus(bundle);
192 CallerScreenShown?.Invoke(this, e);
195 private void FrameProvider_Hidden(object sender, EventArgs e)
197 Bundle bundle = new Bundle();
198 //Set information of shared object
199 frameProvider?.NotifyHideStatus(bundle);
201 CallerScreenHidden?.Invoke(this, e);
204 internal void SendLaunchRequest(AppControl appControl)
206 this.frameBroker.SendLaunchRequest(appControl, true);