ArcGISRuntime.WPF.Samples.ManageBookmarks.ManageBookmarks.ButtonAddDone_Click C# (CSharp) Метод

ButtonAddDone_Click() приватный метод

private ButtonAddDone_Click ( object sender, System e ) : void
sender object
e System
Результат void
        private void ButtonAddDone_Click(object sender, System.Windows.RoutedEventArgs e)
        {
            // Get the name from the text field
            var name = TextBoxBookmarkName.Text;

            // Exit if the name is empty
            if (string.IsNullOrEmpty(name))
                return;

            // Check to see if there is a bookmark with same name
            bool doesNameExist = MyMapView.Map.Bookmarks.Any(b => b.Name == name);
            if (doesNameExist)
                return;

            // Create a new bookmark
            Bookmark myBookmark = new Bookmark();
            myBookmark.Name = name;

            // Get the current viewpoint from map and assign it to bookmark
            myBookmark.Viewpoint = MyMapView.GetCurrentViewpoint(ViewpointType.BoundingGeometry);
            
            // Add the bookmark to bookmark collection of the map
            MyMapView.Map.Bookmarks.Add(myBookmark);

            // Add the bookmark to the list of choices in the combo box
            bookmarkChooser.Items.Insert(bookmarkChooser.Items.Count, myBookmark);

            // Set the newly added bookmark to be the one selected in the combo box
            bookmarkChooser.SelectedItem = myBookmark;

            // Hide the controls to add a bookmark
            BorderAddBookmark.Visibility = System.Windows.Visibility.Hidden;
            ButtonAddBookmark.Visibility = System.Windows.Visibility.Visible;
        }
    }