+++ /dev/null
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Reflection;
-using System.Text;
-using ElmSharp;
-using Tizen.Applications;
-
-namespace Xamarin.Forms.Platform.Tizen
-{
- class AdaptedFormsApplication : FormsApplication
- {
- public ApplicationLifecycle Lifecycle { get; set; }
-
- protected override void OnPause()
- {
- base.OnPause();
- Lifecycle?.SendPause();
- }
- protected override void OnPreCreate()
- {
- if (MainWindow == null)
- {
- base.OnPreCreate();
- }
- Lifecycle?.SendPreCreate();
- }
- protected override void OnResume()
- {
- base.OnResume();
- Lifecycle?.SendResume();
- }
- protected override void OnAppControlReceived(AppControlReceivedEventArgs e)
- {
- base.OnAppControlReceived(e);
- Lifecycle?.Send(e);
- }
- protected override void OnCreate()
- {
- base.OnCreate();
- Lifecycle?.SendCreate();
- }
- protected override void OnDeviceOrientationChanged(DeviceOrientationEventArgs e)
- {
- base.OnDeviceOrientationChanged(e);
- Lifecycle?.Send(e);
- }
- protected override void OnLocaleChanged(LocaleChangedEventArgs e)
- {
- base.OnLocaleChanged(e);
- Lifecycle?.Send(e);
- }
- protected override void OnLowBattery(LowBatteryEventArgs e)
- {
- base.OnLowBattery(e);
- Lifecycle?.Send(e);
- }
- protected override void OnLowMemory(LowMemoryEventArgs e)
- {
- base.OnLowMemory(e);
- Lifecycle?.Send(e);
- }
- protected override void OnRegionFormatChanged(RegionFormatChangedEventArgs e)
- {
- base.OnRegionFormatChanged(e);
- Lifecycle?.Send(e);
- }
- protected override void OnTerminate()
- {
- base.OnTerminate();
- Lifecycle?.SendTerminate();
- }
- }
-}
\ No newline at end of file
+++ /dev/null
-using Tizen.Applications;
-
-namespace Xamarin.Forms.Platform.Tizen
-{
- public abstract class ApplicationLifecycle
- {
- public FormsApplication FormsApplication { get; internal set; }
-
- internal void SendPause() => OnPause();
- internal void SendPreCreate() => OnPreCreate();
- internal void SendResume() => OnResume();
- internal void SendCreate() => OnCreate();
- internal void SendTerminate() => OnTerminate();
- internal void Send(AppControlReceivedEventArgs e) => OnAppControlReceived(e);
- internal void Send(DeviceOrientationEventArgs e) => OnDeviceOrientationChanged(e);
- internal void Send(LocaleChangedEventArgs e) => OnLocaleChanged(e);
- internal void Send(LowBatteryEventArgs e) => OnLowBattery(e);
- internal void Send(LowMemoryEventArgs e) => OnLowMemory(e);
- internal void Send(RegionFormatChangedEventArgs e) => OnRegionFormatChanged(e);
-
- protected virtual void OnPause()
- {
- }
- protected virtual void OnPreCreate()
- {
- }
- protected virtual void OnResume()
- {
- }
- protected virtual void OnAppControlReceived(AppControlReceivedEventArgs e)
- {
- }
- protected virtual void OnCreate()
- {
- }
- protected virtual void OnDeviceOrientationChanged(DeviceOrientationEventArgs e)
- {
- }
- protected virtual void OnLocaleChanged(LocaleChangedEventArgs e)
- {
- }
- protected virtual void OnLowBattery(LowBatteryEventArgs e)
- {
- }
- protected virtual void OnLowMemory(LowMemoryEventArgs e)
- {
- }
- protected virtual void OnRegionFormatChanged(RegionFormatChangedEventArgs e)
- {
- }
- protected virtual void OnTerminate()
- {
- }
- }
-}
\ No newline at end of file
public class InitializationOptions
{
- public ApplicationLifecycle LifeCycle { get; set; }
public CoreApplication Context { get; set; }
public bool UseDeviceIndependentPixel { get; set; }
public HandlerAttribute[] Handlers { get; set; }
Assemblies = assemblies;
}
- public InitializationOptions(ApplicationLifecycle lifecycle)
- {
- LifeCycle = lifecycle;
- }
-
- public InitializationOptions(ApplicationLifecycle lifecycle, bool useDeviceIndependentPixel, HandlerAttribute[] handlers)
- {
- LifeCycle = lifecycle;
- UseDeviceIndependentPixel = useDeviceIndependentPixel;
- Handlers = handlers;
- }
-
- public InitializationOptions(ApplicationLifecycle lifecycle, bool useDeviceIndependentPixel, params Assembly[] assemblies)
- {
- LifeCycle = lifecycle;
- UseDeviceIndependentPixel = useDeviceIndependentPixel;
- Assemblies = assemblies;
- }
-
public void UseStaticRegistrar(StaticRegistrarStrategy strategy, Dictionary<Type, Func<IRegisterable>> customHandlers=null, bool disableCss=false)
{
StaticRegistarStrategy = strategy;
}
}
- static void Init()
- {
- var appAdapter = new AdaptedFormsApplication();
- Init(appAdapter, false);
- IsPreloaded = true;
- }
-
public static void Init(CoreApplication application)
{
Init(application, false);
public static void Init(InitializationOptions options)
{
- if (!IsInitialized)
- {
- var appAdapter = new AdaptedFormsApplication();
- Context = appAdapter;
- }
-
- if (options.LifeCycle != null)
- {
- var appAdapter = Context as AdaptedFormsApplication;
- appAdapter.Lifecycle = options.LifeCycle;
- options.LifeCycle.FormsApplication = appAdapter;
- }
SetupInit(Context, options);
}
[EditorBrowsable(EditorBrowsableState.Never)]
public static EvasObject Preload()
{
- Forms.Init();
+ var dummyApp = new DummyFormsApplication();
+ Init(dummyApp, false);
+ IsPreloaded = true;
EWindow eWindow = null;
ELayout eLayout = null;
return base.VisitMember(node);
}
}
+
+ class DummyFormsApplication : FormsApplication { }
}
\ No newline at end of file