示例#1
0
        /// <summary>
        /// Performs all neccesary shutdown activities for this module
        /// </summary>
        private void Shutdown()
        {
            logger.Debug("Shutting down Player Tasks Module");

            // Shut down the player tasks controller
            this.playerTasksController.Shutdown();

            // Shutdown the view controller
            this.viewController.Shutdown();

            // Make sure we have saved all user data
            // Note that this is a little redundant given the AutoSave feature,
            // but it does help to make sure the user's data is really saved
            TasksUserData.SaveData(this.UserData, TasksUserData.Filename);
        }
示例#2
0
        public TasksController(IZoneService zoneService, IPlayerService playerService, TasksUserData userData, CompositionContainer container)
        {
            logger.Debug("Initializing Player Tasks Controller");
            this.zoneService   = zoneService;
            this.playerService = playerService;
            this.container     = container;
            this.isStopped     = false;

            this.CharacterName = this.playerService.CharacterName;
            this.UserData      = userData;
            this.PlayerTasks   = new ObservableCollection <PlayerTaskViewModel>();

            // Initialize all loaded tasks
            logger.Info("Initializing all loaded player tasks");
            foreach (var task in this.UserData.Tasks)
            {
                var taskVm = new PlayerTaskViewModel(task, zoneService, this, this.container);
                taskVm.OnNewCharacterDetected(this.CharacterName);
                this.PlayerTasks.Add(taskVm);
            }

            // Initialize refresh timers
            this.refreshTimer    = new Timer(this.Refresh);
            this.RefreshInterval = 125;
            this.CurrentMapID    = -1;

            logger.Info("Player Tasks Controller initialized");
        }