private async void RefreshUI() { Device.BeginInvokeOnMainThread(() => { var anythingToload = ChangeHandler.GetSemester(); if (anythingToload.semester > 0) { model = new DayViewModel("Wednesday", anythingToload.semester); viewModel = new FloatingActionButtonViewModel(Navigation); viewModel.AddDayLayOutToAbsoluteLayOut(listView); Content = viewModel.GetLayOut(); BindingContext = model; } else { model.Populate(); if (model.Count() == 0) { return; } viewModel.AddDayLayOutToAbsoluteLayOut(listView); Content = viewModel.GetLayOut(); BindingContext = model; } }); }
public MapPageCS() { model = new MapsNewViewModel(); ChangeHandler = new SemesterChangeHandler(); viewModel = new FloatingActionButtonViewModel(); viewModel.AddMapToAbsouluteLayOut(model.GetCustomMap()); Content = viewModel.GetLayOut(); Device.StartTimer(TimeSpan.FromSeconds(1), () => { Device.BeginInvokeOnMainThread(() => RefreshUI()); return(true); }); ToolbarItems.Add(new ToolbarItem("Semester 1", null, new Action(() => Semester1()), ToolbarItemOrder.Secondary, 0)); ToolbarItems.Add(new ToolbarItem("Semester 2", null, new Action(() => Semester2()), ToolbarItemOrder.Secondary, 0)); ToolbarItems.Add(new ToolbarItem("Settings", null, new Action(() => Settings()), ToolbarItemOrder.Secondary, 0)); }
/// <summary> /// Initializes a new instance of the <see cref="T:RUTimetable.Monday"/> class. /// </summary> public Wednesday() { InitializeComponent(); viewModel = new FloatingActionButtonViewModel(Navigation); ChangeHandler = new SemesterChangeHandler(); model = new DayViewModel("Wednesday", DateTime.UtcNow.Month > 6 ? 2 : 1); if (model.Count() == 0) { var contentPage = new StackLayout { HorizontalOptions = LayoutOptions.FillAndExpand, VerticalOptions = LayoutOptions.CenterAndExpand, Orientation = StackOrientation.Vertical, Children = { new Label { Text = "No Time table Yet or You are a Postgrad student", VerticalTextAlignment = TextAlignment.Center, HorizontalTextAlignment = TextAlignment.Center, VerticalOptions = LayoutOptions.FillAndExpand, HorizontalOptions = LayoutOptions.CenterAndExpand } } }; viewModel.AddContentPageToAbsoluteLayOut(contentPage); Content = viewModel.GetLayOut(); } else { viewModel.AddDayLayOutToAbsoluteLayOut(listView); Content = viewModel.GetLayOut(); BindingContext = model; } Device.StartTimer(TimeSpan.FromSeconds(1), () => { Device.BeginInvokeOnMainThread(() => RefreshUI()); return(true); }); }
public FloatingActionButton() { InitializeComponent(); BindingContext = viewModel = new FloatingActionButtonViewModel(); }