ResetMap() public method

public ResetMap ( ) : void
return void
Esempio n. 1
0
        public override void ViewDidLayoutSubviews()
        {
            base.ViewDidLayoutSubviews();

            // Call the function that creates the UI
            CreateLayout();

            // Set up AuthenticationManager
            UpdateAuthenticationManager();

            // Use the map from the view-model
            _mapViewModel.ResetMap();
        }
        public override void ViewDidLoad()
        {
            // Called on initial page load
            base.ViewDidLoad();

            // Call the function that creates the UI
            CreateLayout();

            // Set up the AuthenticationManager
            UpdateAuthenticationManager();

            // Use the map from the view-model
            _mapViewModel.ResetMap();
        }
Esempio n. 3
0
        private async void SegmentButtonClicked(object sender, EventArgs e)
        {
            // Get the segmented button control that raised the event
            var buttonControl = sender as UISegmentedControl;

            // Get the selected segment in the control
            var selectedSegmentId = buttonControl.SelectedSegment;

            // Execute the appropriate action for the control
            if (selectedSegmentId == 0)
            {
                // Show basemap choices
                ShowBasemapList();
            }
            else if (selectedSegmentId == 1)
            {
                // Create a new map
                _mapViewModel.ResetMap();
            }
            else if (selectedSegmentId == 2)
            {
                // Create a challenge request for portal credentials (OAuth credential request for arcgis.com)
                CredentialRequestInfo challengeRequest = new CredentialRequestInfo();

                // Use the OAuth implicit grant flow
                challengeRequest.GenerateTokenOptions = new GenerateTokenOptions
                {
                    TokenAuthenticationType = TokenAuthenticationType.OAuthImplicit
                };

                // Indicate the url (portal) to authenticate with (ArcGIS Online)
                challengeRequest.ServiceUri = new Uri("https://www.arcgis.com/sharing/rest");

                // Call GetCredentialAsync on the AuthenticationManager to invoke the challenge handler
                await AuthenticationManager.Current.GetCredentialAsync(challengeRequest, false);

                // Show the save map UI
                if (_mapInfoUI != null)
                {
                    return;
                }

                // Create a view to show map item info entry controls over the map view
                var ovBounds = _mapView.Bounds;
                ovBounds.Height = ovBounds.Height + 60;
                _mapInfoUI      = new SaveMapDialogOverlay(ovBounds, 0.75f, UIColor.White, _mapView.Map.Item);

                // Handle the OnMapInfoEntered event to get the info entered by the user
                _mapInfoUI.OnMapInfoEntered += MapItemInfoEntered;

                // Handle the cancel event when the user closes the dialog without choosing to save
                _mapInfoUI.OnCanceled += SaveCanceled;

                // Add the map item info UI view (will display semi-transparent over the map view)
                View.Add(_mapInfoUI);
            }

            // Unselect all segments (user might want to click the same control twice)
            buttonControl.SelectedSegment = -1;
        }
        public AuthorEditSaveMap()
        {
            InitializeComponent();

            // Get the view model (defined as a resource in the XAML)
            _mapViewModel = this.Resources["MapViewModel"] as MapViewModel;

            // Pass the map view to the map view model
            _mapViewModel.AppMapView = MyMapView;

            // Define a click handler for the Basemaps button (show the basemap choice list)
            BasemapsButton.Clicked += (s, e) => BasemapListBox.IsVisible = true;

            // Define a selection handler on the basemap list
            BasemapListBox.ItemTapped += OnBasemapsClicked;

            // Define a click handler for the Save button (show a form for entering portal item info)
            SaveMapButton.Clicked += ShowSaveMapDialog;

            // Define a click handler for the New button
            NewMapButton.Clicked += (s, e) => {
                _mapViewModel.ResetMap();
                BasemapListBox.SelectedItem = _mapViewModel.BasemapChoices[0];
            };

            // Set up the AuthenticationManager to challenge for ArcGIS Online credentials
            UpdateAuthenticationManager();

            // Change the style of the basemap list view for Android and UWP
            Device.OnPlatform(
                Android: () =>
            {
                // Black background on Android (transparent by default)
                BasemapListBox.BackgroundColor = Color.Black;
            },
                WinPhone: () =>
            {
                // Semi-transparent background on Windows with a small margin around the control
                BasemapListBox.BackgroundColor = Color.FromRgba(255, 255, 255, 0.3);
                BasemapListBox.Margin          = new Thickness(50);
            });

            Title = "Author, edit, and save maps to your portal";
        }
Esempio n. 5
0
 private void OnNewMapClicked(object sender, EventArgs e)
 {
     _mapViewModel.ResetMap();
 }