protected override DatePickerDialog CreateDatePickerDialog(int year, int month, int day) { var view = (ExtendedDatePicker)Element; var dialog = new DatePickerDialog( Context, Resource.Style.DatePickerSpinnerDialogStyle, (o, e) => { view.Date = e.Date; ((IElementController)view).SetValueFromRenderer(VisualElement.IsFocusedProperty, false); Control.ClearFocus(); }, year, month, day); dialog.SetButton("Done", (sender, e) => { Element.Format = view.OriginalFormat; Control.Text = dialog.DatePicker.DateTime.ToString(Element.Format); view.AssignValue(); }); dialog.SetButton2("Clear", (sender, e) => { view.CleanDate(); Control.Text = Element.Format; }); return(dialog); }
private void BtnSelection_Click(object sender, EventArgs e) { // Tháng trong DatePicker bắt đầu từ 0 DatePickerDialog datePicker = new DatePickerDialog(view.Context, this, userDateTime.Year, userDateTime.Month - 1, userDateTime.Day); datePicker.Show(); }
private void editDate(DateTimeOffset currentDate) { if (editDialog == null) { var datePickerDialog = new DatePickerDialog(this, Resource.Style.WheelDialogStyle, new DatePickerListener(currentDate, activeEditionChangedSubject.OnNext), currentDate.Year, currentDate.Month - 1, currentDate.Day); // FirstDayOfWeek days start with sunday at 1 and finish with saturday at 7 var normalizedBeginningOfWeek = (int)ViewModel.BeginningOfWeek + 1; datePickerDialog.DatePicker.FirstDayOfWeek = normalizedBeginningOfWeek; void updateDateBounds() { datePickerDialog.DatePicker.MinDate = minDateTime.ToUnixTimeMilliseconds(); datePickerDialog.DatePicker.MaxDate = maxDateTime.ToUnixTimeMilliseconds(); } updateDateBounds(); void resetAction() { updateDateBounds(); datePickerDialog.UpdateDate(currentDate.Year, currentDate.Month - 1, currentDate.Day); } editDialog = datePickerDialog; editDialog.DismissEvent += (_, __) => onCurrentEditDialogDismiss(resetAction); editDialog.Show(); } }
void CreateDatePickerDialog(int year, int month, int day) { NullableDatePicker view = Element; _dialog = new DatePickerDialog(Context, (o, e) => { view.Date = e.Date; ((IElementController)view).SetValueFromRenderer(VisualElement.IsFocusedProperty, false); Control.ClearFocus(); _dialog = null; }, year, month, day); _dialog.SetButton("OK", (sender, e) => { SetDate(_dialog.DatePicker.DateTime); this.Element.Format = this.Element._originalFormat; this.Element.AssignValue(); }); _dialog.SetButton2("Limpar", (sender, e) => { this.Element.CleanDate(); Control.Text = this.Element.Format.Replace("\'", ""); }); }
private void editDate(DateTimeOffset currentDate) { if (editDialog == null) { var datePickerDialog = new DatePickerDialog(this, Resource.Style.WheelDialogStyle, new DatePickerListener(currentDate, activeEditionChangedSubject.OnNext), currentDate.Year, currentDate.Month - 1, currentDate.Day); void updateDateBounds() { datePickerDialog.DatePicker.MinDate = minDateTime.ToUnixTimeMilliseconds(); datePickerDialog.DatePicker.MaxDate = maxDateTime.ToUnixTimeMilliseconds(); } updateDateBounds(); void resetAction() { updateDateBounds(); datePickerDialog.UpdateDate(currentDate.Year, currentDate.Month - 1, currentDate.Day); } editDialog = datePickerDialog; editDialog.DismissEvent += (_, __) => onCurrentEditDialogDismiss(resetAction); editDialog.Show(); } }
public override Dialog OnCreateDialog(Bundle savedInstanceState) { DateTime currently = DateTime.Now.AddMonths(-1); var dialog = new DatePickerDialog(Activity, this, currently.Year, currently.Month, currently.Day); return(dialog); }
private void MinimumDateLayout() { /**************** **Minimum Date** ****************/ spaceAdder1 = new TextView(context); minPick = Calendar.Instance; minPick.Set(2012, 0, 1); maxPick = Calendar.Instance; maxPick.Set(2018, 11, 1); //Minimum Date Text minDate = new TextView(context); minDate.Text = "Min Date"; minDate.TextSize = 20; minDate.Gravity = GravityFlags.Left; //minDateButton minDateButton = new Button(context); minDateButton.SetBackgroundColor(Color.ParseColor("#8CD4CF")); minDateButton.Text = "1/1/2012"; minDateButton.TextSize = 16; minDatePicker = new DatePickerDialog(context, MinDateSetting, 2012, 1, 1); minDateButton.Click += (object sender, EventArgs e) => { minDatePicker.Show(); }; //Separator 1 minMaxSeparator = new SeparatorView(context, width * 2); minMaxSeparator.LayoutParameters = new ViewGroup.LayoutParams(width * 2, 5); minMaxSeparatorLayoutParam = new LinearLayout.LayoutParams(width * 2, 5); minMaxSeparatorLayoutParam.SetMargins(0, 20, 0, 0); }
private void MaximumDateLayout() { //Maximum Date Text TextView maxDate = new TextView(context); maxDate.SetPadding(0, 0, 0, 50); maxDate.Text = "Max Date"; maxDate.TextSize = 20; maxDate.Gravity = GravityFlags.Left; //maxDateButton maxDateButton = new Button(context); maxDateButton.Text = maxTextDate; maxDateButton.TextSize = 16; maxDateButton.SetBackgroundColor(Color.ParseColor("#8CD4CF")); maxDatePicker = new DatePickerDialog(context, MaxDateSetting, maxYear, maxMonth, maxDay); maxDateButton.Click += (object sender, EventArgs e) => { maxDatePicker.Show(); }; //maxDateLayout LinearLayout maxDateLayout = new LinearLayout(context); maxDateLayout.Orientation = Android.Widget.Orientation.Vertical; maxDateLayout.SetPadding(0, 0, 0, 50); maxDateLayout.AddView(maxDate); maxDateLayout.AddView(maxDateButton); proprtyOptionsLayout.AddView(maxDateLayout); }
/*private void SubmitButton_Click(object sender, EventArgs e) * { * string fullNameText = fullName.EditText.Text; * string nicText = nic.EditText.Text; * string emailText = email.EditText.Text; * string telephoneText = telephone.EditText.Text; * string selectedDateText = selectDate.Text; * * HashMap memberInfo = new HashMap(); * memberInfo.Put("fullName", fullNameText); * memberInfo.Put("NIC", nicText); * memberInfo.Put("Email", emailText); * memberInfo.Put("telephone Number", telephoneText); * memberInfo.Put("Birthday", birthday); * * Android.App.AlertDialog.Builder saveMemberAlert = new Android.App.AlertDialog.Builder(this); * saveMemberAlert.SetTitle("Save Alumni Info"); * saveMemberAlert.SetMessage("Are you sure?"); * saveMemberAlert.SetPositiveButton("Continue", (senderAlert, args) => * { * DatabaseReference newMemberRef = AppDataHelper.GetDatabase().GetReference("Member").Push(); * newMemberRef.SetValue(memberInfo); * this.Dispose(); * }); * saveMemberAlert.SetNegativeButton("Cancel", (senderAlert, args) => * { * saveMemberAlert.Dispose(); * }); * * saveMemberAlert.Show(); * }*/ private void SelectDate_Click(object sender, EventArgs e) { var dateTimeNow = DateTime.Now; DatePickerDialog datePicker = new DatePickerDialog(this, this, dateTimeNow.Year, dateTimeNow.Month, dateTimeNow.Day); datePicker.Show(); }
public override Dialog OnCreateDialog(Bundle savedInstanceState) { var today = DateTime.Now; var dialog = new DatePickerDialog(Activity, this, today.Year, today.Month, today.Day); return(dialog); }
public void OnClick(object sender, EventArgs e) { HideKeyboard(); _dialog = new DatePickerDialog(Context, this, blankPicker.Date.Year, blankPicker.Date.Month - 1, blankPicker.Date.Day); _dialog.DatePicker.MaxDate = UnixTimestampFromDateTime(blankPicker.MaximumDate); _dialog.DatePicker.MinDate = UnixTimestampFromDateTime(blankPicker.MinimumDate); _dialog.SetButton(blankPicker.DoneButtonText, (k, p) => { blankPicker.Text = _dialog.DatePicker.DateTime.ToString(blankPicker.Format); blankPicker.Date = _dialog.DatePicker.DateTime; blankPicker.SendDoneClicked(); EController.SetValueFromRenderer(VisualElement.IsFocusedPropertyKey, false); Control.ClearFocus(); HideKeyboard(); }); _dialog.SetButton2(blankPicker.CancelButtonText, (s, el) => { blankPicker.SendCancelClicked(); EController.SetValueFromRenderer(VisualElement.IsFocusedPropertyKey, false); Control.ClearFocus(); HideKeyboard(); }); _dialog.CancelEvent += _dialog_DismissEvent; _dialog.Show(); }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.Add); RequestPermissions(_permissionsLocation, RequestCameraPermisionId); _closeActivity = FindViewById <ImageView>(Resource.Id.closeActivity); _cameraImage = FindViewById <ImageView>(Resource.Id.cameraImage); _autoCompleteTextView = FindViewById <AutoCompleteTextView>(Resource.Id.addresses); _player = MediaPlayer.Create(this, Resource.Raw.beep); _player.SetVolume(100, 100); _datePicker = FindViewById <EditText>(Resource.Id.datepicker); _scanList = FindViewById <ListView>(Resource.Id.scanList); _statusSpinner = FindViewById <Spinner>(Resource.Id.orderStatus); _addOrder = FindViewById <ImageView>(Resource.Id.addOrder); var today = DateTime.Today; var dateDialog = new DatePickerDialog(this, OnDateSet, today.Year, today.Month - 1, today.Day); dateDialog.DatePicker.MinDate = today.Millisecond; _datePicker.Touch += delegate { dateDialog.Show(); }; _closeActivity.Click += CloseActivity; _cameraImage.Click += LaunchScanner; _autoCompleteTextView.TextChanged += GetAddresses; _scanList.ItemClick += RemoveScannedItem; _statusSpinner.Adapter = FillStatusSpinner(); _addOrder.Click += HandleOrderSubmit; }
private void OnClickDateEditText() { var dateTimeNow = DateTime.Now; DatePickerDialog datePicker = new DatePickerDialog(this, this, dateTimeNow.Year, dateTimeNow.Month, dateTimeNow.Day); datePicker.Show(); }
private void SetDatePickerText() { _reminderDatePickerText = this.FindViewById <EditText>(Resource.Id.reminderDatePickerEditText); _reminderDatePickerEditTextReadableValue = this.FindViewById <EditText>(Resource.Id.reminderDatePickerEditTextReadableValue); if (!string.IsNullOrEmpty(_reminderDatePickerText.Text)) { var reminderDate = Convert.ToDateTime(_reminderDatePickerText.Text); _reminderDatePickerEditTextReadableValue.Text = ReadableDateConverter.Convert(reminderDate); } _reminderDatePickerEditTextReadableValue.Focusable = false; _reminderDatePickerEditTextReadableValue.Click += delegate { var reminderDate = DateTime.Now; if (!string.IsNullOrEmpty(_reminderDatePickerText.Text)) { reminderDate = Convert.ToDateTime(_reminderDatePickerText.Text); } DatePickerDialog dialog = new DatePickerDialog(this, this, reminderDate.Year, reminderDate.Month - 1, reminderDate.Day); dialog.SetTitle(GetString(Resource.String.date_selection)); dialog.DatePicker.SetMinDate(DateTime.Now); dialog.Show(); }; }
private void MTxtStartDate_Click(object sender, EventArgs e) { DatePickerDialog dpd = new DatePickerDialog(this, StartDateListener, selectedStartCalendarYear, selectedStartCalendarMonth, selectedStartCalendarDayOfMonth); dpd.DatePicker.MaxDate = Java.Lang.JavaSystem.CurrentTimeMillis(); dpd.Show(); }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); // Create your application here SetContentView(Resource.Layout.randevu_creator); user_data = JsonConvert.DeserializeObject <List <model.users> >(Intent.GetStringExtra("data")); // dr_data = JsonConvert.DeserializeObject<List<model.doctors>>(Intent.GetStringExtra("dr_data")); FindViewById <TextView>(Resource.Id.toolbar_title).Text = Intent.GetStringExtra("dr_name"); DatePickerDialog dateDialog = new DatePickerDialog(this, OnDateSet, today.Year, today.Month, today.Day); dateDialog.DatePicker.MinDate = today.Millisecond; dateDialog.Show(); dateDialog.DismissEvent += (s, e) => { if (date == "") { dateDialog.Show(); } // do whatever you need here, this will be called on // dismiss (clicking on cancel button or outside of dialog) }; }
private void TextFechaHastaEditText_Click(object sender, EventArgs e) { DatePickerDialog dateDialog = new DatePickerDialog(this, OnDateSetHasta, fechaHasta.Year, fechaHasta.Month - 1, fechaHasta.Day); dateDialog.DatePicker.MinDate = fechaHasta.Millisecond; dateDialog.Show(); }
protected override void OnFocusChangeRequested(object sender, VisualElement.FocusRequestArgs e) { base.OnFocusChangeRequested(sender, e); if (e.Focus) { if (Clickable) { CallOnClick(); } else { ((IPickerRenderer)this)?.OnClick(); } } else if (_dialog != null) { _dialog.Hide(); ((IElementController)Element).SetValueFromRenderer(VisualElement.IsFocusedPropertyKey, false); if (Forms.IsLollipopOrNewer) { _dialog.CancelEvent -= OnCancelButtonClicked; } _dialog = null; } }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.activity_signup); //binding _firstnameBinding = this.SetBinding(() => EditFirstName.Text, () => Vm.FirstName); _lastnameBinding = this.SetBinding(() => EditLastName.Text, () => Vm.LastName); _usernameBinding = this.SetBinding(() => EditUserName.Text, () => Vm.UserName); _passwordBinding = this.SetBinding(() => EditPassword.Text, () => Vm.Password); _phonenumberBinding = this.SetBinding(() => EditPhoneNumber.Text, () => Vm.PhoneNumber); _startdateBinding = this.SetBinding(() => EditStartDate.Text, () => Vm.StartDate); //Handling TextChanged Event for Phonenumber section EditPhoneNumber.TextChanged += HandleTextChanged; //DatePickerDialog EditStartDate.Click += (sender, e) => { DateTime today = DateTime.Today; DatePickerDialog dialog = new DatePickerDialog(this, this, DateTime.Today.Year, DateTime.Today.Month, DateTime.Today.Day); dialog.DatePicker.DateTime = DateTime.Now; dialog.Show(); }; //Binding ButtonCommand CreateAccountButton.SetCommand("Click", Vm.CreateCommand); }
private void _discountDate_Click(object sender, EventArgs e) { DatePickerDialog datePicker = new DatePickerDialog(this); datePicker.DateSet += DatePicker_DateSet; datePicker.Show(); }
private void MaximumDateLayout() { /**************** **Maximum Date** ****************/ spaceAdder2 = new TextView(context); maxDate = new TextView(context); maxDate.Text = "Max Date"; maxDate.TextSize = 20; maxDate.Gravity = GravityFlags.Left; //maxDateButton maxDateButton = new Button(context); maxDateButton.Text = "1/12/2018"; maxDateButton.TextSize = 16; maxDateButton.SetBackgroundColor(Color.ParseColor("#8CD4CF")); maxDatePicker = new DatePickerDialog(context, MaxDateSetting, 2018, 12, 1); maxDateButton.Click += (object sender, EventArgs e) => { maxDatePicker.Show(); }; //Separator 1 underMaxSeparator = new SeparatorView(context, width * 2); underMaxSeparator.LayoutParameters = new ViewGroup.LayoutParams(width * 2, 5); underMaxSeparatorLayoutParam = new LinearLayout.LayoutParams(width * 2, 5); underMaxSeparatorLayoutParam.SetMargins(0, 20, 0, 0); }
private void ShowDT(object sender, bool reset) { if (reset) { calender = Calendar.GetInstance(Java.Util.TimeZone.Default); baseModel.Year = calender.Get(CalendarField.Year); baseModel.Month = calender.Get(CalendarField.Month) + 1; baseModel.Day = calender.Get(CalendarField.DayOfMonth); baseModel.Hour = calender.Get(CalendarField.HourOfDay); baseModel.Minute = calender.Get(CalendarField.Minute); } baseModel.CurrentView = false; if (sender == datePick) { datePickerDialog = new DatePickerDialog(this, OnDateShow, baseModel.Year, baseModel.Month - 1, baseModel.Day); datePickerDialog.Show(); } else if (sender == timePick) { timePickerDialog = new TimePickerDialog(this, OnTimeShow, baseModel.Hour, baseModel.Minute, true); if (baseModel.TimePickerBundler != null) { timePickerDialog.OnRestoreInstanceState(baseModel.TimePickerBundler); } timePickerDialog.Show(); } }
void Button_Click(object sender, EventArgs e) { var value = Value ?? DateTime.Today; var dialog = new DatePickerDialog(Context, this, value.Year, value.Month - 1, value.Day); dialog.Show(); }
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { var view = base.OnCreateView(inflater, container, savedInstanceState); var dateButton = view.FindViewById <Button>(Resource.Id.TaskReminderDate); var timeButton = view.FindViewById <Button>(Resource.Id.TaskReminderTime); dateButton.Click += (sender, args) => { var currentDate = DateTime.Parse(ViewModel.FullText, ViewModel.TextProvider.CurrentCulture); var dialog = new DatePickerDialog(Activity, Resource.Style.DatePickerDialogCustom, this, currentDate.Year, currentDate.Month - 1, currentDate.Day); dialog.DatePicker.SetMinDate(ViewModel.MinDate); dialog.Show(); }; timeButton.Click += (sender, args) => { var currentTime = DateTime.Parse(ViewModel.FullText, ViewModel.TextProvider.CurrentCulture); bool is24HourFormat = DateFormat.Is24HourFormat(Activity); var dialog = new TimePickerDialog(Activity, Resource.Style.TimePickerDialogCustom, this, currentTime.Hour, currentTime.Minute, is24HourFormat); dialog.Show(); }; return(view); }
public override Dialog OnCreateDialog(Bundle savedInstanceState) { DateTime currently = DateTime.Now; DatePickerDialog dialog = new DatePickerDialog(Activity, Resource.Style.MyTimePickerDialogTheme, this, currently.Year, currently.Month - 1, currently.Day); return(dialog); }
private void AppearDateDialog() { DatePickerDialog datePickerDialog = new DatePickerDialog(this); Android.Support.V7.App.AlertDialog datePickerAlertDialog = null; Android.Support.V7.App.AlertDialog.Builder builder = new Android.Support.V7.App.AlertDialog.Builder(this) .SetTitle("Invalid Date") .SetMessage("Too early to create an account. Please select an earlier date under 30 days.") .SetPositiveButton("Ok", (object s, Android.Content.DialogClickEventArgs dialogClickEventArgs) => { datePickerAlertDialog.Show(); }); datePickerAlertDialog = builder.Create(); datePickerDialog.DateSet += (s, e) => { if (e.Date > DateTime.Now.AddDays(30)) { datePickerAlertDialog.Show(); } else { ViewModel.ServiceStartDate = e.Date; DateButton.Text = e.Date.ToShortDateString(); } }; datePickerDialog.Show(); }
private void TextFechaDesdeEditText_Click(object sender, EventArgs e) { DatePickerDialog dateDialog = new DatePickerDialog(Activity, OnDateSetDesde, fechaReserva.Year, fechaReserva.Month - 1, fechaReserva.Day); dateDialog.DatePicker.MinDate = fechaReserva.Millisecond; dateDialog.Show(); }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); SetContentView(Resource.Layout.LoginActivity); var btnGoBack = FindViewById <Button>(Resource.Id.btnGoBack); btnGoBack.Click += delegate { this.Finish(); }; mGeneratorImage = new ImageGenerator(this); mDateEditText = FindViewById <EditText>(Resource.Id.txtDateEntered); mDisplayGeneratedImage = FindViewById <ImageView>(Resource.Id.imageGen); mGeneratorImage.SetIconSize(50, 50); mGeneratorImage.SetDateSize(30); mGeneratorImage.SetMonthSize(10); mGeneratorImage.SetDatePosition(42); mGeneratorImage.SetMonthPosition(14); mGeneratorImage.SetDateColor(Color.ParseColor("#3c6eaf")); mGeneratorImage.SetMonthColor(Color.White); mGeneratorImage.SetStorageToSDCard(true); mDateEditText.Click += delegate { mCurrentDate = Calendar.Instance; int mYear = mCurrentDate.Get(CalendarField.Year); int mMonth = mCurrentDate.Get(CalendarField.Month); int mDay = mCurrentDate.Get(CalendarField.DayOfMonth); DatePickerDialog mDate = new DatePickerDialog(this, this, mYear, mMonth, mDay); mDate.Show(); }; }
internal protected override void Open() { // Note: Month needs to be -1 since on Android months go from 0-11 // http://developer.android.com/reference/android/app/DatePickerDialog.OnDateSetListener.html#onDateSet(android.widget.DatePicker, int, int, int) _dialog = new DatePickerDialog( ContextHelper.Current, OnDateSet, Date.Year, Date.Month - 1, Date.Day ); //Removes title that is unnecessary as it is a duplicate -> http://stackoverflow.com/questions/33486643/remove-title-from-datepickerdialog _dialog.SetTitle(""); var minYearCalendar = Calendar.Instance; minYearCalendar.Set(MinYear.Year, MinYear.Month - 1, MinYear.Day, MinYear.Hour, MinYear.Minute, MinYear.Second); _dialog.DatePicker.MinDate = minYearCalendar.TimeInMillis; var maxYearCalendar = Calendar.Instance; maxYearCalendar.Set(MaxYear.Year, MaxYear.Month - 1, MaxYear.Day, MaxYear.Hour, MaxYear.Minute, MaxYear.Second); _dialog.DatePicker.MaxDate = maxYearCalendar.TimeInMillis; _dialog.DismissEvent += OnDismiss; _dialog.Show(); }
public override Dialog OnCreateDialog(Bundle savedInstanceState) { var currentDate = DateTime.Now; var dialog = new DatePickerDialog(Activity, this, currentDate.Year, currentDate.Month - 1, currentDate.Day); return(dialog); }