Exemplo n.º 1
0
        private void OnPointUpdate(object sender, int e)
        {
            pointUpdateOccures = true;
            if (points > 0)
            {
                skip = true;
            }
            points = e;
            Stop();
            OffSequence();
            ConfigurationChangeInvoker invoker = new ConfigurationChangeInvoker();

            invoker.SimulationSettings(false);
            indexGraph = indexUpdate = 0;
            seconds    = 0;
            simulation = false;
            Start();
        }
Exemplo n.º 2
0
        private void DoWorkNew()
        {
            graph             = new CeGraphicalEvent();
            graph.PumpsValues = new Core.Common.ServiceBus.Events.CeGraph();
            while (endFlag)
            {
                try
                {
                    CheckState();
                    if (hourIndexChanged == 3600)
                    {
                        hourIndex++;
                    }
                    if (seconds == 10800 || seconds == 0 || pointUpdateOccures)
                    {
                        ConfigurationChangeInvoker invoker = new ConfigurationChangeInvoker();
                        invoker.SimulationSettings(false);
                        indexGraph = indexUpdate = 0;
                        Calculations();
                        if (seconds == 10800)
                        {
                            seconds = 0;
                        }
                    }
                    if (points > 0 && commands != null && graph != null)
                    {
                        if (!simulation)
                        {
                            ConfigurationChangeInvoker invoker = new ConfigurationChangeInvoker();
                            invoker.SimulationSettings(true);
                            simulation = true;
                        }
                        if (seconds % 45 == 0)
                        {
                            if (indexUpdate < 24)
                            {
                                Command();
                            }
                            indexUpdate++;
                            if (indexGraph < 24)
                            {
                                UpdateGraph();
                            }
                            indexGraph++;
                            if (indexGraph == 23)
                            {
                                ConfigurationChangeInvoker invoker = new ConfigurationChangeInvoker();
                                invoker.SimulationSettings(false);
                            }
                        }
                    }

                    Thread.Sleep(TimeSpan.FromSeconds(1));
                    seconds           += 1;
                    secondsForWeather += 1;
                    hourIndexChanged  += 1;
                }
                catch (Exception e)
                {
                    Console.WriteLine(e.Message);
                }
            }
        }