예제 #1
0
        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();
        }
예제 #2
0
        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;
        }
예제 #3
0
        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);
        }
예제 #4
0
파일: WorkerViewModel.cs 프로젝트: dfgs/PIO
        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);
        }
예제 #5
0
        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();
        }
예제 #6
0
 public WorkersViewModel(PIOServiceClient PIOClient, BotsRESTClient BotsClient, ITranslationModule TranslationModule, int PlanetID) : base(PIOClient, BotsClient, TranslationModule)
 {
     this.planetID = PlanetID;
 }
예제 #7
0
 public ProduceOrderViewModel(PIOServiceClient PIOClient, BotsRESTClient BotsClient, ITranslationModule TranslationModule) : base(PIOClient, BotsClient, TranslationModule)
 {
 }
예제 #8
0
 public PIOViewModelCollection(PIOServiceClient PIOClient, BotsRESTClient BotsClient, ITranslationModule TranslationModule)
 {
     this.PIOClient = PIOClient; this.BotsClient = BotsClient; this.TranslationModule = TranslationModule;
 }
예제 #9
0
 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;
 }
예제 #10
0
 public TasksViewModel(PIOServiceClient PIOClient, BotsRESTClient BotsClient, ITranslationModule TranslationModule, int WorkerID) : base(PIOClient, BotsClient, TranslationModule)
 {
     this.workerID = WorkerID;
 }
예제 #11
0
 public CellsViewModel(PIOServiceClient PIOClient, BotsRESTClient BotsClient, ITranslationModule TranslationModule, BuildOrdersViewModel BuildOrdersViewModel, int PlanetID) : base(PIOClient, BotsClient, TranslationModule)
 {
     this.planetID             = PlanetID;
     this.buildOrdersViewModel = BuildOrdersViewModel;
 }
예제 #12
0
 public StacksViewModel(PIOServiceClient PIOClient, BotsRESTClient BotsClient, ITranslationModule TranslationModule, int BuildingID) : base(PIOClient, BotsClient, TranslationModule)
 {
     this.buildingID = BuildingID;
 }
예제 #13
0
파일: StackViewModel.cs 프로젝트: dfgs/PIO
 public StackViewModel(PIOServiceClient PIOClient, BotsRESTClient BotsClient, ITranslationModule TranslationModule) : base(PIOClient, BotsClient, TranslationModule)
 {
 }
예제 #14
0
 public CellViewModel(PIOServiceClient PIOClient, BotsRESTClient BotsClient, ITranslationModule TranslationModule, BuildOrdersViewModel BuildOrdersViewModel) : base(PIOClient, BotsClient, TranslationModule)
 {
     this.buildOrdersViewModel = BuildOrdersViewModel;
     CreateBuildOrderCommand   = new ViewModelCommand(CreateBuildOrderCommandCanExecute, CreateBuildOrderCommandExecute);
 }