Пример #1
0
 public GoldProducerViewModel(RessourceProducer ressourceProducer)
 {
     this.RessourceProducer = ressourceProducer;
     this.View             = new GoldProducerUC();
     this.View.DataContext = this.RessourceProducer;
     EventsGenerator();
 }
Пример #2
0
 private GoldProducersViewModel(RessourceProducer ressourceProducer)
 {
     view = new GoldProducerUserControl(this);
     RessourceProducer = ressourceProducer;
     EventsGenerator();
     view.DataContext = RessourceProducer;
 }
Пример #3
0
 private GoldProducersViewModelOld(RessourceProducer ressourceProducer)
 {
     view = new GoldProducerUserControl(this);
     RessourceProducer = ressourceProducer;
     EventsGenerator();
     view.DataContext = this;
     view.BuildingNameLabel.DataContext = RessourceProducer;
 }
Пример #4
0
        private void UsineTwoButton_Click(object sender, System.Windows.RoutedEventArgs e)
        {
            if (producer2 == null)
            {
                Task <RessourceProducer> newProducer = RecupProducer(2);
                producer2 = newProducer.Result;
            }
            GoldProducersViewModel popUp = GoldProducersViewModel.GetProducersViewModelMultition(producer2);

            popUp.view.Visibility = System.Windows.Visibility.Visible;
        }
Пример #5
0
 public static GoldProducersViewModel GetProducersViewModelMultition(RessourceProducer Key)
 {
     lock (_lock)
     {
         if (!_instances.ContainsKey(Key))
         {
             _instances.Add(Key, new GoldProducersViewModel(Key));
         }
         return(_instances[Key]);
     }
 }
Пример #6
0
        private void UsineOneButton_Click(object sender, System.Windows.RoutedEventArgs e)
        {
            if (producer == null)
            {
                Task <RessourceProducer> newProducer = RecupProducer(1);
                producer = newProducer.Result;
            }
            GoldProducersViewModel popUp = GoldProducersViewModel.GetProducersViewModelMultition(producer);

            if (producer.IsActive == true)
            {
                popUp.view.MainGrid.Background = Brushes.Green;
            }
            popUp.view.Visibility = System.Windows.Visibility.Visible;
        }
Пример #7
0
 public static GoldProducersViewModelOld GetProducersViewModelMultition(RessourceProducer Key)
 {
     lock (_lock)
     {
         if (!_instances.ContainsKey(Key))
         {
             _instances.Add(Key, new GoldProducersViewModelOld(Key));
         }
         if (_instances[Key].RessourceProducer.IsActive == true)
         {
             _instances[Key].RefreshView();
         }
         return(_instances[Key]);
     }
 }
Пример #8
0
        private async Task <RessourceProducer> RecupProducer(int idToRecup)
        {
            RessourceProducer producerToReturn = await mySQLManager.Get(idToRecup);

            return(producerToReturn);
        }