Exemplo n.º 1
0
        /// <summary>
        /// Default constructor
        /// </summary>
        /// <param name="zoneItem">The zone item/point's information</param>
        /// <param name="userSettings">User settings</param>
        public ZoneItemViewModel(ZoneItem zoneItem, IPlayerService playerService, ZoneCompletionSettings userSettings)
        {
            this.DistanceFromPlayer            = -1;
            this.ItemModel                     = zoneItem;
            this.playerService                 = playerService;
            this.userSettings                  = userSettings;
            this.userSettings.PropertyChanged += (o, e) => this.RefreshVisibility();

            // Set up handling for collection changed events on the unlocked zone items collections
            foreach (CharacterZoneItems charItems in this.userSettings.UnlockedZoneItems)
            {
                charItems.ZoneItems.CollectionChanged += UnlockedZoneItems_CollectionChanged;
            }
            this.userSettings.UnlockedZoneItems.CollectionChanged += (o, e) =>
            {
                if (e.Action == NotifyCollectionChangedAction.Add)
                {
                    foreach (CharacterZoneItems itemAdded in e.NewItems)
                    {
                        itemAdded.ZoneItems.CollectionChanged += UnlockedZoneItems_CollectionChanged;
                    }
                }
            };
            this.userSettings.UnlockedZoneItems.CollectionChanged += UnlockedZoneItems_CollectionChanged;

            this.RefreshVisibility();
        }
Exemplo n.º 2
0
        /// <summary>
        /// Default constructor
        /// </summary>
        public ApplicationController()
        {
            // Create services
            logger.Debug("Creating services");
            this.EventsService    = new EventsService();
            this.PlayerService    = new PlayerService();
            this.SystemService    = new SystemService();
            this.ZoneService      = new ZoneService();
            this.DungeonsService  = new DungeonsService();
            this.WvWService       = new WvWService();
            this.GuildService     = new GuildService();
            this.TeamspeakService = new TeamspeakService();
            this.CommerceService  = new CommerceService();

            // Create ZoneName view model for the Zone Completion Assistant
            this.ZoneName = new ZoneNameViewModel();

            // Create WvWMap view model for the WvW Tracker
            this.WvWMap = new WvWMapViewModel();

            // Load user settings
            logger.Debug("Loading event user settings");
            this.EventSettings = EventSettings.LoadSettings(EventSettings.Filename);
            if (this.EventSettings == null)
            {
                this.EventSettings = new EventSettings();
            }

            logger.Debug("Loading zone completion assistant user settings");
            this.ZoneCompletionSettings = ZoneCompletionSettings.LoadSettings(ZoneCompletionSettings.Filename);
            if (this.ZoneCompletionSettings == null)
            {
                this.ZoneCompletionSettings = new ZoneCompletionSettings();
            }

            logger.Debug("Loading dungeon user settings");
            this.DungeonSettings = DungeonSettings.LoadSettings(DungeonSettings.Filename);
            if (this.DungeonSettings == null)
            {
                this.DungeonSettings = new DungeonSettings();
            }

            logger.Debug("Loading wvw user settings");
            this.WvWSettings = WvWSettings.LoadSettings(WvWSettings.Filename);
            if (this.WvWSettings == null)
            {
                this.WvWSettings = new WvWSettings();
            }

            logger.Debug("Loading teamspeak settings");
            this.TeamspeakSettings = TeamspeakSettings.LoadSettings(TeamspeakSettings.Filename);
            if (this.TeamspeakSettings == null)
            {
                this.TeamspeakSettings = new TeamspeakSettings();
            }

            logger.Debug("Loading commerce settings");
            this.CommerceSettings = CommerceSettings.LoadSettings(CommerceSettings.Filename);
            if (this.CommerceSettings == null)
            {
                this.CommerceSettings = new CommerceSettings();
            }

            // Enable autosave on the user settings
            logger.Debug("Enabling autosave of user settings");
            this.EventSettings.EnableAutoSave();
            this.ZoneCompletionSettings.EnableAutoSave();
            this.DungeonSettings.EnableAutoSave();
            this.WvWSettings.EnableAutoSave();
            this.TeamspeakSettings.EnableAutoSave();
            this.CommerceSettings.EnableAutoSave();

            // Create the controllers
            logger.Debug("Creating browser controller");
            this.BrowserController = new BrowserController();

            logger.Debug("Creating events controller");
            this.EventsController = new EventsController(this.EventsService, this.EventSettings);
            this.EventsController.Start(); // Get it started for event notifications

            logger.Debug("Creating zone completion assistant controller");
            this.ZoneCompletionController = new ZoneCompletionController(this.ZoneService, this.PlayerService, this.SystemService, this.ZoneName, this.ZoneCompletionSettings);

            logger.Debug("Creating dungeons controller");
            this.DungeonsController = new DungeonsController(this.DungeonsService, this.BrowserController, this.DungeonSettings);

            logger.Debug("Creating wvw controller");
            this.WvWController = new WvWController(this.WvWService, this.PlayerService, this.GuildService, this.WvWMap, this.WvWSettings);
            this.WvWController.Start(); // Get it started for wvw notifications

            logger.Debug("Creating commerce controller");
            this.CommerceController = new CommerceController(this.CommerceService, this.CommerceSettings);
            this.CommerceController.Start(); // Get it started for price-watch notifications

            // Create the event notifications view
            logger.Debug("Initializing event notifications");
            this.eventNotificationsView = new EventNotificationWindow(this.EventsController);
            this.eventNotificationsView.Show(); // Transparent window, just go ahead and show it

            // Create the wvw notifications view
            logger.Debug("Initializing WvW notifications");
            this.wvwNotificationsView = new WvWNotificationWindow(this.WvWController);
            this.wvwNotificationsView.Show(); // Transparent window, just go ahead and show it

            logger.Debug("Initializing price notifications");
            this.priceNotificationsView = new PriceNotificationWindow(this.CommerceController);
            this.priceNotificationsView.Show(); // Transparent window, just go ahead and show it

            // Initialize the menu items
            logger.Debug("Initializing application menu items");
            this.BuildMenuItems();

            logger.Info("Application controller initialized");
        }
Exemplo n.º 3
0
        /// <summary>
        /// Default constructor
        /// </summary>
        /// <param name="zoneService">The zone service</param>
        /// <param name="playerService">The player service</param>
        /// <param name="systemService">The system service</param>
        /// <param name="zoneNameObject">Zone name viewmodel object</param>
        /// <param name="userSettings">User settings</param>
        public ZoneCompletionController(IZoneService zoneService, IPlayerService playerService, ISystemService systemService, IHasZoneName zoneNameObject, ZoneCompletionSettings userSettings)
        {
            logger.Debug("Initializing Zone Completion Controller");
            this.zoneService    = zoneService;
            this.playerService  = playerService;
            this.systemService  = systemService;
            this.zoneNameObject = zoneNameObject;

            this.UserSettings = userSettings;

            // Initialize refresh timers
            this.zoneRefreshTimer          = new Timer(this.RefreshZone);
            this.ZoneRefreshInterval       = 1000;
            this.itemLocationsRefreshTimer = new Timer(this.RefreshLocations);
            this.LocationsRefreshInterval  = 250; // TODO: Tweak this until we get good performance without sucking up the CPU

            this.startCallCount = 0;
            this.CurrentMapID   = -1;
            logger.Info("Zone Completion Controller initialized");
        }