From: 유리나/Common Platform Lab(SR)/Staff Engineer/삼성전자 Date: Mon, 20 Apr 2020 03:05:49 +0000 (+0900) Subject: Remove the ApplicationLifecycle (#204) X-Git-Tag: submit/tizen_5.5/20200420.234045~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=05330bb71ed7828bced7c52e17cda1e86d5a95d7;p=platform%2Fcore%2Fcsapi%2Fxsf.git Remove the ApplicationLifecycle (#204) --- diff --git a/src/XSF/Xamarin.Forms.Platform.Tizen/AdaptedFormsApplication.cs b/src/XSF/Xamarin.Forms.Platform.Tizen/AdaptedFormsApplication.cs deleted file mode 100644 index 038cd923..00000000 --- a/src/XSF/Xamarin.Forms.Platform.Tizen/AdaptedFormsApplication.cs +++ /dev/null @@ -1,74 +0,0 @@ -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 diff --git a/src/XSF/Xamarin.Forms.Platform.Tizen/ApplicationLifecycle.cs b/src/XSF/Xamarin.Forms.Platform.Tizen/ApplicationLifecycle.cs deleted file mode 100644 index 91669a9c..00000000 --- a/src/XSF/Xamarin.Forms.Platform.Tizen/ApplicationLifecycle.cs +++ /dev/null @@ -1,55 +0,0 @@ -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 diff --git a/src/XSF/Xamarin.Forms.Platform.Tizen/Forms.cs b/src/XSF/Xamarin.Forms.Platform.Tizen/Forms.cs index 1ec5da0f..73951ae7 100644 --- a/src/XSF/Xamarin.Forms.Platform.Tizen/Forms.cs +++ b/src/XSF/Xamarin.Forms.Platform.Tizen/Forms.cs @@ -34,7 +34,6 @@ namespace Xamarin.Forms public class InitializationOptions { - public ApplicationLifecycle LifeCycle { get; set; } public CoreApplication Context { get; set; } public bool UseDeviceIndependentPixel { get; set; } public HandlerAttribute[] Handlers { get; set; } @@ -75,25 +74,6 @@ namespace Xamarin.Forms 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> customHandlers=null, bool disableCss=false) { StaticRegistarStrategy = strategy; @@ -382,13 +362,6 @@ namespace Xamarin.Forms } } - static void Init() - { - var appAdapter = new AdaptedFormsApplication(); - Init(appAdapter, false); - IsPreloaded = true; - } - public static void Init(CoreApplication application) { Init(application, false); @@ -402,18 +375,6 @@ namespace Xamarin.Forms 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); } @@ -693,7 +654,9 @@ namespace Xamarin.Forms [EditorBrowsable(EditorBrowsableState.Never)] public static EvasObject Preload() { - Forms.Init(); + var dummyApp = new DummyFormsApplication(); + Init(dummyApp, false); + IsPreloaded = true; EWindow eWindow = null; ELayout eLayout = null; @@ -813,4 +776,6 @@ namespace Xamarin.Forms return base.VisitMember(node); } } + + class DummyFormsApplication : FormsApplication { } } \ No newline at end of file