public MainPage() { Title = "Available Beacons"; trackingPage = new TrackingPage(); listView = new ListView { RowHeight = 100, }; listView.ItemTemplate = new DataTemplate(typeof(BeaconCell)); beaconLocater = DependencyService.Get <IBeaconLocater>(); beaconCollection = new ObservableCollection <BeaconItem>(); listView.ItemsSource = beaconCollection; var trackingButton = new Button { Text = "Start Tracking", HorizontalOptions = LayoutOptions.Center }; trackingButton.Clicked += (sender, args) => { Navigation.PushAsync(trackingPage); }; tableLayout = new StackLayout { VerticalOptions = LayoutOptions.FillAndExpand, Children = { trackingButton, listView } }; searchingLabel = new Label { Text = "Searching for beacons", VerticalTextAlignment = TextAlignment.Center, HorizontalTextAlignment = TextAlignment.Center }; spinner = new ActivityIndicator { IsRunning = true, Color = Color.Gray, }; searchingLayout = new StackLayout { VerticalOptions = LayoutOptions.Center, HorizontalOptions = LayoutOptions.Center, Children = { spinner, searchingLabel } }; Content = searchingLayout; }
public MainPage() { Title = "Available Beacons"; trackingPage = new TrackingPage (); listView = new ListView { RowHeight = 100, }; listView.ItemTemplate = new DataTemplate (typeof(BeaconCell)); beaconLocater = DependencyService.Get<IBeaconLocater> (); beaconCollection = new ObservableCollection<BeaconItem> (); listView.ItemsSource = beaconCollection; var trackingButton = new Button { Text = "Start Tracking", HorizontalOptions = LayoutOptions.Center }; trackingButton.Clicked += (sender, args) => { Navigation.PushAsync(trackingPage); }; tableLayout = new StackLayout { VerticalOptions = LayoutOptions.FillAndExpand, Children = {trackingButton, listView} }; searchingLabel = new Label { Text = "Searching for beacons", YAlign = TextAlignment.Center, XAlign = TextAlignment.Center }; spinner = new ActivityIndicator { IsRunning = true, Color = Color.Gray, }; searchingLayout = new StackLayout { VerticalOptions = LayoutOptions.Center, HorizontalOptions = LayoutOptions.Center, Children = {spinner, searchingLabel} }; Content = searchingLayout; }