示例#1
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();
        }
示例#2
0
        public void Init()
        {
            mDatePickerDialog = new DatePickerDialog(this, this, ViewModel.EndBookingDateTime.Year, ViewModel.EndBookingDateTime.Month - 1, ViewModel.EndBookingDateTime.Day);
            mTimePickerDialog = new TimePickerDialog(this, this, ViewModel.EndBookingDateTime.Hour, ViewModel.EndBookingDateTime.Minute, true);
            etDate            = FindViewById <TextView>(Resource.Id.etDate);
            etHour            = FindViewById <TextView>(Resource.Id.etHour);
            mSeekBar          = FindViewById <SeekBar>(Resource.Id.seekBar1);
            mSeekBar.Touch   += (sender, args) =>
            {
                if (args.Event.Action == MotionEventActions.Up)
                {
                    if (mSeekBar.Progress != mCurrentProgress)
                    {
                        mCurrentProgress = mSeekBar.Progress;
                        ViewModel.HandleValueChanged();
                        args.Handled = true;
                        return;
                    }
                }

                args.Handled = false;
            };
            mCurrentProgress = 0;
            etDate.Click    += (sender, args) =>
            {
                mDatePickerDialog.UpdateDate(ViewModel.EndBookingDateTime.Year, ViewModel.EndBookingDateTime.Month - 1, ViewModel.EndBookingDateTime.Day);
                mDatePickerDialog.Show();
            };
            etHour.Click += (sender, args) =>
            {
                mTimePickerDialog.UpdateTime(ViewModel.EndBookingDateTime.Hour, ViewModel.EndBookingDateTime.Minute);
                mTimePickerDialog.Show();
            };

            locationManager = (LocationManager)GetSystemService(LocationService);
            bool GPSEnable = DetectLocationService();

            var _isGooglePlayServicesInstalled = IsGooglePlayServicesInstalled();

            if (_isGooglePlayServicesInstalled)
            {
                // pass in the Context, ConnectionListener and ConnectionFailedListener
                apiClient = new GoogleApiClientBuilder(this, this, this)
                            .AddApi(LocationServices.API).Build();

                // generate a location request that we will pass into a call for location updates
                locRequest = new LocationRequest();
            }
            else
            {
                Log.Error("OnCreate", "Google Play Services is not installed");
                Toast.MakeText(this, ViewModel.SharedTextSource.GetText("GGPlayNotInstalledText"), ToastLength.Long).Show();
            }
        }
示例#3
0
        private void editTime(DateTimeOffset currentTime)
        {
            if (editDialog == null)
            {
                var timePickerDialog = new TimePickerDialog(this, Resource.Style.WheelDialogStyle, new TimePickerListener(currentTime, activeEditionChangedSubject.OnNext),
                                                            currentTime.Hour, currentTime.Minute, is24HoursFormat);

                void resetAction()
                {
                    timePickerDialog.UpdateTime(currentTime.Hour, currentTime.Minute);
                }

                editDialog = timePickerDialog;
                editDialog.DismissEvent += (_, __) => onCurrentEditDialogDismiss(resetAction);
                editDialog.Show();
            }
        }
        public Task <TimeSpan?> ShowTimePickerAsync(string title, DateTime?defaultDate, DateTime?minDate = null, DateTime?maxDate = null)
        {
            if (_timePickerDialog.IsShowing && _tcsTime != null)
            {
                return(_tcsTime.Task);
            }


            if (defaultDate.HasValue)
            {
                _timePickerDialog.UpdateTime(defaultDate.Value.Hour, defaultDate.Value.Minute);
            }

            _tcsTime = new TaskCompletionSource <TimeSpan?>();

            _timePickerDialog.SetTitle(title);
            _timePickerDialog.Show();

            return(_tcsTime.Task);
        }
        public void Init()
        {
            mDatePickerDialog  = new DatePickerDialog(this, this, ViewModel.EndBookingDateTime.Year, ViewModel.EndBookingDateTime.Month - 1, ViewModel.EndBookingDateTime.Day);
            mTimePickerDialog  = new TimePickerDialog(this, this, ViewModel.EndBookingDateTime.Hour, ViewModel.EndBookingDateTime.Minute, true);
            etStartDate        = FindViewById <TextRegular>(Resource.Id.etStartDate);
            etStartHour        = FindViewById <TextRegular>(Resource.Id.etStartHour);
            etStartDate.Click += (sender, args) =>
            {
                IsStartClick = true;
                mDatePickerDialog.UpdateDate(ViewModel.StartBookingDateTime.Year, ViewModel.StartBookingDateTime.Month - 1, ViewModel.StartBookingDateTime.Day);
                mDatePickerDialog.Show();
            };
            etStartHour.Click += (sender, args) =>
            {
                IsStartClick = true;
                mTimePickerDialog.UpdateTime(ViewModel.StartBookingDateTime.Hour, ViewModel.StartBookingDateTime.Minute);
                mTimePickerDialog.Show();
            };

            locationManager = (LocationManager)GetSystemService(LocationService);
            bool GPSEnable = DetectLocationService();

            var _isGooglePlayServicesInstalled = IsGooglePlayServicesInstalled();

            if (_isGooglePlayServicesInstalled)
            {
                // pass in the Context, ConnectionListener and ConnectionFailedListener
                apiClient = new GoogleApiClientBuilder(this, this, this)
                            .AddApi(LocationServices.API).Build();

                // generate a location request that we will pass into a call for location updates
                locRequest = new LocationRequest();
            }
            else
            {
                Log.Error("OnCreate", "Google Play Services is not installed");
                Toast.MakeText(this, ViewModel.SharedTextSource.GetText("GGPlayNotInstalledText"), ToastLength.Long).Show();
            }
        }