public async System.Threading.Tasks.Task OnTaskEnded(PIO.Models.Task Task) { Building building; BuildingViewModel factoryViewModel; await Workers.RefreshWorker(Task.WorkerID); switch (Task.TaskTypeID) { case Models.TaskTypeIDs.MoveTo: break; case Models.TaskTypeIDs.Store: await Buildings.RefreshBuilding(Task.X, Task.Y); break; case Models.TaskTypeIDs.Produce: await Buildings.RefreshBuilding(Task.X, Task.Y); break; case Models.TaskTypeIDs.Harvest: await Buildings.RefreshBuilding(Task.X, Task.Y); break; case Models.TaskTypeIDs.Build: await Buildings.RefreshBuilding(Task.X, Task.Y); break; case Models.TaskTypeIDs.CreateBuilding: try { building = PIOClient.GetBuildingAtPos(1, Task.X, Task.Y); if (building != null) { factoryViewModel = new BuildingViewModel(PIOClient, BotsClient, TranslationModule, ProduceOrders, HarvestOrders); await factoryViewModel.LoadAsync(building); Buildings.Add(factoryViewModel); MapItems.Insert(Cells.Count, factoryViewModel); } } catch (Exception ex) { ErrorMessage = ex.Message; } //await Buildings.RefreshBuilding(Task.X.Value, Task.Y.Value); break; } }
public async System.Threading.Tasks.Task OnTaskStarted(PIO.Models.Task Task) { await Workers.RefreshWorker(Task.WorkerID); switch (Task.TaskTypeID) { case Models.TaskTypeIDs.Take: await Buildings.RefreshBuilding(Task.X, Task.Y); break; case Models.TaskTypeIDs.Produce: await Buildings.RefreshBuilding(Task.X, Task.Y); break; case Models.TaskTypeIDs.Build: await Buildings.RefreshBuilding(Task.X, Task.Y); break; } }