Example #1
0
        protected override void OnPreCreate()
        {
            base.OnPreCreate();
            Application.ClearCurrent();

            var type = typeof(Window);
            // Use reflection to avoid breaking compatibility. ElmSharp.Window.CreateWindow() is has been added since API6.
            var    methodInfo = type.GetMethod("CreateWindow", BindingFlags.NonPublic | BindingFlags.Static);
            Window window     = null;

            if (methodInfo != null)
            {
                window              = (Window)methodInfo.Invoke(null, new object[] { "FormsWindow" });
                BaseLayout          = (ELayout)window.GetType().GetProperty("BaseLayout")?.GetValue(window);
                BaseCircleSurface   = (CircleSurface)window.GetType().GetProperty("BaseCircleSurface")?.GetValue(window);
                Forms.CircleSurface = BaseCircleSurface;
            }
            else             // in case of Xamarin Preload
            {
                window = PreloadedWindow.GetInstance() ?? new Window("FormsWindow");
                if (window is PreloadedWindow precreated)
                {
                    BaseLayout = precreated.BaseLayout;
                }
            }
            MainWindow = window;
        }
        protected override void OnPreCreate()
        {
            base.OnPreCreate();
            Application.ClearCurrent();

            if (DotnetUtil.TizenAPIVersion < 5)
            {
                // We should set the env variable to support IsolatedStorageFile on tizen 4.0 or lower version.
                Environment.SetEnvironmentVariable("XDG_DATA_HOME", Current.DirectoryInfo.Data);
            }

            var type = typeof(Window);
            // Use reflection to avoid breaking compatibility. ElmSharp.Window.CreateWindow() is has been added since API6.
            var    methodInfo = type.GetMethod("CreateWindow", BindingFlags.NonPublic | BindingFlags.Static);
            Window window     = null;

            if (methodInfo != null)
            {
                window              = (Window)methodInfo.Invoke(null, new object[] { "FormsWindow" });
                BaseLayout          = (ELayout)window.GetType().GetProperty("BaseLayout")?.GetValue(window);
                BaseCircleSurface   = (CircleSurface)window.GetType().GetProperty("BaseCircleSurface")?.GetValue(window);
                Forms.CircleSurface = BaseCircleSurface;
            }
            else             // in case of Xamarin Preload
            {
                window = PreloadedWindow.GetInstance() ?? new Window("FormsWindow");
                if (window is PreloadedWindow precreated)
                {
                    BaseLayout = precreated.BaseLayout;
                }
            }
            MainWindow = window;
        }
 protected override void OnPreCreate()
 {
     base.OnPreCreate();
     Application.ClearCurrent();
     MainWindow = PreloadedWindow.GetInstance() ?? new Window("FormsWindow");
 }