* limitations under the License.
*/
+using System;
using Tizen.NUI;
using Tizen.NUI.BaseComponents;
using Tizen.NUI.Components;
{
if (layer != null)
{
+ view.BackKeyPressed -= OnBackKeyPressed;
Window.Instance.RemoveLayer(layer);
layer.Dispose();
layer = null;
layer.Add(CreateGray());
layer.Add(view);
view.TouchEvent += (s, e) => false; // prevent gray view reacting
+ view.BackKeyPressed += OnBackKeyPressed;
Window.Instance.AddLayer(layer);
}
+ private void OnBackKeyPressed(object sender, EventArgs args)
+ {
+ Dismiss();
+ }
+
private Control CreateGray()
{
var gray = new Tizen.NUI.Components.Control()
current = steps.First;
current.Value.Value.Initialize();
ui.Push(current.Value.Value.CreateView(new NavigationController(this, current.Value.Value)));
+ ui.BackKeyPressed += (obj, args) =>
+ {
+ Previous();
+ };
current.Next?.Value.Value.Initialize();
+ Window.Instance.Add(ui);
started = true;
}
/// <summary>
/// Implementation of OOBE GUI Guideline for IoT Headed
/// </summary>
- public class MainView : IDisposable
+ public class MainView : View
{
private const int TransitionTime = 750;
private readonly Extents stackMargin = new Extents(48, 48, 48, 48);
private Pagination pagination;
public MainView(Window win)
+ : base()
{
- View backImage = new View
- {
- BackgroundImage = NUIApplication.Current.DirectoryInfo.Resource + "0_BG_dark.png",
- PositionUsesPivotPoint = true,
- PivotPoint = new Position(0.5f, 0.5f),
- ParentOrigin = new Position(0.5f, 0.5f),
- };
+ BackgroundImage = NUIApplication.Current.DirectoryInfo.Resource + "0_BG_dark.png";
Size2D stackSize = new Size2D(
win.WindowSize.Width - stackMargin.Start - stackMargin.End,
};
pagination.IndicatorSpacing = 12;
- win.GetDefaultLayer().Add(backImage);
- win.GetDefaultLayer().Add(stack);
- win.GetDefaultLayer().Add(pagination);
+ Add(stack);
+ Add(pagination);
}
public int PagesCount
stack.Pop();
}
- public void Dispose()
+ protected override void Dispose(DisposeTypes type)
{
- stack.Dispose();
- pagination.Dispose();
+ if (disposed)
+ {
+ return;
+ }
+
+ if (type == DisposeTypes.Explicit)
+ {
+ stack.Dispose();
+ pagination.Dispose();
+ }
+
+ base.Dispose(type);
}
}
}