Exemplo n.º 1
0
        private void B2_Click(object sender, EventArgs e)
        {
            DateTime         time   = DateTime.Now;
            TimePickerDialog dialog = new TimePickerDialog(((AppCompatActivity)this.Activity), OnTimeSet, time.Hour, time.Minute, true);

            dialog.Show();
        }
Exemplo n.º 2
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();
            }

        }
Exemplo n.º 3
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();
        }
Exemplo n.º 4
0
        private void TimeButton_Click(object sender, EventArgs e)
        {
            DateTime         today            = DateTime.Today;
            TimePickerDialog timePickerDialog = new TimePickerDialog(this, OnTimeSet, today.Hour, today.Minute, true);

            timePickerDialog.Show();
        }
Exemplo n.º 5
0
        protected void EditTime()
        {
            if (timeEditing)
            {
                return;
            }
            timeEditing = true;
            var context = Context;

            if (context == null)
            {
                Android.Util.Log.Warn("TimeElement", "No Context for Edit");
                timeEditing = false;
                return;
            }
            var val        = Value.HasValue ? Value.Value : DateTime.UtcNow;
            var timePicker = new TimePickerDialog(context, OnTimeSet, val.Hour, val.Minute,
                                                  DateFormat.Is24HourFormat(context));

            timePicker.DismissEvent += ((sender, args) =>
            {
                timeEditing = false;
            });
            timePicker.Show();
        }
Exemplo n.º 6
0
        public override View GetView(int position, View convertView, ViewGroup parent)
        {
            var view = context.LayoutInflater.Inflate(Resource.Layout.WorkTimeListItem, null);
            var item = GetItem(position);

            view.FindViewById <TextView> (Resource.Id.txtDayOrOddEven).Text = item.Item1;

            var btnWorkTimeFromValue = view.FindViewById <Button> (Resource.Id.btnWorkTimeFromValue);

            btnWorkTimeFromValue.Text   = item.Item2.ToString("t");
            btnWorkTimeFromValue.Click += (object sender, EventArgs e) => {
                doctor.chooseNwtType = item.Item3;
                var timepickDialog = new TimePickerDialog(context, tpCallBack, item.Item2.Hour, item.Item2.Minute, true);
                timepickDialog.SetTitle(item.Item1);
                timepickDialog.Show();
            };

            var btnWorkTimeTillValue = view.FindViewById <Button> (Resource.Id.btnWorkTimeTillValue);

            btnWorkTimeTillValue.Text   = item.Item4.ToString("t");
            btnWorkTimeTillValue.Click += (object sender, EventArgs e) => {
                doctor.chooseNwtType = item.Item5;
                var timepickDialog = new TimePickerDialog(context, tpCallBack, item.Item4.Hour, item.Item4.Minute, true);
                timepickDialog.SetTitle(item.Item1);
                timepickDialog.Show();
            };

            return(view);
        }
Exemplo n.º 7
0
        private void EndTimeDialog_Click(object sender, EventArgs e)
        {
            DateTime         currently = DateTime.Now;
            TimePickerDialog dialog    = new TimePickerDialog(this, SetEndTime, currently.Hour, currently.Minute, true);

            dialog.Show();
        }
Exemplo n.º 8
0
        /// <summary>
        /// Displays the time picker dialog for choosing the alarm time
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void AlarmTime_Click(object sender, EventArgs e)
        {
            hideSoftKeyboard();
            TimePickerDialog tpd = new TimePickerDialog(this, tdpCallback, DateTime.Now.Hour, DateTime.Now.Minute, true);

            tpd.Show();
        }
Exemplo n.º 9
0
        public override Dialog OnCreateDialog(Bundle savedInstanceState)
        {
            DateTime         currently = DateTime.Now;
            TimePickerDialog dialog    = new TimePickerDialog(Activity, this, currently.Hour, currently.Minute, true);

            return(dialog);
        }
Exemplo n.º 10
0
        public override Dialog OnCreateDialog(Bundle savedInstanceState)
        {
            DateTime         defaultDate = new DateTime(1900, 1, 1, 12, 0, 0);
            TimePickerDialog dialog      = new TimePickerDialog(_activity, this, defaultDate.Hour, defaultDate.Minute, false);

            return(dialog);
        }
 private void ShowTimePicker()
 {
     if (dialog == null)
     {
         dialog = new TimePickerDialog(Context, 3, OnTimeSet, Element.Time.Hours, Element.Time.Minutes, true);
     }
     dialog.Show();
 }
Exemplo n.º 12
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);
 }
        public override Dialog OnCreateDialog(Bundle savedInstanceState)
        {
            DateTime         currentTime    = DateTime.Now;
            bool             is24HourFormat = DateFormat.Is24HourFormat(Activity);
            TimePickerDialog dialog         = new TimePickerDialog(Activity, Resource.Style.MyTimePickerDialogTheme, this, currentTime.Hour, currentTime.Minute, is24HourFormat);

            return(dialog);
        }
 private void ShowTimePicker()
 {
     if (dialog == null)
     {
         dialog = new TimePickerDialog(Forms.Context, this, DateTime.Now.Hour, DateTime.Now.Minute, true);
     }
     dialog.Show();
 }
        private void MTxtTransactionTime_Click(object sender, EventArgs e)
        {
            selectedHourOfDay = Convert.ToInt32(GetSelectedTime(mTxtTransactionTime.Text, DateTime.Now.ToString("d/MMM/yyyy")).ToString("HH"));
            selectedMinute    = Convert.ToInt32(GetSelectedTime(mTxtTransactionTime.Text, DateTime.Now.ToString("d/MMM/yyyy")).ToString("mm"));
            TimePickerDialog tpd = new TimePickerDialog(this, TimeListener, selectedHourOfDay, selectedMinute, false);

            tpd.Show();
        }
Exemplo n.º 16
0
        public override Dialog OnCreateDialog(Bundle savedInstanceState)
        {
            var currentTime = DateTime.Now;
            var is24Format  = DateFormat.Is24HourFormat(base.Activity);
            var dialog      = new TimePickerDialog(base.Activity, this, currentTime.Day, currentTime.Minute, is24Format);

            return(dialog);
        }
Exemplo n.º 17
0
        public void ShowTimeDialog(Object sender, EventArgs e)
        {
            TimePickerDialog mTimePicker;

            mTimePicker = new TimePickerDialog(this, Android.Resource.Style.ThemeHoloLightDialog, this,
                                               hour, minute, false);
            mTimePicker.SetTitle("Select Time");
            mTimePicker.Show();
        }
Exemplo n.º 18
0
 public override Dialog OnCreateDialog(Bundle savedInstanceState)
 {
     DateTime currentTime = DateTime.Now;
     bool is24HourFormat = DateFormat.Is24HourFormat(Activity);
     //is24HourFormat = true;
     TimePickerDialog dialog = new TimePickerDialog
         (Activity, this, currentTime.Hour, currentTime.Minute, is24HourFormat);
     return dialog;
 }
        private void ShowTimePicker()
        {
            if (dialog == null)
            {
                dialog = new TimePickerDialog(Forms.Context, this, Element.Time.Hours, Element.Time.Minutes, true);
            }

            dialog.Show();
        }
Exemplo n.º 20
0
        /// <summary>
        /// Catches the event when the date is set
        /// </summary>
        /// <param name="sender">The sender</param>
        /// <param name="e">The arguments</param>
        private void DatePickerDialog_DateSet(object sender, DatePickerDialog.DateSetEventArgs e)
        {
            saveDate = e.Date;
            TimePickerDialog timePickerDialog = new TimePickerDialog(
                this.Context, OnTimeSet, DateTime.Now.TimeOfDay.Hours, DateTime.Now.TimeOfDay.Minutes, true);

            timePickerDialog.SetTitle(Resource.String.picktime_text);
            timePickerDialog.Show();
        }
Exemplo n.º 21
0
        public void ShowPicker()
        {
            TextBase.CurrentFocus?.Blur(true);
            var now = Time ?? DateTime.Now;

            _timePicker = new TimePickerDialog(DroidFactory.MainActivity, OnTimeChanged, now.Hour, now.Minute,
                                               Android.Text.Format.DateFormat.Is24HourFormat(DroidFactory.MainActivity));
            _timePicker.Show();
        }
Exemplo n.º 22
0
        private void ShowTimePicker()
        {
            if (_dialog == null)
            {
                _dialog = new TimePickerDialogEx(this.Element, Forms.Context, this, DateTime.Now.Hour, DateTime.Now.Minute);
            }

            _dialog.Show();
        }
Exemplo n.º 23
0
        private TimePickerDialog showTime()
        {
            var localTime = ViewModel.CurrentDateTime.ToLocalTime();

            var dialog = new TimePickerDialog(
                Activity, onTimeSet,
                localTime.Hour, localTime.Minute, ViewModel.Is24HoursFormat);

            return(dialog);
        }
Exemplo n.º 24
0
        private void EndTimeName_Click(object sender, EventArgs e)
        {
            TimePickerDialog timePicker = new TimePickerDialog(mContext,
                                                               EndTimePickerCallback,
                                                               EndTime.Get(CalendarField.HourOfDay),
                                                               EndTime.Get(CalendarField.Minute),
                                                               false);

            timePicker.Show();
        }
Exemplo n.º 25
0
        void TimePickerDialog.IOnTimeSetListener.OnTimeSet(Com.Wdullaer.MaterialDateTimePicker.Time.TimePickerDialog view, int hourOfDay, int minute, int second)
        {
            string hourString   = hourOfDay < 10 ? "0" + hourOfDay : "" + hourOfDay;
            string minuteString = minute < 10 ? "0" + minute : "" + minute;
            string secondString = second < 10 ? "0" + second : "" + second;
            string time         = "You picked the following time: " + hourString + "h" + minuteString + "m" + secondString + "s";

            timeTextView.Text = time;
            tpd = null;
        }
        private void TimeEditText_Click(object sender, EventArgs e)
        {
            DateTime         currentTime = DateTime.Now;
            TimePickerDialog dialog      = new TimePickerDialog(Activity, 2, (sender_, args) => {
                string amPm = (args.HourOfDay > 12 ? "PM" : "AM");
                View.FindViewById <EditText>(Resource.Id.ResTime).Text = (args.HourOfDay > 12 ? Return12HourNumber(args.HourOfDay) : args.HourOfDay.ToString()) + " " + args.Minute + " " + amPm;
            }, currentTime.Hour, currentTime.Minute, false);

            dialog.Show();
        }
Exemplo n.º 27
0
        public DatePickerService()
        {
            var date = DateTime.Now;

            _datePickerDialog = new DatePickerDialog(Context, this, date.Year, date.Month - 1, date.Day);
            _datePickerDialog.SetOnCancelListener(this);

            _timePickerDialog = new TimePickerDialog(Context, this, date.Hour, date.Minute, true);
            _timePickerDialog.SetOnCancelListener(this);
        }
        public void OnClick(global::Android.Views.View v)
        {
            var dialog = new TimePickerDialog(Context, new EventHandler <TimePickerDialog.TimeSetEventArgs>(OnTimeSet), _control.Time.Hours, _control.Time.Minutes, _control.Is24Hour);

            dialog.SetCustomTitle(new TextView(Context)
            {
                Visibility = ViewStates.Gone
            });
            dialog.Show();
        }
Exemplo n.º 29
0
        private void StartTimeName_Click(object sender, EventArgs e)
        {
            TimePickerDialog timePicker = new TimePickerDialog(
                con,
                StartTimePickerCallback,
                startTime.Get(CalendarField.HourOfDay),
                startTime.Get(CalendarField.Minute),
                false);

            timePicker.Show();
        }
Exemplo n.º 30
0
        void ShowTimePicker()
        {
            if (_dialog == null)
            {
                _dialog = new TimePickerDialog(CurrentContext, this, Element.Time.Hours, Element.Time.Minutes, true);
            }

            _dialog.UpdateTime(Element.Time.Hours, Element.Time.Minutes);

            _dialog.Show();
        }