Esempio n. 1
0
        void CreateDialog()
        {
            if (_dialog == null)
            {
                bool is24HourFormat = DateFormat.Is24HourFormat(_context);
                _dialog = new TimePickerDialog(_context, TimeSelected, _TimePickerCell.Time.Hours, _TimePickerCell.Time.Minutes, is24HourFormat);

                var title = new TextView(_context);

                if (!string.IsNullOrEmpty(_title))
                {
                    title.Gravity = Android.Views.GravityFlags.Center;
                    title.SetPadding(10, 10, 10, 10);
                    title.Text = _title;
                    _dialog.SetCustomTitle(title);
                }

                _dialog.SetCanceledOnTouchOutside(true);

                _dialog.DismissEvent += (ss, ee) =>
                {
                    title.Dispose();
                    _dialog.Dispose();
                    _dialog = null;
                };

                _dialog.Show();
            }
        }
Esempio n. 2
0
        private void CreateDialog()
        {
            if (_Dialog != null)
            {
                return;
            }
            _Dialog = new TimePickerDialog(AndroidContext,
                                           TimeSelected,
                                           _TimePickerCell.Time.Hours,
                                           _TimePickerCell.Time.Minutes,
                                           DateFormat.Is24HourFormat(AndroidContext)
                                           );

            var title = new TextView(AndroidContext)
            {
                Gravity = Android.Views.GravityFlags.Center,
                Text    = string.IsNullOrEmpty(_PopupTitle) ? "Select Time" : _PopupTitle,
            };

            title.SetBackgroundColor(_TimePickerCell.Prompt.BackgroundColor.ToAndroid());
            title.SetTextColor(_TimePickerCell.Prompt.TitleColor.ToAndroid());
            title.SetPadding(10, 10, 10, 10);

            _Dialog.SetCustomTitle(title);
            _Dialog.SetCanceledOnTouchOutside(true);

            _Dialog.DismissEvent += (sender, e) =>
            {
                title.Dispose();
                _Dialog.Dispose();
                _Dialog = null;
            };

            _Dialog.Show();
        }
Esempio n. 3
0
 /// <summary>
 /// Dispose the specified disposing.
 /// </summary>
 /// <returns>The dispose.</returns>
 /// <param name="disposing">If set to <c>true</c> disposing.</param>
 protected override void Dispose(bool disposing)
 {
     if (disposing) {
         _dialog?.Dispose();
         _dialog = null;
     }
     base.Dispose(disposing);
 }
 protected override void OnDetached()
 {
     if (!IsDisposed)
     {
         _view.Touch -= _view_Touch;
     }
     if (_dialog != null)
     {
         _dialog.Dispose();
         _dialog = null;
     }
     _view    = null;
     _command = null;
 }
Esempio n. 5
0
 protected override void OnDetachedOverride()
 {
     if (!IsDisposed)
     {
         _view.Touch -= _view_Touch;
         System.Diagnostics.Debug.WriteLine($"{this.GetType().FullName} Detached Disposing");
     }
     if (_dialog != null)
     {
         _dialog.Dispose();
         _dialog = null;
     }
     _view    = null;
     _command = null;
     System.Diagnostics.Debug.WriteLine($"{this.GetType().FullName} Detached completely");
 }
Esempio n. 6
0
        protected override void Dispose(bool disposing)
        {
            if (Control != null)
            {
                this.Control.Click       -= OnPickerClick;
                this.Control.FocusChange -= OnPickerFocusChange;

                if (_dialog != null)
                {
                    _dialog.Hide();
                    _dialog.Dispose();
                    _dialog = null;
                }
            }

            base.Dispose(disposing);
        }