/// <summary> /// Static get instace method to get proper page /// </summary> /// <param name="page">The page to push</param> /// <seealso cref="AlarmPages"> /// <param name="page">Parameter to be passed to the page. This can be null</param> /// <seealso cref="Object"> /// <returns>Returns requested Page object</returns> public static Page GetInstance(AlarmPages page, Object o = null) { switch (page) { case AlarmPages.ListPage: return(AlarmPageController.alarmListPage ?? (alarmListPage = new AlarmListPage())); case AlarmPages.EditPage: // parameter 'o' is AlarmRecord object to show in AlarmEditPage. // 1. Copy values to AlarmModel.BindableAlarmRecord AlarmModel.BindableAlarmRecord.DeepCopy((AlarmRecord)o); // 2. Apply values to EditPage (at first, create UIs. next time, just show it) alarmEditPage?.Update((AlarmRecord)o); return(AlarmPageController.alarmEditPage ?? (alarmEditPage = new AlarmEditPage((AlarmRecord)o))); case AlarmPages.TypePage: alarmTypePage?.Update(); return(AlarmPageController.alarmTypePage ?? (alarmTypePage = new AlarmTypePage())); case AlarmPages.RepeatPage: alarmRepeatPage?.Update(); return(AlarmPageController.alarmRepeatPage ?? (alarmRepeatPage = new AlarmRepeatPage())); case AlarmPages.TonePage: alarmTonePage?.Update(); return(AlarmPageController.alarmTonePage ?? (alarmTonePage = new AlarmTonePage())); case AlarmPages.DeletePage: return(AlarmPageController.alarmDeletePage ?? (alarmDeletePage = new AlarmDeletePage())); default: return(null); } }
public static Page GetInstance(AlarmPages page, Object o = null) { switch (page) { case AlarmPages.MainPage: return(AlarmPageController.alarmMainPage ?? (alarmMainPage = new MainPage(o as MainPageModel))); case AlarmPages.EditPage: // parameter 'o' is AlarmRecord object to show in AlarmEditPage. // 1. Copy values to AlarmModel.BindableAlarmRecord AlarmModel.BindableAlarmRecord.DeepCopy((AlarmRecord)o); // 2. Apply values to EditPage (at first, create UI. next time, just show it) alarmEditPage?.Update((AlarmRecord)o); return(AlarmPageController.alarmEditPage ?? (alarmEditPage = new AlarmEditPage(o as AlarmRecord))); case AlarmPages.SavePoupPage: return(AlarmPageController.savePopupPage ?? (savePopupPage = new SavePopupPage(o as AlarmRecord))); default: return(null); } }