public static void CleanUp(bool applicationIsClosing = false) { if (MapLayersViewModel != null) { MapLayersViewModel.CleanUp(); MapLayersViewModel = null; } MapInterActionHandler = null; MapLayersHandler = null;; MapControl = null; Coastline = null; MapWindowForm = null; if (MapLayersWindow != null) { MapLayersWindow = null; } ShapeFileAttributesWindow = null; GPXTracksLayer = null; GPXWaypointsLayer = null; if (applicationIsClosing) { TileProviders = null; } }
public static MapWindowForm OpenMapWindow(MainWindow ownerWindow, bool showCoastline = false) { MapWindowForm mwf = MapWindowForm.GetInstance(); if (mwf.Visibility == Visibility.Visible) { MapWindowForm.BringIntoView(); } else { MapWindowForm = mwf; MapWindowForm.LocationChanged += MapWindowForm_LocationChanged; MapWindowForm.Closing += MapWindowForm_Closing; MapWindowForm.Owner = ownerWindow; MapWindowForm.ParentWindow = ownerWindow; MapWindowForm.Show(); MapLayersHandler = MapWindowForm.MapLayersHandler; MapInterActionHandler = MapWindowForm.MapInterActionHandler; ShapefileAttributeTableManager.MapInterActionHandler = MapInterActionHandler; AOIManager.Setup(); MapControl = MapWindowForm.MapControl; if (!MapStateFileExists) { LoadCoastline(CoastLineFile); MapControl.TileProvider = tkTileProvider.ProviderNone; } else if (Coastline == null && showCoastline) { LoadCoastline(CoastLineFile); } } if (MapLayersWindow != null) { MapLayersWindow.Visibility = Visibility.Visible; MapLayersWindow.BringIntoView(); } if (ShapeFileAttributesWindow != null) { ShapeFileAttributesWindow.Visibility = Visibility.Visible; ShapeFileAttributesWindow.BringIntoView(); } MapLayersViewModel = new MapLayersViewModel(MapLayersHandler); return(mwf); }