/// <summary> /// Default constructor /// </summary> /// <param name="task">The task that this view model wraps</param> /// <param name="zoneService">Service that provides zone information, such as map name</param> public PlayerTaskViewModel(PlayerTask task, IZoneService zoneService, IPlayerTasksController controller, CompositionContainer container) { this.Task = task; this.zoneService = zoneService; this.controller = controller; this.container = container; this.currentCharacterName = string.Empty; this.Task.PropertyChanged += (o, e) => { if (e.PropertyName == "MapID") { this.RefreshMapName(); } else if (e.PropertyName.Contains("Location")) { this.OnPropertyChanged(() => this.HasZoneLocation); this.OnPropertyChanged(() => this.HasContinentLocation); } }; if (this.Task.MapID != -1) { System.Threading.Tasks.Task.Factory.StartNew(this.RefreshMapName); } this.CopyWaypointCommand = new DelegateCommand(this.CopyWaypoint); this.EditCommand = new DelegateCommand(this.Edit); this.DeleteCommand = new DelegateCommand(this.Delete); this.UserData.PropertyChanged += (o, e) => this.RefreshVisibility(); this.Task.PropertyChanged += (o, e) => this.RefreshVisibility(); this.RefreshVisibility(); }
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; }
public TaskTrackerViewModel( IPlayerTasksController playerTasksController, CompositionContainer container) { this.controller = playerTasksController; this.container = container; this.AddNewTaskCommand = new Microsoft.Practices.Prism.Commands.DelegateCommand(this.AddNewTask); this.DeleteAllCommand = new Microsoft.Practices.Prism.Commands.DelegateCommand(this.DeleteAllTasks); this.LoadTasksCommand = new Microsoft.Practices.Prism.Commands.DelegateCommand(this.LoadTasks); this.ImportTasksCommand = new Microsoft.Practices.Prism.Commands.DelegateCommand(this.ImportTasks); this.ExportTasksCommand = new Microsoft.Practices.Prism.Commands.DelegateCommand(this.ExportTasks); var collectionViewSource = new AutoRefreshCollectionViewSource(); collectionViewSource.Source = this.controller.PlayerTasks; this.PlayerTasks = collectionViewSource; switch (this.UserData.TaskTrackerSortProperty) { case TasksUserData.TASK_TRACKER_SORT_NAME: this.OnSortingPropertyChanged(TasksUserData.TASK_TRACKER_SORT_NAME, ListSortDirection.Ascending); break; case TasksUserData.TASK_TRACKER_SORT_DISTANCE: this.OnSortingPropertyChanged(TasksUserData.TASK_TRACKER_SORT_DISTANCE, ListSortDirection.Ascending); break; default: this.OnSortingPropertyChanged(TasksUserData.TASK_TRACKER_SORT_NAME, ListSortDirection.Ascending); break; } }
public TaskTrackerViewModel( IPlayerTasksController playerTasksController, NewTaskDialogViewModel newTaskVm) { this.controller = playerTasksController; this.newTaskViewModel = newTaskVm; this.AddNewTaskCommand = new Microsoft.Practices.Prism.Commands.DelegateCommand(this.AddNewTask); this.DeleteAllCommand = new Microsoft.Practices.Prism.Commands.DelegateCommand(this.DeleteAllTasks); this.LoadTasksCommand = new Microsoft.Practices.Prism.Commands.DelegateCommand(this.LoadTasks); this.ImportTasksCommand = new Microsoft.Practices.Prism.Commands.DelegateCommand(this.ImportTasks); this.ExportTasksCommand = new Microsoft.Practices.Prism.Commands.DelegateCommand(this.ExportTasks); this.taskCategories = new ObservableCollection <TaskCategoryViewModel>(); this.TaskCategories = new AutoRefreshCollectionViewSource(); this.TaskCategories.Source = this.taskCategories; foreach (var t in this.controller.PlayerTasks) { var category = this.taskCategories.FirstOrDefault(c => c.CategoryName == t.Category); if (category == null) { this.taskCategories.Add(new TaskCategoryViewModel(t, this.controller, this.UserData)); } else { category.Add(t); } t.PropertyChanged += Task_PropertyChanged; } this.controller.PlayerTasks.CollectionChanged += PlayerTasks_CollectionChanged; this.TaskCategories.SortDescriptions.Add(new SortDescription("CategoryName", ListSortDirection.Ascending)); }
public TaskCategoryViewModel(PlayerTaskViewModel initialTask, IPlayerTasksController playerTasksController, TasksUserData userData) { this.playerTasks = new ObservableCollection<PlayerTaskViewModel>(); this.PlayerTasks = new AutoRefreshCollectionViewSource(); this.PlayerTasks.Source = this.playerTasks; this.playerTasks.Add(initialTask); this.CategoryName = initialTask.Category; this.userData = userData; this.playerTasksController = playerTasksController; this.SortBy = this.userData.TaskTrackerSortProperty; this.EditCategoryCommand = new DelegateCommand(this.Edit); this.DeleteAllCommand = new DelegateCommand(this.DeleteAll); }
public NewTaskDialogViewModel(ICommerceService commerceService, IPlayerService playerService, IZoneService zoneService, IPlayerTasksController controller) { this.commerceService = commerceService; this.playerService = playerService; this.zoneService = zoneService; this.controller = controller; this.ItemsProvider = new ItemResultsProvider(this.commerceService); this.Task = new PlayerTask(); this.RefreshLocationCommand = new DelegateCommand(this.RefreshLocation); this.ApplyCommand = new DelegateCommand(this.AddOrUpdateTask); this.RefreshLocation(); }
/// <summary> /// Notifies the module that it has be initialized. /// </summary> public void Initialize() { logger.Debug("Initializing Player Tasks Module"); this.playerTasksController = this.Container.GetExportedValue<IPlayerTasksController>(); this.viewController = this.Container.GetExportedValue<IPlayerTasksViewController>(); // Register for shutdown Commands.ApplicationShutdownCommand.RegisterCommand(new DelegateCommand(this.Shutdown)); // Initialize the view controller this.viewController.Initialize(); // Start the controller this.playerTasksController.Start(); logger.Debug("Player Tasks Module initialized"); }
/// <summary> /// Notifies the module that it has be initialized. /// </summary> public void Initialize() { logger.Debug("Initializing Player Tasks Module"); this.playerTasksController = this.Container.GetExportedValue <IPlayerTasksController>(); this.viewController = this.Container.GetExportedValue <IPlayerTasksViewController>(); // Register for shutdown Commands.ApplicationShutdownCommand.RegisterCommand(new DelegateCommand(this.Shutdown)); // Initialize the view controller this.viewController.Initialize(); // Start the controller this.playerTasksController.Start(); logger.Debug("Player Tasks Module initialized"); }
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); }
/// <summary> /// Default constructor /// </summary> /// <param name="task">The task that this view model wraps</param> /// <param name="zoneService">Service that provides zone information, such as map name</param> public PlayerTaskViewModel(PlayerTask task, IZoneService zoneService, IPlayerTasksController controller, CompositionContainer container) { this.Task = task; this.zoneService = zoneService; this.controller = controller; this.container = container; this.Task.PropertyChanged += (o, e) => { if (e.PropertyName == "MapID") this.RefreshMapName(); }; System.Threading.Tasks.Task.Factory.StartNew(this.RefreshMapName); this.CopyWaypointCommand = new DelegateCommand(this.CopyWaypoint); this.EditCommand = new DelegateCommand(this.Edit); this.DeleteCommand = new DelegateCommand(this.Delete); this.UserData.PropertyChanged += (o, e) => this.RefreshVisibility(); this.Task.PropertyChanged += (o, e) => this.RefreshVisibility(); this.RefreshVisibility(); }
/// <summary> /// Default constructor /// </summary> /// <param name="task">The task that this view model wraps</param> /// <param name="zoneService">Service that provides zone information, such as map name</param> public PlayerTaskViewModel(PlayerTask task, IZoneService zoneService, IPlayerTasksController controller, CompositionContainer container) { this.Task = task; this.zoneService = zoneService; this.controller = controller; this.container = container; this.Task.PropertyChanged += (o, e) => { if (e.PropertyName == "MapID") { this.RefreshMapName(); } }; System.Threading.Tasks.Task.Factory.StartNew(this.RefreshMapName); this.CopyWaypointCommand = new DelegateCommand(this.CopyWaypoint); this.EditCommand = new DelegateCommand(this.Edit); this.DeleteCommand = new DelegateCommand(this.Delete); this.UserData.PropertyChanged += (o, e) => this.RefreshVisibility(); this.Task.PropertyChanged += (o, e) => this.RefreshVisibility(); this.RefreshVisibility(); }
public NewTaskDialogViewModel(ICommerceService commerceService, IPlayerService playerService, IZoneService zoneService, IPlayerTasksController controller) { this.commerceService = commerceService; this.playerService = playerService; this.zoneService = zoneService; this.controller = controller; this.ItemsProvider = new ItemResultsProvider(this.commerceService); this.ExistingCategories = new List <string>(); foreach (var task in controller.PlayerTasks) { if (!string.IsNullOrEmpty(task.Category) && !this.ExistingCategories.Contains(task.Category)) { this.ExistingCategories.Add(task.Category); } } this.Task = new PlayerTask(); this.RefreshLocationCommand = new DelegateCommand(this.RefreshLocation); this.ApplyCommand = new DelegateCommand(this.AddOrUpdateTask); this.RefreshLocation(); }
public PlayerTasksFactory(IZoneService zoneService, IPlayerTasksController controller, CompositionContainer container) { this.zoneService = zoneService; this.tasksController = controller; this.container = container; }
public TaskTrackerViewModel( IPlayerTasksController playerTasksController, CompositionContainer container) { this.controller = playerTasksController; this.container = container; this.AddNewTaskCommand = new Microsoft.Practices.Prism.Commands.DelegateCommand(this.AddNewTask); this.DeleteAllCommand = new Microsoft.Practices.Prism.Commands.DelegateCommand(this.DeleteAllTasks); this.LoadTasksCommand = new Microsoft.Practices.Prism.Commands.DelegateCommand(this.LoadTasks); this.ImportTasksCommand = new Microsoft.Practices.Prism.Commands.DelegateCommand(this.ImportTasks); this.ExportTasksCommand = new Microsoft.Practices.Prism.Commands.DelegateCommand(this.ExportTasks); var collectionViewSource = new AutoRefreshCollectionViewSource(); collectionViewSource.Source = this.controller.PlayerTasks; this.PlayerTasks = collectionViewSource; switch (this.UserData.TaskTrackerSortProperty) { case TasksUserData.TASK_TRACKER_SORT_NAME: this.OnSortingPropertyChanged(TasksUserData.TASK_TRACKER_SORT_NAME, ListSortDirection.Ascending); break; case TasksUserData.TASK_TRACKER_SORT_DISTANCE: this.OnSortingPropertyChanged(TasksUserData.TASK_TRACKER_SORT_DISTANCE, ListSortDirection.Ascending); break; default: this.OnSortingPropertyChanged(TasksUserData.TASK_TRACKER_SORT_NAME, ListSortDirection.Ascending); break; } }
/// <summary> /// Default constructor /// </summary> /// <param name="task">The task that this view model wraps</param> /// <param name="zoneService">Service that provides zone information, such as map name</param> public PlayerTaskViewModel(PlayerTask task, IZoneService zoneService, IPlayerTasksController controller, CompositionContainer container) { this.Task = task; this.zoneService = zoneService; this.controller = controller; this.container = container; this.currentCharacterName = string.Empty; this.Task.PropertyChanged += (o, e) => { if (e.PropertyName == "MapID") { this.RefreshMapName(); } else if (e.PropertyName.Contains("Location")) { this.OnPropertyChanged(() => this.HasZoneLocation); this.OnPropertyChanged(() => this.HasContinentLocation); } }; if (this.Task.MapID != -1) System.Threading.Tasks.Task.Factory.StartNew(this.RefreshMapName); this.CopyWaypointCommand = new DelegateCommand(this.CopyWaypoint); this.EditCommand = new DelegateCommand(this.Edit); this.DeleteCommand = new DelegateCommand(this.Delete); this.UserData.PropertyChanged += (o, e) => this.RefreshVisibility(); this.Task.PropertyChanged += (o, e) => this.RefreshVisibility(); this.RefreshVisibility(); }
public PlayerTasksFactory(IZoneService zoneService, IPlayerTasksController controller, CompositionContainer container) { this.zoneService = zoneService; this.tasksController = controller; this.container = container; }
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; }
public NewTaskDialogViewModel(ICommerceService commerceService, IPlayerService playerService, IZoneService zoneService, IPlayerTasksController controller) { this.commerceService = commerceService; this.playerService = playerService; this.zoneService = zoneService; this.controller = controller; this.ItemsProvider = new ItemResultsProvider(this.commerceService); this.Task = new PlayerTask(); this.Task.MapID = this.playerService.MapId; this.Task.Location = this.playerService.PlayerPosition; this.RefreshLocationCommand = new DelegateCommand(this.RefreshLocation); this.ApplyCommand = new DelegateCommand(this.AddOrUpdateTask); }