/// <summary> /// Default constructor /// </summary> /// <param name="path"></param> /// <param name="userData"></param> public PathViewModel(DungeonPath path, IDungeonsController dungeonController, IWebBrowserController browserController, DungeonsUserData userData) { this.PathModel = path; this.userData = userData; this.dungeonController = dungeonController; this.browserController = browserController; this.OpenGuideCommand = new DelegateCommand(this.OpenGuide); this.SetAsActivePathCommand = new DelegateCommand(this.SetAsActivePath); this.RemoveTimesCommand = new DelegateCommand <object>(this.RemoveCompletionTimes); // Initialize the path completion data in the UserData object var existingPathCompletionData = this.userData.PathCompletionData.FirstOrDefault(pt => pt.PathID == this.PathId); if (existingPathCompletionData != null) { existingPathCompletionData.PathData = this; } else { this.userData.PathCompletionData.Add(new PathCompletionData(this)); } this.CompletionTimes.CollectionChanged += (o, e) => { this.OnPropertyChanged(() => this.BestCompletionTime); this.OnPropertyChanged(() => this.AverageCompletionTime); }; }
/// <summary> /// Default constructor /// </summary> /// <param name="userData">The dungeons user data</param> public DungeonTimerViewModel(DungeonsUserData userData) { this.UserData = userData; this.stopWatch = new Stopwatch(); this.timer = new Timer(TimerInterval.TotalMilliseconds); this.timer.AutoReset = true; this.timer.Elapsed += (o, e) => Threading.BeginInvokeOnUI(() => this.TimerValue = this.stopWatch.Elapsed); this.StartTimerCommand = new DelegateCommand(this.StartTimer); this.PauseTimerCommand = new DelegateCommand(this.PauseTimer); this.StopTimerCommand = new DelegateCommand(this.StopTimer); this.OpenSettingsCommand = new DelegateCommand(() => Commands.OpenDungeonSettingsCommand.Execute(null)); }
public DungeonSettingsViewModel(DungeonsUserData userData, IDungeonsController controller) { this.UserData = userData; this.controller = controller; this.ResetAllTimesCommand = new DelegateCommand(this.ResetAllBestTimes); this.Dungeons = new ObservableCollection<DungeonViewModel>(); foreach (var dungeon in this.controller.Dungeons) { // Exclude fractals if (dungeon.DungeonId != DungeonID.FractalsOfTheMists) this.Dungeons.Add(dungeon); } }
/// <summary> /// Default constructor /// </summary> /// <param name="dungeon">The dungeon information</param> /// <param name="dungeonsController">The dungeons controller</param> /// <param name="browserController">The browser controller object for displaying wiki information</param> /// <param name="userData">The dungeon user settings</param> public DungeonViewModel(GW2PAO.API.Data.Entities.Dungeon dungeon, IDungeonsController dungeonsController, IWebBrowserController browserController, DungeonsUserData userData) { this.DungeonModel = dungeon; this.userData = userData; // Initialize the path view models this.Paths = new ObservableCollection <PathViewModel>(); foreach (var path in this.DungeonModel.Paths) { this.Paths.Add(new PathViewModel(path, dungeonsController, browserController, this.userData)); } this.RefreshVisibility(); this.userData.PropertyChanged += (o, e) => this.RefreshVisibility(); this.userData.HiddenDungeons.CollectionChanged += (o, e) => this.RefreshVisibility(); }
public DungeonSettingsViewModel(DungeonsUserData userData, IDungeonsController controller) { this.UserData = userData; this.controller = controller; this.ResetAllTimesCommand = new DelegateCommand(this.ResetAllBestTimes); this.Dungeons = new ObservableCollection <DungeonViewModel>(); foreach (var dungeon in this.controller.Dungeons) { // Exclude fractals if (dungeon.DungeonId != DungeonID.FractalsOfTheMists) { this.Dungeons.Add(dungeon); } } }
/// <summary> /// Default constructor /// </summary> /// <param name="path"></param> /// <param name="userData"></param> public PathViewModel(DungeonPath path, IDungeonsController dungeonController, IWebBrowserController browserController, DungeonsUserData userData) { this.PathModel = path; this.userData = userData; this.dungeonController = dungeonController; this.browserController = browserController; this.OpenGuideCommand = new DelegateCommand(this.OpenGuide); this.SetAsActivePathCommand = new DelegateCommand(this.SetAsActivePath); this.RemoveTimesCommand = new DelegateCommand<object>(this.RemoveCompletionTimes); // Initialize the path completion data in the UserData object var existingPathCompletionData = this.userData.PathCompletionData.FirstOrDefault(pt => pt.PathID == this.PathId); if (existingPathCompletionData != null) { existingPathCompletionData.PathData = this; } else { this.userData.PathCompletionData.Add(new PathCompletionData(this)); } this.CompletionTimes.CollectionChanged += (o, e) => { this.OnPropertyChanged(() => this.BestCompletionTime); this.OnPropertyChanged(() => this.AverageCompletionTime); }; }
/// <summary> /// Default constructor /// </summary> /// <param name="dungeon">The dungeon information</param> /// <param name="dungeonsController">The dungeons controller</param> /// <param name="browserController">The browser controller object for displaying wiki information</param> /// <param name="userData">The dungeon user settings</param> public DungeonViewModel(GW2PAO.API.Data.Entities.Dungeon dungeon, IDungeonsController dungeonsController, IWebBrowserController browserController, DungeonsUserData userData) { this.DungeonModel = dungeon; this.userData = userData; // Initialize the path view models this.Paths = new ObservableCollection<PathViewModel>(); foreach (var path in this.DungeonModel.Paths) { this.Paths.Add(new PathViewModel(path, dungeonsController, browserController, this.userData)); } this.RefreshVisibility(); this.userData.PropertyChanged += (o, e) => this.RefreshVisibility(); this.userData.HiddenDungeons.CollectionChanged += (o, e) => this.RefreshVisibility(); }
public DungeonsController(IDungeonsService dungeonsService, IZoneService zoneService, IPlayerService playerService, IWebBrowserController browserController, DungeonsUserData userData) { logger.Debug("Initializing Dungeons Controller"); this.dungeonsService = dungeonsService; this.zoneService = zoneService; this.playerService = playerService; this.browserController = browserController; this.userData = userData; this.isStopped = false; this.tickStopped = false; this.currentRunTimeSaved = false; // Initialize the dungeon timer view model this.DungeonTimerData = new DungeonTimerViewModel(userData); // Initialize the refresh timer this.dungeonsRefreshTimer = new Timer(this.Refresh); this.RefreshInterval = 250; // Initialize the start call count to 0 this.startCallCount = 0; // Initialize the dungeons this.InitializeDungeons(); // This takes a while, so do it on a background thread Task.Factory.StartNew(() => { this.InitializeDungeonZoneNames(); }); logger.Info("Dungeons Controller initialized"); }