void UpdateContent()
        {
            if (Application.Current.Platform == null)
            {
                return;
            }

            _contentView.Children.Clear();

            if (Content != null)
            {
                _contentView.Children.Add(Content);

                _contentView.Platform = Application.Current.Platform;

                var renderer = Platform.GetOrCreateRenderer(_contentView);
                (renderer as LayoutRenderer)?.RegisterOnLayoutUpdated();

                var sizeRequest = _contentView.Measure(TForms.NativeParent.Geometry.Width, TForms.NativeParent.Geometry.Height).Request.ToPixel();

                _nativeContent = renderer.NativeView;
                _nativeContent.MinimumHeight = sizeRequest.Height;

                _control.SetPartContent("default", _nativeContent, true);
            }
            else
            {
                _control.SetPartContent("default", null, true);
            }
        }
        void UpdateButton()
        {
            _bottomButton?.Hide();

            if (BottomButton != null)
            {
                _bottomButton = new ElmSharp.Button(_popUp)
                {
                    WeightX = 1.0,
                    WeightY = 1.0,
                    Style   = "bottom"
                };

                if (!string.IsNullOrEmpty(BottomButton.Text))
                {
                    _bottomButton.Text = BottomButton.Text;
                }

                if (BottomButton.Icon != null)
                {
                    var iconPath = BottomButton.Icon.File;
                    if (!string.IsNullOrEmpty(iconPath))
                    {
                        var buttonImage = new ElmSharp.Image(_bottomButton);
                        buttonImage.LoadAsync(ResourcePath.GetPath(iconPath));
                        buttonImage.Show();
                        _bottomButton.SetPartContent("elm.swallow.content", buttonImage);
                    }
                }

                _bottomButton.Clicked += (s, e) =>
                {
                    ((IMenuItemController)BottomButton).Activate();
                };

                if (_buttonBgColor != Color.Default)
                {
                    Log.Debug(FormsCircularUI.Tag, $"InformationPopup set button background color:{_buttonBgColor.ToNative()}");
                    _bottomButton.BackgroundColor = _buttonBgColor.ToNative();
                }
            }
            else
            {
                _bottomButton.Unrealize();
                _bottomButton = null;
            }

            _popUp.SetPartContent("button1", _bottomButton);
        }
Example #3
0
        void UpdateFirstButton()
        {
            _firstButton?.Hide();

            if (FirstButton != null)
            {
                _firstButton = new ElmSharp.Button(_popUp)
                {
                    WeightX = 1.0,
                    WeightY = 1.0,
                    Style   = "popup/circle/left"
                };

                if (!string.IsNullOrEmpty(FirstButton.Text))
                {
                    _firstButton.Text = FirstButton.Text;
                }

                if (!FirstButton.IconImageSource.IsNullOrEmpty())
                {
                    var iconSource = FirstButton.IconImageSource as FileImageSource;
                    if (!iconSource.IsNullOrEmpty())
                    {
                        var buttonImage = new ElmSharp.Image(_firstButton);
                        buttonImage.LoadAsync(ResourcePath.GetPath(iconSource));
                        buttonImage.Show();
                        _firstButton.SetPartContent("elm.swallow.content", buttonImage);
                    }
                }

                _firstButton.Clicked += (s, e) =>
                {
                    ((IMenuItemController)FirstButton).Activate();
                };

                if (_firstButtonBgColor != Color.Default)
                {
                    Log.Debug(FormsCircularUI.Tag, $"TwoButtonPopup set first button background color:{_firstButtonBgColor.ToNative()}");
                    _firstButton.BackgroundColor = _firstButtonBgColor.ToNative();
                }
            }
            else
            {
                _firstButton = null;
            }

            _popUp.SetPartContent("button1", _firstButton);
        }
        void UpdateFirstButton()
        {
            _firstButton?.Hide();

            if (FirstButton != null)
            {
                _firstButton = new ElmSharp.Button(_popUp)
                {
                    WeightX = 1.0,
                    WeightY = 1.0,
                    Style   = "popup/circle/left"
                };

                if (!string.IsNullOrEmpty(FirstButton.Text))
                {
                    _firstButton.Text = FirstButton.Text;
                }

                if (FirstButton.Icon != null)
                {
                    var iconPath = FirstButton.Icon.File;
                    if (!string.IsNullOrEmpty(iconPath))
                    {
                        var buttonImage = new ElmSharp.Image(_firstButton);
                        buttonImage.LoadAsync(ResourcePath.GetPath(iconPath));
                        buttonImage.Show();
                        _firstButton.SetPartContent("elm.swallow.content", buttonImage);
                    }
                }

                _firstButton.Clicked += (s, e) =>
                {
                    FirstButton.Activate();
                };

                if (_firstButtonBgColor != Color.Default)
                {
                    Console.WriteLine($"TwoButtonPopup set first button background color:{_firstButtonBgColor.ToNative()}");
                    _firstButton.BackgroundColor = _firstButtonBgColor.ToNative();
                }
            }
            else
            {
                _firstButton = null;
            }

            _popUp.SetPartContent("button1", _firstButton);
        }
Example #5
0
        void UpdateFirstButton()
        {
            _firstButton?.Hide();

            if (FirstButton != null)
            {
                _firstButton = new ElmSharp.Button(_popUp)
                {
                    WeightX = 1.0,
                    WeightY = 1.0,
                    Style   = "popup/circle/left"
                };

                if (!string.IsNullOrEmpty(FirstButton.Text))
                {
                    _firstButton.Text = FirstButton.Text;
                }

                if (FirstButton.Icon != null)
                {
                    var iconPath = FirstButton.Icon.File;
                    if (!string.IsNullOrEmpty(iconPath))
                    {
                        var buttonImage = new ElmSharp.Image(_firstButton);
                        buttonImage.LoadAsync(ResourcePath.GetPath(iconPath));
                        buttonImage.Show();
                        _firstButton.SetPartContent("elm.swallow.content", buttonImage);
                    }
                }

                _firstButton.Clicked += (s, e) =>
                {
                    FirstButton.Activate();
                };
            }
            else
            {
                _firstButton = null;
            }

            _popUp.SetPartContent("button1", _firstButton);
        }
 void UpdateIcon()
 {
     if (Icon != null)
     {
         var path  = ResourcePath.GetPath(_icon);
         var image = new ElmSharp.Image(_control);
         image.LoadAsync(path);
         image.Show();
         _control.SetPartContent(IconPart, image);
     }
 }