public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { var dlg = inflater.Inflate(Resource.Layout.layoutfilterDate, container, false); LinearLayout lnaboutus = dlg.FindViewById <LinearLayout>(Resource.Id.filterdatelinearlayout); lnaboutus.SetBackgroundResource(Resource.Drawable.dialog_fragment_round); var font = Typeface.CreateFromAsset(ctx.Assets, "Estedad.ttf"); TextView filterdatetxtviewcaption = dlg.FindViewById <TextView>(Resource.Id.filterdatetxtviewcaption); filterdatetxtviewcaption.Typeface = font; Button filterdatetxtnowday = dlg.FindViewById <Button>(Resource.Id.filterdatetxtnowday); filterdatetxtnowday.Typeface = font; filterdatetxtnowday.Click += delegate { //امروز string now = PersianDate(DateTime.Now); OnGetDateEvent.Invoke(this, new GetdateEvent(now)); Dismiss(); }; Button filterdatebtntommorow = dlg.FindViewById <Button>(Resource.Id.filterdatebtntommorow); filterdatebtntommorow.Typeface = font; filterdatebtntommorow.Click += delegate { //فردا var today = DateTime.Now; var tomorrow = today.AddDays(1); string tomm = PersianDate(tomorrow); OnGetDateEvent.Invoke(this, new GetdateEvent(tomm)); Dismiss(); }; filterdatebtncalendar = dlg.FindViewById <Button>(Resource.Id.filterdatebtncalendar); filterdatebtncalendar.Typeface = font; filterdatebtncalendar.Click += delegate { Com.Mohamadamin.Persianmaterialdatetimepicker.Date.DatePickerDialog p = new Com.Mohamadamin.Persianmaterialdatetimepicker.Date.DatePickerDialog(); Com.Mohamadamin.Persianmaterialdatetimepicker.Date.DatePickerDialog d = Com.Mohamadamin.Persianmaterialdatetimepicker.Date.DatePickerDialog.NewInstance(this, p.SelectedDay.Year, p.SelectedDay.Month, p.SelectedDay.Day); d.Show(FragmentManager, "ebrahimdatepicker"); }; return(dlg); }
public void OnDateSet(Com.Mohamadamin.Persianmaterialdatetimepicker.Date.DatePickerDialog p0, int p1, int p2, int p3) { int month = p2 + 1; string Month = string.Empty; if (month == 1) { Month = "فروردین"; } if (month == 2) { Month = "اردیبهشت"; } if (month == 3) { Month = "خرداد"; } if (month == 4) { Month = "تیر"; } if (month == 5) { Month = "مرداد"; } if (month == 6) { Month = "شهریور"; } if (month == 7) { Month = "مهر"; } if (month == 8) { Month = "آبان"; } if (month == 9) { Month = "آذر"; } if (month == 10) { Month = "دی"; } if (month == 11) { Month = "بهمن"; } if (month == 12) { Month = "اسفند"; } string year = p1.ToString(); string removeonechar = year.Remove(0, 2); string persiandate = p3.ToString() + "" + Month + removeonechar; OnGetDateEvent.Invoke(this, new GetdateEvent(persiandate)); Dismiss(); }