void UpdateSecondButton() { _secondButton?.Hide(); if (SecondButton != null) { _secondButton = new ElmSharp.Button(_popUp) { WeightX = 1.0, WeightY = 1.0, Style = "popup/circle/right" }; if (!string.IsNullOrEmpty(SecondButton.Text)) { _secondButton.Text = SecondButton.Text; } if (!SecondButton.IconImageSource.IsNullOrEmpty()) { var iconSource = SecondButton.IconImageSource as FileImageSource; if (!iconSource.IsNullOrEmpty()) { var buttonImage = new ElmSharp.Image(_secondButton); buttonImage.LoadAsync(ResourcePath.GetPath(iconSource)); buttonImage.Show(); _secondButton.SetPartContent("elm.swallow.content", buttonImage); } } _secondButton.Clicked += (s, e) => { ((IMenuItemController)SecondButton).Activate(); }; if (_secondButtonBgColor != Color.Default) { Log.Debug(FormsCircularUI.Tag, $"TwoButtonPopup set second button background color:{_secondButtonBgColor.ToNative()}"); _secondButton.BackgroundColor = _secondButtonBgColor.ToNative(); } _popUp.SetPartContent("button2", _secondButton); } else { /* This is workaround fix for Left button occupied whole window when right button is null*/ _secondButton = new ElmSharp.Button(_popUp) { WeightX = 1.0, WeightY = 1.0, Style = "popup/circle/right" }; _popUp.SetPartContent("button2", _secondButton); _secondButton.Unrealize(); _secondButton = null; } }
void UpdateSecondButton() { _secondButton?.Hide(); if (SecondButton != null) { _secondButton = new ElmSharp.Button(_popUp) { WeightX = 1.0, WeightY = 1.0, Style = "popup/circle/right" }; if (!string.IsNullOrEmpty(SecondButton.Text)) { _secondButton.Text = SecondButton.Text; } if (SecondButton.Icon != null) { var iconPath = SecondButton.Icon.File; if (!string.IsNullOrEmpty(iconPath)) { var buttonImage = new ElmSharp.Image(_secondButton); buttonImage.LoadAsync(ResourcePath.GetPath(iconPath)); buttonImage.Show(); _secondButton.SetPartContent("elm.swallow.content", buttonImage); } } _secondButton.Clicked += (s, e) => { SecondButton.Activate(); }; _popUp.SetPartContent("button2", _secondButton); } else { /* This is workaround fix for Left button occupied whole window when right button is null*/ _secondButton = new ElmSharp.Button(_popUp) { WeightX = 1.0, WeightY = 1.0, Style = "popup/circle/right" }; _popUp.SetPartContent("button2", _secondButton); _secondButton.Unrealize(); _secondButton = null; } }
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); }
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); }
void UpdateNegative() { _nativeNegative?.Hide(); if (Negative != null) { _nativeNegative = (ElmSharp.Button)Platform.GetOrCreateRenderer(Negative).NativeView; _nativeNegative.Style = "popup"; } else { _nativeNegative = null; } _control.SetPartContent("button3", _nativeNegative, true); }
void UpdateNeutral() { _nativeNeutral?.Hide(); if (Neutral != null) { _nativeNeutral = (ElmSharp.Button)Platform.GetOrCreateRenderer(Neutral).NativeView; _nativeNeutral.Style = "popup"; } else { _nativeNeutral = null; } _control.SetPartContent("button2", _nativeNeutral, true); }
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); }