این صفحه هنوز ترجمه نشده است؛ نسخهٔ انگلیسی نمایش داده میشود.
IRI.Maptor.Samples.Wpf.HelloMap
The smallest complete Maptor WPF application: a window with a MapViewer, a base-map picker, a
scale bar and a coordinate panel. Read App.xaml and MainWindow.xaml.cs and you have seen the
whole startup path of every Maptor app.
What it shows
App.xaml— the MahApps.Metro and Maptor resource dictionaries a Maptor app merges.App.xaml.cs—Encoding.RegisterProvider, needed to read legacy code pages in shapefile.dbffiles.MainWindow.xaml—MapViewer,Scalebar,CoordinatePanelView, and aComboBoxoverMapProviders.MainWindow.xaml.cs— the four initialization steps below.
The essential code
var presenter = new HelloMapViewModel(); // 1. MapViewModelBase subclass
presenter.InitializeSettings( // 2. settings
ProxySettings.Default,
BaseMapSettings.Default,
new MapSettings { InitialExtent = BoundingBoxes.WebMercator_Europe },
GeneralSettings.Default);
await MapInitializationHelper.InitializeMapAsync(map, this, presenter); // 3. bind control + dialogs
DataContext = presenter;
presenter.SelectedMapProvider = TileMapProviderFactory.GoogleRoadMap; // 4. base map
public class HelloMapViewModel : MapViewModelBase { }
How to run
dotnet run --project samples/IRI.Maptor.Samples.Wpf.HelloMap
Next step: the WPF gallery adds one feature per page on top of exactly this skeleton.