private async void OpenCommandBinding_Executed(object sender, ExecutedRoutedEventArgs e) { try { pioClient = new PIOServiceClient(new BasicHttpBinding(), new EndpointAddress($@"http://127.0.0.1:8733/PIO/Service/")); pioClient.Open(); botsClient = new BotsRESTClient($@"http://127.0.0.1:8734", new HttpConnector(), new ResponseDeserializer()); taskCallbackClient = new TaskCallbackServiceClient(new InstanceContext(this), new WSDualHttpBinding(), new EndpointAddress($@"http://localhost:8735/PIO/TaskCallback/Service")); taskCallbackClient.Open(); taskCallbackClient.Subscribe(); isConnected = true; } catch (Exception ex) { ShowError(ex); } translationModule = new TranslationModule(NullLogger.Instance, pioClient); ApplicationViewModel = new ApplicationViewModel(pioClient, botsClient, translationModule); DataContext = ApplicationViewModel; await translationModule.LoadAsync("FR"); await ApplicationViewModel.LoadAsync(); }
private void CloseCommandBinding_Executed(object sender, ExecutedRoutedEventArgs e) { try { taskCallbackClient?.Unsubscribe(); taskCallbackClient?.Close(); } catch { } try { pioClient?.Close(); } catch { } /*try * { * botsClient?.Close(); * } * catch { }*/ DataContext = null; ApplicationViewModel = null; translationModule = null; pioClient = null; botsClient = null; isConnected = false; }
public BuildingViewModel(PIOServiceClient PIOClient, BotsRESTClient BotsClient, ITranslationModule TranslationModule, ProduceOrdersViewModel ProduceOrdersViewModel, HarvestOrdersViewModel HarvestOrderViewModels) : base(PIOClient, BotsClient, TranslationModule) { this.produceOrdersViewModel = ProduceOrdersViewModel; this.harvestOrderViewModels = HarvestOrderViewModels; CreateProduceOrderCommand = new ViewModelCommand(CreateProduceOrderCommandCanExecute, CreateProduceOrderCommandExecute); CreateHarvestOrderCommand = new ViewModelCommand(CreateHarvestOrderCommandCanExecute, CreateHarvestOrderCommandExecute); }
public WorkerViewModel(PIOServiceClient PIOClient, BotsRESTClient BotsClient, ITranslationModule TranslationModule) : base(PIOClient, BotsClient, TranslationModule) { CreateBotCommand = new ViewModelCommand(CreateBotCommandCanExecute, CreateBotCommandExecute); DeleteBotCommand = new ViewModelCommand(DeleteBotCommandCanExecute, DeleteBotCommandExecute); ProduceCommand = new ViewModelCommand(ProduceCommandCanExecute, ProduceCommandExecute); HarvestCommand = new ViewModelCommand(HarvestCommandCanExecute, HarvestCommandExecute); }
public ApplicationViewModel(PIOServiceClient PIOClient, BotsRESTClient BotsClient, ITranslationModule TranslationModule) : base(PIOClient, BotsClient, TranslationModule) { ProduceOrders = new ProduceOrdersViewModel(PIOClient, BotsClient, TranslationModule, planetID); HarvestOrders = new HarvestOrdersViewModel(PIOClient, BotsClient, TranslationModule, planetID); BuildOrders = new BuildOrdersViewModel(PIOClient, BotsClient, TranslationModule, planetID); Cells = new CellsViewModel(PIOClient, BotsClient, TranslationModule, BuildOrders, planetID); Workers = new WorkersViewModel(PIOClient, BotsClient, TranslationModule, planetID); Buildings = new BuildingsViewModel(PIOClient, BotsClient, TranslationModule, ProduceOrders, HarvestOrders, planetID); MapItems = new MapItemsViewModel(); SelectedItems = new MapItemsViewModel(); }
public WorkersViewModel(PIOServiceClient PIOClient, BotsRESTClient BotsClient, ITranslationModule TranslationModule, int PlanetID) : base(PIOClient, BotsClient, TranslationModule) { this.planetID = PlanetID; }
public ProduceOrderViewModel(PIOServiceClient PIOClient, BotsRESTClient BotsClient, ITranslationModule TranslationModule) : base(PIOClient, BotsClient, TranslationModule) { }
public PIOViewModelCollection(PIOServiceClient PIOClient, BotsRESTClient BotsClient, ITranslationModule TranslationModule) { this.PIOClient = PIOClient; this.BotsClient = BotsClient; this.TranslationModule = TranslationModule; }
public BuildingsViewModel(PIOServiceClient PIOClient, BotsRESTClient BotsClient, ITranslationModule TranslationModule, ProduceOrdersViewModel ProduceOrdersViewModel, HarvestOrdersViewModel HarvestOrderViewModels, int PlanetID) : base(PIOClient, BotsClient, TranslationModule) { this.planetID = PlanetID; this.produceOrdersViewModel = ProduceOrdersViewModel; this.harvestOrderViewModels = HarvestOrderViewModels; }
public TasksViewModel(PIOServiceClient PIOClient, BotsRESTClient BotsClient, ITranslationModule TranslationModule, int WorkerID) : base(PIOClient, BotsClient, TranslationModule) { this.workerID = WorkerID; }
public CellsViewModel(PIOServiceClient PIOClient, BotsRESTClient BotsClient, ITranslationModule TranslationModule, BuildOrdersViewModel BuildOrdersViewModel, int PlanetID) : base(PIOClient, BotsClient, TranslationModule) { this.planetID = PlanetID; this.buildOrdersViewModel = BuildOrdersViewModel; }
public StacksViewModel(PIOServiceClient PIOClient, BotsRESTClient BotsClient, ITranslationModule TranslationModule, int BuildingID) : base(PIOClient, BotsClient, TranslationModule) { this.buildingID = BuildingID; }
public StackViewModel(PIOServiceClient PIOClient, BotsRESTClient BotsClient, ITranslationModule TranslationModule) : base(PIOClient, BotsClient, TranslationModule) { }
public CellViewModel(PIOServiceClient PIOClient, BotsRESTClient BotsClient, ITranslationModule TranslationModule, BuildOrdersViewModel BuildOrdersViewModel) : base(PIOClient, BotsClient, TranslationModule) { this.buildOrdersViewModel = BuildOrdersViewModel; CreateBuildOrderCommand = new ViewModelCommand(CreateBuildOrderCommandCanExecute, CreateBuildOrderCommandExecute); }