private Clock InitializeClock() { CreateDropDowns(); Clock c = new Clock(); if (dDL1.SelectedIndex == 0) c.setYear(-1); else c.setYear((DateTime.Now.Year + dDL1.SelectedIndex - 1)); if (dDL2.SelectedIndex == 0) c.setMonth(-1); else c.setMonth(dDL2.SelectedIndex); if (rB1.Checked) { if (dDL3.SelectedIndex == 0) c.setDay(-1); else c.setDay(dDL3.SelectedIndex); } else { if (dDL11.SelectedIndex == 0) c.setDay(-1); else c.setDay(39 + dDL11.SelectedIndex); } if (dDL4.SelectedIndex == 0) c.setHour(-1); else c.setHour(dDL4.SelectedIndex + dDL12.SelectedIndex * 12); if (dDL5.SelectedIndex == 0) c.setMinute(-1); else c.setMinute(dDL5.SelectedIndex - 1); if (dDL6.SelectedIndex == 0) c.setSecond(-1); else c.setSecond(dDL6.SelectedIndex - 1); return c; }
private Clock InitializeClock() { Clock c = new Clock(); if (DropDownList1.SelectedIndex == 0) c.setYear(-1); else c.setYear((DateTime.Now.Year + DropDownList1.SelectedIndex - 1)); if (DropDownList2.SelectedIndex == 0) c.setMonth(-1); else c.setMonth(DropDownList2.SelectedIndex); if (RadioButton1.Checked) { if (DropDownList3.SelectedIndex == 0) c.setDay(-1); else c.setDay(DropDownList3.SelectedIndex); } else { if (DropDownList11.SelectedIndex == 0) c.setDay(-1); else c.setDay(39 + DropDownList11.SelectedIndex); } if (DropDownList4.SelectedIndex == 0) c.setHour(-1); else c.setHour(((DropDownList4.SelectedIndex) % 12 + DropDownList12.SelectedIndex * 12) % 24); if (DropDownList5.SelectedIndex == 0) c.setMinute(-1); else c.setMinute(DropDownList5.SelectedIndex - 1); if (DropDownList6.SelectedIndex == 0) c.setSecond(-1); else c.setSecond(DropDownList6.SelectedIndex - 1); return c; }