summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.Platform.Tizen/FormsApplication.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Xamarin.Forms.Platform.Tizen/FormsApplication.cs')
-rw-r--r--[-rwxr-xr-x]Xamarin.Forms.Platform.Tizen/FormsApplication.cs54
1 files changed, 34 insertions, 20 deletions
diff --git a/Xamarin.Forms.Platform.Tizen/FormsApplication.cs b/Xamarin.Forms.Platform.Tizen/FormsApplication.cs
index b725443f..ba01268d 100755..100644
--- a/Xamarin.Forms.Platform.Tizen/FormsApplication.cs
+++ b/Xamarin.Forms.Platform.Tizen/FormsApplication.cs
@@ -7,6 +7,7 @@ using Tizen.Applications;
using Xamarin.Forms.Internals;
using EButton = ElmSharp.Button;
using EColor = ElmSharp.Color;
+using ELayout = ElmSharp.Layout;
using EProgressBar = ElmSharp.ProgressBar;
namespace Xamarin.Forms.Platform.Tizen
@@ -19,7 +20,7 @@ namespace Xamarin.Forms.Platform.Tizen
bool _isInitialStart;
int _pageBusyCount;
Native.Dialog _pageBusyDialog;
- Native.Window _window;
+ Window _window;
protected FormsApplication()
{
@@ -31,24 +32,29 @@ namespace Xamarin.Forms.Platform.Tizen
/// Gets the main window or <c>null</c> if it's not set.
/// </summary>
/// <value>The main window or <c>null</c>.</value>
- public Native.Window MainWindow
+ public Window MainWindow
{
get
{
return _window;
}
-
protected set
{
_window = value;
+ InitializeWindow();
}
}
+ public ELayout BaseLayout
+ {
+ get; protected set;
+ }
+
protected override void OnPreCreate()
{
base.OnPreCreate();
Application.ClearCurrent();
- CreateWindow();
+ MainWindow = new Window("FormsWindow");
}
protected override void OnTerminate()
@@ -283,43 +289,51 @@ namespace Xamarin.Forms.Platform.Tizen
_platform.SetPage(page);
}
- void CreateWindow()
+ void InitializeWindow()
{
- Debug.Assert(null == MainWindow);
+ Debug.Assert(MainWindow != null, "Window cannot be null");
+
+ MainWindow.Active();
+ MainWindow.Show();
+ var conformant = new Conformant(MainWindow);
+ conformant.Show();
+
+ // Create the base (default) layout for the application
+ var layout = new ELayout(conformant);
+ layout.SetTheme("layout", "application", "default");
+ layout.Show();
- var window = new Native.Window();
- window.Closed += (s, e) =>
+ conformant.SetContent(layout);
+ BaseLayout = layout;
+ MainWindow.AvailableRotations = DisplayRotation.Degree_0 | DisplayRotation.Degree_90 | DisplayRotation.Degree_180 | DisplayRotation.Degree_270;
+
+ MainWindow.Deleted += (s, e) =>
{
Exit();
};
- window.RotationChanged += (sender, e) =>
+ MainWindow.RotationChanged += (sender, e) =>
{
- switch (_window.CurrentOrientation)
+ switch (MainWindow.Rotation)
{
- case Native.DisplayOrientations.None:
- Device.Info.CurrentOrientation = Internals.DeviceOrientation.Other;
- break;
-
- case Native.DisplayOrientations.Portrait:
+ case 0:
Device.Info.CurrentOrientation = Internals.DeviceOrientation.PortraitUp;
break;
- case Native.DisplayOrientations.Landscape:
+ case 90:
Device.Info.CurrentOrientation = Internals.DeviceOrientation.LandscapeLeft;
break;
- case Native.DisplayOrientations.PortraitFlipped:
+ case 180:
Device.Info.CurrentOrientation = Internals.DeviceOrientation.PortraitDown;
break;
- case Native.DisplayOrientations.LandscapeFlipped:
+ case 270:
Device.Info.CurrentOrientation = Internals.DeviceOrientation.LandscapeRight;
break;
}
};
-
- MainWindow = window;
}
+
public void Run()
{
Run(System.Environment.GetCommandLineArgs());