Esempio n. 1
0
        public MainWindow()
        {
            queues = new SHESToComponentsQueues();
            SHES   = new SHES(queues);
            ShesDbContext dbContext = new ShesDbContext();

            SHES.Batteries.List.AddRange(dbContext.Battery.ToList());
            shes.Consumers.List.AddRange(dbContext.Consumers.ToList());
            shes.SolarPanels.List.AddRange(dbContext.SolarPanels.ToList());

            InitializeComponent();
        }
Esempio n. 2
0
        public async void Simulate()
        {
            while (true)
            {
                try
                {
                    double diff = SHES.GetDiff();
                    Dispatcher.Invoke(() =>
                    {
                        txtBox_Power.Text = "" + SHES.CurrentPower;
                    });

                    Dispatcher.Invoke(() =>
                    {
                        txtBox_Diff.Text = "" + diff;
                    });
                }
                catch (Exception e)
                {
                }

                await Task.Delay(500);
            }
        }