Exemplo n.º 1
0
        /// <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();
        }
Exemplo 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>();

            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;
        }
Exemplo n.º 3
0
        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;
            }
        }
Exemplo n.º 4
0
        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));
        }
Exemplo n.º 5
0
        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);
        }
Exemplo n.º 6
0
        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();
        }
Exemplo n.º 7
0
        /// <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");
        }
Exemplo n.º 8
0
        /// <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");
        }
Exemplo n.º 9
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);
        }
Exemplo n.º 10
0
        /// <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();
        }
Exemplo n.º 11
0
        /// <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();
        }
Exemplo n.º 12
0
        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();
        }
Exemplo n.º 13
0
 public PlayerTasksFactory(IZoneService zoneService, IPlayerTasksController controller, CompositionContainer container)
 {
     this.zoneService     = zoneService;
     this.tasksController = controller;
     this.container       = container;
 }
Exemplo n.º 14
0
        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;
            }
        }
Exemplo n.º 15
0
        /// <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();
        }
Exemplo n.º 16
0
 public PlayerTasksFactory(IZoneService zoneService, IPlayerTasksController controller, CompositionContainer container)
 {
     this.zoneService = zoneService;
     this.tasksController = controller;
     this.container = container;
 }
Exemplo n.º 17
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;
        }
Exemplo n.º 18
0
        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);
        }