/// <summary> /// Display the floor levels based on which building the current viewpoint is over /// </summary> /// <returns>The floor levels.</returns> private async Task DisplayFloorLevelsAsync() { if (this.MapView.Map.LoadStatus == Esri.ArcGISRuntime.LoadStatus.Loaded) { try { var floorsViewModel = new FloorSelectorViewModel(); string[] tableItems = await floorsViewModel.GetFloorsInVisibleAreaAsync(this.MapView); this.InvokeOnMainThread(() => { // Only show the floors tableview if the buildings in view have more than one floor if (tableItems.Count() > 1) { // Show the tableview and populate it FloorsTableView.Hidden = false; var tableSource = new FloorsTableSource(tableItems); tableSource.TableRowSelected += this.FloorsTableSource_TableRowSelected; FloorsTableView.Source = tableSource; FloorsTableView.ReloadData(); // Set height constraint based on content inside table HeightConstraint.Constant = FloorsTableView.ContentSize.Height; if (string.IsNullOrEmpty(this.ViewModel.SelectedFloorLevel) || !tableItems.Contains(this.ViewModel.SelectedFloorLevel)) { ViewModel.SelectedFloorLevel = MapViewModel.DefaultFloorLevel; } var selectedFloorNSIndex = GetTableViewRowIndex(ViewModel.SelectedFloorLevel, tableItems, 0); FloorsTableView.SelectRow(selectedFloorNSIndex, false, UITableViewScrollPosition.None); // Turn layers on. If there is no floor selected, first floor will be displayed by default this.ViewModel.SetFloorVisibility(true); } else if (tableItems.Count() == 1) { this.DismissFloorsTableView(); ViewModel.SelectedFloorLevel = tableItems[0]; // Turn layers on. If there is no floor selected, first floor will be displayed by default this.ViewModel.SetFloorVisibility(true); } else { this.DismissFloorsTableView(); } }); } catch { this.DismissFloorsTableView(); } } }
void ReleaseDesignerOutlets() { if (AutosuggestionsTableView != null) { AutosuggestionsTableView.Dispose(); AutosuggestionsTableView = null; } if (ButtonBottomConstraint != null) { ButtonBottomConstraint.Dispose(); ButtonBottomConstraint = null; } if (ContactCardView != null) { ContactCardView.Dispose(); ContactCardView = null; } if (CurrentLocationButton != null) { CurrentLocationButton.Dispose(); CurrentLocationButton = null; } if (DirectionsButton != null) { DirectionsButton.Dispose(); DirectionsButton = null; } if (FloorPickerBottomConstraint != null) { FloorPickerBottomConstraint.Dispose(); FloorPickerBottomConstraint = null; } if (FloorsTableView != null) { FloorsTableView.Dispose(); FloorsTableView = null; } if (HeightConstraint != null) { HeightConstraint.Dispose(); HeightConstraint = null; } if (HomeButton != null) { HomeButton.Dispose(); HomeButton = null; } if (LocationSearchBar != null) { LocationSearchBar.Dispose(); LocationSearchBar = null; } if (MainLabel != null) { MainLabel.Dispose(); MainLabel = null; } if (MapView != null) { MapView.Dispose(); MapView = null; } if (RouteCard != null) { RouteCard.Dispose(); RouteCard = null; } if (RouteTableView != null) { RouteTableView.Dispose(); RouteTableView = null; } if (SearchToolbar != null) { SearchToolbar.Dispose(); SearchToolbar = null; } if (SecondaryLabel != null) { SecondaryLabel.Dispose(); SecondaryLabel = null; } if (SettingsButton != null) { SettingsButton.Dispose(); SettingsButton = null; } if (WalkTimeLabel != null) { WalkTimeLabel.Dispose(); WalkTimeLabel = null; } }