void InitializeWindow()
        {
            Debug.Assert(MainWindow != null, "Window cannot be null");

            MainWindow.Active();
            MainWindow.Show();

            // in case of no use of preloaded window
            if (BaseLayout == null)
            {
                var conformant = new Conformant(MainWindow);
                conformant.Show();

                var layout = new ApplicationLayout(conformant);

                layout.Show();

                BaseLayout = layout;

                if (Device.Idiom == TargetIdiom.Watch)
                {
                    BaseCircleSurface   = new CircleSurface(conformant);
                    Forms.CircleSurface = BaseCircleSurface;
                }
                conformant.SetContent(BaseLayout);
            }

            MainWindow.AvailableRotations = DisplayRotation.Degree_0 | DisplayRotation.Degree_90 | DisplayRotation.Degree_180 | DisplayRotation.Degree_270;

            MainWindow.Deleted += (s, e) =>
            {
                Exit();
            };

            Device.Info.CurrentOrientation = MainWindow.GetDeviceOrientation();

            MainWindow.RotationChanged += (sender, e) =>
            {
                Device.Info.CurrentOrientation = MainWindow.GetDeviceOrientation();
            };

            MainWindow.BackButtonPressed += (sender, e) =>
            {
                if (_platform != null)
                {
                    if (!_platform.SendBackButtonPressed())
                    {
                        Exit();
                    }
                }
            };

            _platform = Platform.CreatePlatform(BaseLayout);
            BaseLayout.SetContent(_platform.GetRootNativeView());
            _platform.RootNativeViewChanged += (s, e) => BaseLayout.SetContent(e.RootNativeView);
        }
Esempio n. 2
0
        protected void Initialize()
        {
            var conformant = new Conformant(this);

            conformant.Show();

            var layout = new ApplicationLayout(conformant);

            layout.Show();

            BaseLayout = layout;
            conformant.SetContent(BaseLayout);
        }
Esempio n. 3
0
        public static void Initialize(this Window platformWindow)
        {
            var baseLayout = (ELayout?)platformWindow.GetType().GetProperty("BaseLayout")?.GetValue(platformWindow);

            if (baseLayout == null)
            {
                var conformant = new Conformant(platformWindow);
                conformant.Show();

                var layout = new ApplicationLayout(conformant);
                layout.Show();

                baseLayout = layout;
                conformant.SetContent(baseLayout);
            }
            platformWindow.SetBaseLayout(baseLayout);
            var modalStack = new ModalStack(baseLayout)
            {
                AlignmentX = -1,
                AlignmentY = -1,
                WeightX    = 1,
                WeightY    = 1,
            };

            modalStack.Show();
            baseLayout.SetContent(modalStack);
            platformWindow.SetModalStack(modalStack);

            platformWindow.Active();
            platformWindow.Show();
            platformWindow.AvailableRotations = DisplayRotation.Degree_0 | DisplayRotation.Degree_90 | DisplayRotation.Degree_180 | DisplayRotation.Degree_270;

            platformWindow.RotationChanged += (sender, e) =>
            {
                // TODO : should update later
            };

            platformWindow.BackButtonPressed += (s, e) => OnBackButtonPressed(platformWindow);
        }