/// <summary> /// Initializes a new instance of the <see cref="ZoneManager"/> class. /// </summary> /// <param name="mapControl">The map control.</param> /// <param name="MainWindowEx">The main window.</param> /// <param name="routeManger">The route manger.</param> public ZoneManager([CanBeNull] MapControl mapControl, [CanBeNull] Window MainWindowEx, [NotNull] RouteManager routeManger) { Assert.ArgumentNotNull(routeManger, "routeManger"); _mapControl = mapControl; _mainWindow = MainWindowEx; _routeManger = routeManger; _emptyZone = new ZoneViewModel(new Zone { Id = -1000 }, Enumerable.Empty <AdditionalRoomParameters>()) { ZoomLevel = Settings.Default.MapZoomLevel }; _timer = new Timer(15000) { AutoReset = false }; _timer.Elapsed += _timer_Elapsed; _timer.Start(); if (_mapControl != null) { _mapControl.RoadMapShowRequired += ShowRoadMap; _mapControl.RoomEditDialogRequired += ShowRoomEditDialog; _mapControl.NavigateToRoomRequired += NavigateToRoom; _mapControl.RoutesDialogShowRequired += (o, e) => _routeManger.ShowRoutesDialog(); } MapDownloader.UpgradeComplete += MapDownloader_UpgradeComplete; }
/// <summary> /// Initializes this plugins with a specified <see cref="MessageConveyor"/> and <see cref="RootModel"/>. /// </summary> /// <param name="initializationStatusModel">The initialization status model.</param> /// <param name="MainWindowEx">The main window.</param> public override void Initialize(InitializationStatusModel initializationStatusModel, Window MainWindowEx) { Assert.ArgumentNotNull(initializationStatusModel, "initializationStatusModel"); Assert.ArgumentNotNull(MainWindowEx, "MainWindowEx"); initializationStatusModel.CurrentPluginName = "Map"; initializationStatusModel.PluginInitializationStatus = "Initializing"; _routeManager = new RouteManager(MainWindowEx); _mapControl.RouteManager = _routeManager; _zoneManager = new ZoneManager(_mapControl, MainWindowEx, _routeManager); initializationStatusModel.PluginInitializationStatus = "Routes loading"; _routeManager.LoadRoutes(); Task.Factory.StartNew(() => { try { MapDownloader.DownloadMaps(); } catch (Exception) { } }); }