예제 #1
0
        public MainPage()
        {
            FoundBeacon      = false;
            Title            = "Available Items";
            CurrentARViewId  = "0";
            beaconLocater    = DependencyService.Get <IBeaconLocater>();
            beaconCollection = new ObservableCollection <BeaconItem>();

            //Debug Button to start a AR View
            Button arButton = new Button {
                HorizontalOptions = LayoutOptions.Center,
                Text = "Debug ID " + debug
            };

            arButton.Clicked += (sender, e) => {
                arPage = new ARPage(debug);
                Navigation.PushAsync(arPage);
            };

            listView = new ListView {
                RowHeight = 100,
            };
            listView.ItemTemplate = new DataTemplate(typeof(BeaconCell));
            listView.ItemsSource  = beaconCollection;
            listView.ItemTapped  += (sender, e) => {
                BeaconFound(((BeaconItem)e.Item));
            };

            tableLayout = new StackLayout {
                VerticalOptions = LayoutOptions.FillAndExpand,
                Children        =
                {
                    listView
                }
            };

            searchingLabel = new Label {
                Text   = "Please get closer to a picture",
                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,
                    arButton
                }
            };

            Content = searchingLayout;
        }
예제 #2
0
 public void BeaconFound(BeaconItem item)
 {
     if (item.Minor >= 0 && item.Minor <= 3)
     {
         beaconLocater.PauseTracking();
         arPage = new ARPage(item.Minor.ToString());
         Navigation.PushAsync(arPage);
     }
 }