Exemple #1
0
        public Platform()
        {
            _renderer = new PlatformRenderer(this);

            _renderer.Style.PropertyChanged += HandleRendererStyle_PropertyChanged;

            MessagingCenter.Subscribe(this, Page.AlertSignalName, (Page sender, AlertArguments arguments) => {
                var alert      = new DisplayAlert(arguments);
                alert.Clicked += CloseAlert;

                _renderer.AppendChild(alert.Element);

                void CloseAlert(object s, EventArgs e)
                {
                    _renderer.RemoveChild(alert.Element);
                }
            });

            MessagingCenter.Subscribe(this, Page.ActionSheetSignalName, (Page sender, ActionSheetArguments arguments) =>
            {
                var sheet      = new ActionSheet(arguments);
                sheet.Clicked += CloseSheet;

                _renderer.AppendChild(sheet.Element);

                void CloseSheet(object s, EventArgs e)
                {
                    _renderer.RemoveChild(sheet.Element);
                }
            });
        }
Exemple #2
0
        public Platform()
        {
            _renderer = new PlatformRenderer(this);

            MessagingCenter.Subscribe(this, Page.AlertSignalName, (Page sender, AlertArguments arguments) =>
            {
                var alert      = new DisplayAlert(arguments);
                alert.Clicked += CloseAlert;

                _renderer.AppendChild(alert.Element);

                void CloseAlert(object s, EventArgs e)
                {
                    _renderer.RemoveChild(alert.Element);
                }
            });
        }
Exemple #3
0
        void AddChild(VisualElement view)
        {
            if (!Application.IsApplicationOrNull(view.RealParent))
            {
                System.Diagnostics.Debug.WriteLine("Tried to add parented view to canvas directly");
            }

            if (GetRenderer(view) == null)
            {
                var viewRenderer = CreateRenderer(view);
                SetRenderer(view, viewRenderer);

                _renderer.AppendChild(viewRenderer.NativeView);
                viewRenderer.SetElementSize(new Size(640, 480));
            }
            else
            {
                System.Diagnostics.Debug.WriteLine("Potential view double add");
            }
        }