protected override void Dispose(bool disposing) { if (Control is MaterialStepper control) { control.DecrementButton.TouchUpInside -= OnStep; control.IncrementButton.TouchUpInside -= OnStep; } _buttonScheme?.Dispose(); _buttonScheme = null; base.Dispose(disposing); }
protected override void OnElementChanged(ElementChangedEventArgs <Button> e) { // recreate the scheme _buttonScheme?.Dispose(); _buttonScheme = CreateButtonScheme(); base.OnElementChanged(e); if (e.NewElement != null) { if (Control == null) { _defaultButtonScheme = CreateButtonScheme(); SetNativeControl(CreateNativeControl()); Control.TouchUpInside += OnButtonTouchUpInside; Control.TouchDown += OnButtonTouchDown; } UpdateFont(); UpdateCornerRadius(); UpdateBorder(); UpdateTextColor(); _buttonLayoutManager?.Update(); ApplyTheme(); } }
public void Dispose() { ButtonScheme.OnButtonPress -= ButtonScheme_OnButtonPress; ButtonRace.OnButtonPress -= ButtonRace_OnButtonPress; ButtonPlayerType.OnButtonPress -= ButtonPlayerType_OnButtonPress; BackRect.Dispose(); TextUser.Dispose(); ButtonPlayerType.Dispose(); TextPlayerType.Dispose(); ButtonRace.Dispose(); TextRace.Dispose(); ButtonScheme.Dispose(); TextScheme.Dispose(); }