private void InvokeSecondAnwer(DayBase day) { try { MessageBox.Show(day.GetSecondAnwer(day.GetQuestion2()).ToString()); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
public MainMenuModel() { for (int i = 1; i < 26; i++) { try { DayBase dayclass = System.Activator.CreateInstance(Type.GetType(string.Format("{0}{1}", "Calendar.Day", i))) as DayBase; if (dayclass != null) { _commands.Add(new CommandHandler(() => { InvokeFirstAnwer(dayclass); }, string.Format("Get Day{0} Answer 1", i))); _commands.Add(new CommandHandler(() => { InvokeSecondAnwer(dayclass); }, string.Format("Get Day{0} Answer 2", i))); } } catch (Exception ex) { break; } } }