Ejemplo n.º 1
0
        public PlayerMarkersViewModel(TaskTrackerViewModel taskTrackerVm,
                                      MapUserData userData,
                                      PlayerTasksFactory playerTaskFactory,
                                      IPlayerTasksController tasksController,
                                      IZoneService zoneService,
                                      IPlayerService playerService)
        {
            this.taskTrackerVm     = taskTrackerVm;
            this.playerTaskFactory = playerTaskFactory;
            this.tasksController   = tasksController;
            this.zoneService       = zoneService;
            this.playerService     = playerService;
            this.userData          = userData;

            this.PlayerMarkers = new ObservableCollection <PlayerMarkerViewModel>();

            this.playerTasksCollection = (ObservableCollection <PlayerTaskViewModel>) this.taskTrackerVm.PlayerTasks.Source;
            foreach (var task in this.playerTasksCollection)
            {
                task.PropertyChanged += Task_PropertyChanged;
                if (task.HasContinentLocation)
                {
                    this.PlayerMarkers.Add(new PlayerMarkerViewModel(task, this.zoneService, this.playerService));
                }
            }
            this.playerTasksCollection.CollectionChanged += PlayerTasksCollection_CollectionChanged;

            this.InitializeTemplates();
            this.PlayerMarkers.CollectionChanged += PlayerMarkers_CollectionChanged;
        }
Ejemplo n.º 2
0
        public PlayerMarkersViewModel(TaskTrackerViewModel taskTrackerVm,
                                      MapUserData userData,
                                      PlayerTasksFactory playerTaskFactory,
                                      IPlayerTasksController tasksController,
                                      IZoneService zoneService,
                                      IPlayerService playerService)
        {
            this.taskTrackerVm     = taskTrackerVm;
            this.playerTaskFactory = playerTaskFactory;
            this.tasksController   = tasksController;
            this.zoneService       = zoneService;
            this.playerService     = playerService;
            this.userData          = userData;

            this.PlayerMarkers = new ObservableCollection <PlayerMarkerViewModel>();

            if (this.playerService.HasValidMapId)
            {
                var continent = this.zoneService.GetContinentByMap(this.playerService.MapId);
                this.currentContinentId = continent.Id;
            }
            else
            {
                this.currentContinentId = 1;
            }

            this.playerTasksCollection = this.tasksController.PlayerTasks;
            foreach (var task in this.playerTasksCollection)
            {
                task.PropertyChanged += Task_PropertyChanged;
                if (task.HasContinentLocation)
                {
                    this.PlayerMarkers.Add(new PlayerMarkerViewModel(task, this.userData, this.currentContinentId, this.zoneService, this.playerService));
                }
            }
            this.playerTasksCollection.CollectionChanged += PlayerTasksCollection_CollectionChanged;

            this.InitializeTemplates();
            this.PlayerMarkers.CollectionChanged += PlayerMarkers_CollectionChanged;

            this.ToggleCategoryVisibiltyCommand = new DelegateCommand <string>(this.ToggleCategoryVisibility);
        }