private void day_SelectedIndexChanged(object sender, EventArgs e) { if (!loadcomplete) { return; } try { nepdate = new NepDate() { Year = year.getSelectedItem().getdata <int>(), Month = month.getSelectedItem().getvalue <int>(), Day = day.getSelectedItem().getvalue <int>() }; engdate = NepDateConverter.NepToEng(nepdate); if (changed != null) { changed(this, EventArgs.Empty); } } catch (Exception ex) { } }
private void year_SelectedIndexChanged(object sender, EventArgs e) { if (!loadcomplete) { return; } try { day.Items.Clear(); for (var i = 1; i <= NepDateConverter.getMonthDays(year.getSelectedItem().getvalue <int>(), month.getSelectedItem().getvalue <int>()); i++) { day.addItem(i, i); } day.selectByValue(1); nepdate = new NepDate() { Year = year.getSelectedItem().getdata <int>(), Month = month.getSelectedItem().getvalue <int>(), Day = day.getSelectedItem().getvalue <int>() }; engdate = NepDateConverter.NepToEng(nepdate); if (changed != null) { changed(this, EventArgs.Empty); } } catch (Exception ex) { } }
private void NepSel_Load(object sender, EventArgs e) { foreach (var years in NepDateConverter.getAllYears()) { year.addItem(years.Value, years.Key); } foreach (var months in NepDateConverter.GetMonths()) { month.addItem(months.Value, months.Key); } nepdate = NepDateConverter.EngToNep(DateTime.Now); year.selectBydata(nepdate.Year); month.selectByValue(nepdate.Month); day.Items.Clear(); for (var i = 1; i <= NepDateConverter.getMonthDays(year.getSelectedItem().getvalue <int>(), month.getSelectedItem().getvalue <int>()); i++) { day.addItem(i, i); } day.selectByValue(nepdate.Day); loadcomplete = true; engdate = NepDateConverter.NepToEng(nepdate); }
public NepaliCalender() { InitializeComponent(); foreach (var item in NepDateConverter.getAllYears()) { year.Items.Add(new AdvancedCombobox.ComboBoxItem() { value = item.Key, data = item.Value }); } foreach (var item in NepDateConverter.GetMonths()) { month.Items.Add(new AdvancedCombobox.ComboBoxItem() { value = item.Key, data = item.Value }); } }
public void loadEnglishdate(DateTime dt) { if (!loadcomplete) { return; } engdate = dt; this.NepSel_Load(this, null); nepdate = NepDateConverter.EngToNep(DateTime.Now); year.selectBydata(nepdate.Year); month.selectByValue(nepdate.Month); day.Items.Clear(); for (var i = 1; i <= NepDateConverter.getMonthDays(year.getSelectedItem().getvalue <int>(), month.getSelectedItem().getvalue <int>()); i++) { day.addItem(i, i); } day.selectByValue(nepdate.Day); if (changed != null) { changed(this, EventArgs.Empty); } }