protected override void Dispose(bool disposing) { if (Control == null) { return; } Element.Focused -= Element_Focused; if (_monthYearPickerDialog != null) { _monthYearPickerDialog.OnDateTimeChanged -= OnDateTimeChanged; _monthYearPickerDialog.OnClosed -= OnClosed; _monthYearPickerDialog.Hide(); _monthYearPickerDialog.Dispose(); _monthYearPickerDialog = null; } base.Dispose(disposing); }
private void ShowDatePicker() { if (_monthYearPickerDialog == null) { _monthYearPickerDialog = new MYPickerDialog(); _monthYearPickerDialog.OnDateTimeChanged += OnDateTimeChanged; _monthYearPickerDialog.OnClosed += OnClosed; } _monthYearPickerDialog.Date = Element.Date; _monthYearPickerDialog.MinDate = FormatDateToMonthYear(Element.MinDate); _monthYearPickerDialog.MaxDate = FormatDateToMonthYear(Element.MaxDate); _monthYearPickerDialog.InfiniteScroll = Element.InfiniteScroll; var appcompatActivity = CrossCurrentActivity.Current.Activity as AppCompatActivity; var mFragManager = appcompatActivity?.SupportFragmentManager; if (mFragManager != null) { _monthYearPickerDialog.Show(mFragManager, nameof(MonthYearPickerDialog)); } }