protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.BookmarksViewSample); _mapView = FindViewById <MapView>(Resource.Id.mapView); _mapView.Map = new Map(new Uri(_mapUrl[_mapIndex])); _bookmarksView = FindViewById <BookmarksView>(Resource.Id.bookmarksView); _bookmarksView.GeoView = _mapView; _addToObservableButton = FindViewById <Button>(Resource.Id.AddToObservableButton); _removeFromObservableButton = FindViewById <Button>(Resource.Id.RemoveFromObservableButton); _swapMapButton = FindViewById <Button>(Resource.Id.swapMapButton); _SetObservableButton = FindViewById <Button>(Resource.Id.setObservableListButton); _removeListButton = FindViewById <Button>(Resource.Id.removeListButton); _addToMapButton = FindViewById <Button>(Resource.Id.addToMapButton); _addToObservableButton.Click += AddToObservableButton_Click; _removeFromObservableButton.Click += RemoveFromObservableButton_Click; _swapMapButton.Click += SwitchMapButton_Click; _SetObservableButton.Click += ShowObservableList_Click; _removeListButton.Click += RemoveListButton_Click; _addToMapButton.Click += AddToMapButton_Click; InitializeLists(); }
public override void LoadView() { // Create the views. View = new UIView() { BackgroundColor = UIColor.White }; _myMapView = new MapView(); _myMapView.TranslatesAutoresizingMaskIntoConstraints = false; _bookmarksView = new BookmarksView(); _bookmarksView.GeoView = _myMapView; _showBookmarksButton = new UIBarButtonItem(UIBarButtonSystemItem.Bookmarks); // Note: this won't work if there's no navigation controller. NavigationItem.RightBarButtonItem = _showBookmarksButton; // Add the views. View.AddSubviews(_myMapView); // Lay out the views. NSLayoutConstraint.ActivateConstraints(new[] { _myMapView.TopAnchor.ConstraintEqualTo(View.SafeAreaLayoutGuide.TopAnchor), _myMapView.BottomAnchor.ConstraintEqualTo(View.BottomAnchor), _myMapView.LeadingAnchor.ConstraintEqualTo(View.LeadingAnchor), _myMapView.TrailingAnchor.ConstraintEqualTo(View.TrailingAnchor) }); }
public override void ViewDidLoad() { base.ViewDidLoad(); _sceneView = new SceneView() { Scene = new Scene(new Uri(_sceneUrl)), TranslatesAutoresizingMaskIntoConstraints = false }; configureSlides(); this.View.AddSubview(_sceneView); _bookmarksView = new BookmarksView() { GeoView = _sceneView, }; _bookmarksView.View.TranslatesAutoresizingMaskIntoConstraints = false; AddChildViewController(_bookmarksView); View.AddSubview(_bookmarksView.View); _sceneView.LeadingAnchor.ConstraintEqualTo(View.LeadingAnchor).Active = true; _sceneView.TrailingAnchor.ConstraintEqualTo(View.TrailingAnchor).Active = true; _sceneView.TopAnchor.ConstraintEqualTo(View.SafeAreaLayoutGuide.TopAnchor).Active = true; _sceneView.BottomAnchor.ConstraintEqualTo(View.CenterYAnchor).Active = true; _bookmarksView.View.LeadingAnchor.ConstraintEqualTo(View.LeadingAnchor).Active = true; _bookmarksView.View.TrailingAnchor.ConstraintEqualTo(View.TrailingAnchor).Active = true; _bookmarksView.View.TopAnchor.ConstraintEqualTo(View.CenterYAnchor).Active = true; _bookmarksView.View.BottomAnchor.ConstraintEqualTo(View.BottomAnchor).Active = true; }
public void GetBookmarks() { try { var iconPath = Path.Combine(Application.StartupPath, "Icons"); DirectoryInfo dir = new DirectoryInfo(iconPath); bookmarkImageList.Images.Clear(); foreach (var file in dir.GetFiles()) { bookmarkImageList.Images.Add(file.Name, Image.FromFile(file.FullName)); } List <BookmarkClass> bookmarks; var path = Path.Combine(Application.StartupPath, "Bookmarks.json"); if (File.Exists(path)) { var JSONData = File.ReadAllText(path); bookmarks = JsonConvert.DeserializeObject <List <BookmarkClass> >(JSONData); } else { bookmarks = new List <BookmarkClass>(); } BookmarksView.BeginUpdate(); BookmarksView.Nodes.Clear(); foreach (var item in bookmarks) { BookmarksView.Nodes.Add("", item.Title, bookmarkImageList.Images.IndexOfKey(item.Title + ".ico"), bookmarkImageList.Images.IndexOfKey(item.Title + ".ico")); } BookmarksView.EndUpdate(); } catch (Exception ex) { ThreadPool.QueueUserWorkItem(delegate { LogError(ex); }); } }
private void OnBookmarkClic() { BookmarksView view = Instantiate(pref.prefabBookmarksView); Window w = sys.NewWindow("Bookmarks", view.gameObject); w.Title = "Bookmarks"; w.Show(); }
private void SetSceneViewBinding_Click(object sender, RoutedEventArgs e) { MyMapView.Visibility = Visibility.Collapsed; MySceneView.Visibility = Visibility.Visible; Binding geoviewBinding = new Binding(); geoviewBinding.Source = MySceneView; BookmarksView.SetBinding(UI.Controls.BookmarksView.GeoViewProperty, geoviewBinding); }
public BookmarksPresenter(BookmarksView view, BookmarkRepository repository) { ContentView = view; ContentView.SetCommand( new RelayCommand(ReadBookmark), new RelayCommand(DownloadBookmark)); Repository = repository; }
private void SetSceneViewBinding_Click(object sender, EventArgs e) { MyMapView.IsVisible = false; MySceneView.IsVisible = true; Binding geoviewBinding = new Binding(); geoviewBinding.Source = MySceneView; BookmarksView.SetBinding(Esri.ArcGISRuntime.Toolkit.Xamarin.Forms.BookmarksView.GeoViewProperty, geoviewBinding); }
public override void ViewDidLoad() { base.ViewDidLoad(); _mapView = new MapView() { Map = new Map(new Uri(_mapUrl[0])), TranslatesAutoresizingMaskIntoConstraints = false }; View.AddSubview(_mapView); _bookmarksView = new BookmarksView() { GeoView = _mapView }; AddChildViewController(_bookmarksView); _bookmarksView.View.TranslatesAutoresizingMaskIntoConstraints = false; View.AddSubview(_bookmarksView.View); UIToolbar toolbar = new UIToolbar(); toolbar.TranslatesAutoresizingMaskIntoConstraints = false; View.AddSubview(toolbar); _AddItemButton = new UIBarButtonItem(UIBarButtonSystemItem.Add); _removeItemButton = new UIBarButtonItem(UIBarButtonSystemItem.Trash); _switchMapButton = new UIBarButtonItem(UIBarButtonSystemItem.FastForward); _setListObservableButton = new UIBarButtonItem("Set list", UIBarButtonItemStyle.Plain, ShowObservableList_Click); _clearListButton = new UIBarButtonItem("Clear list", UIBarButtonItemStyle.Plain, ClearList_Click); _addToMapBookmarksButton = new UIBarButtonItem(UIBarButtonSystemItem.Bookmarks); toolbar.Items = new[] { new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace), _setListObservableButton, _clearListButton, _AddItemButton, _removeItemButton, _addToMapBookmarksButton, _switchMapButton }; _AddItemButton.Clicked += AddToObservableButton_Click; _removeItemButton.Clicked += RemoveFromObservableButton_Click; _switchMapButton.Clicked += SwitchMapButton_Click; _addToMapBookmarksButton.Clicked += AddBookmarkToMap_Click; _mapView.LeadingAnchor.ConstraintEqualTo(View.LeadingAnchor).Active = true; _mapView.TrailingAnchor.ConstraintEqualTo(View.TrailingAnchor).Active = true; _mapView.TopAnchor.ConstraintEqualTo(View.SafeAreaLayoutGuide.TopAnchor).Active = true; _mapView.BottomAnchor.ConstraintEqualTo(View.CenterYAnchor).Active = true; _bookmarksView.View.LeadingAnchor.ConstraintEqualTo(View.LeadingAnchor).Active = true; _bookmarksView.View.TrailingAnchor.ConstraintEqualTo(View.TrailingAnchor).Active = true; _bookmarksView.View.TopAnchor.ConstraintEqualTo(View.CenterYAnchor).Active = true; _bookmarksView.View.BottomAnchor.ConstraintEqualTo(toolbar.TopAnchor).Active = true; toolbar.BottomAnchor.ConstraintEqualTo(View.SafeAreaLayoutGuide.BottomAnchor).Active = true; toolbar.LeadingAnchor.ConstraintEqualTo(View.LeadingAnchor).Active = true; toolbar.TrailingAnchor.ConstraintEqualTo(View.TrailingAnchor).Active = true; }
public void DisplayBookmarks() { GetAllBookmarksRequest request = new GetAllBookmarksRequest(); List <Bookmark> bookmarks = requestBus.ProcessRequest <GetAllBookmarksRequest, List <Bookmark> >(request); BookmarksViewModel viewModel = new BookmarksViewModel(bookmarks); BookmarksView view = new BookmarksView(viewModel); view.Display(); }
private void SetSceneViewBinding_Click(object sender, EventArgs e) { if (_viewContainer.Children.Contains(MySceneView) == false) { _viewContainer.Children.Add(MySceneView); } if (_viewContainer.Children.Contains(MyMapView)) { _viewContainer.Children.Remove(MyMapView); } Binding geoviewBinding = new Binding(); geoviewBinding.Source = MySceneView; BookmarksView.SetBinding(Esri.ArcGISRuntime.Toolkit.Xamarin.Forms.BookmarksView.GeoViewProperty, geoviewBinding); }