/// <summary> /// Blank stack looks trivial but still needs to align text in the middle of the page /// So you can't just put a big label to show this message since labels should be /// located into proper location /// </summary> /// <returns>AlarmEmptyPageLayout</returns> private AlarmEmptyPageLayout CreateBlankStack() { /// Create a blan page layout blankLayout = new AlarmEmptyPageLayout(); /// Sets proper texts blankLayout.MainTitle = "No alarms"; blankLayout.Subline1 = "After you create alarms, they will"; blankLayout.Subline2 = "be shown here"; return(blankLayout); }
/// <summary> /// blank layout to show when no alarm available /// </summary> public AlarmListPage() { /// Title for this page Title = "Alarm"; /// Icon to be shown in the main tab Icon = "maintabbed/clock_tabs_ic_alarm.png"; alarmModel = new AlarmModel(); BindingContext = alarmModel; // Create alarmList UI whether or not there is a saved alarm record alarmListUI = new AlarmListUI(); // Create Blank page blankLayout = CreateBlankStack(); AlarmModel.PrintAll("In AlarmListPage(), Dictionary and list are loaded."); /// Needs to check alarm record dictionary availability blankLayout.IsVisible = (AlarmModel.ObservableAlarmList.Count == 0) ? true : false; alarmListUI.IsVisible = (AlarmModel.ObservableAlarmList.Count == 0) ? false : true; blankLayout.SetBinding(RelativeLayout.IsVisibleProperty, new Binding("Count", BindingMode.Default, new ItemCountToVisibilityConverter(), true, source: AlarmModel.ObservableAlarmList)); alarmListUI.SetBinding(StackLayout.IsVisibleProperty, new Binding("Count", BindingMode.Default, new ItemCountToVisibilityConverter(), false, source: AlarmModel.ObservableAlarmList)); StackLayout mainLayout = new StackLayout { HorizontalOptions = LayoutOptions.FillAndExpand, VerticalOptions = LayoutOptions.FillAndExpand, Spacing = 0, Children = { blankLayout, alarmListUI, } }; Content = mainLayout; }