Пример #1
0
        public void nastawaTest()
        {
            komunikacja ktest = new komunikacja();
            Int32       x;

            for (x = -90; x < 150; x++)
            {
                Assert.AreEqual(ktest.nastawa(x), x);
            }
        }
Пример #2
0
        /*  public class czasomierz
         * {
         *
         *
         *     public void start()
         *
         *     {
         *
         *
         *         Timer czas = new System.Timers.Timer();
         *         czas.Interval = 2000;
         *         czas.Elapsed += TimedEvent;
         *         czas.AutoReset = true;
         *
         *         czas.Enabled = true;
         *     }
         *        public  void TimedEvent(Object source, System.Timers.ElapsedEventArgs e)
         *         {
         *             Console.WriteLine("czas", e.SignalTime);
         *
         *
         *         }
         *
         *
         *
         * }
         */



        public static void Main(string[] args)
        {
            komunikacja k1 = new komunikacja();
            zapis       z1 = new zapis();

            Console.WriteLine("dostępne porty");
            k1.sprawdzporty();
            Console.WriteLine("Wpisz port, pod którym jest logger");
            k1.rs(Console.ReadLine());
            Console.WriteLine("Podaj temperaturę progową");
            k1.nastawa(Int32.Parse(Console.ReadLine()));
            Console.WriteLine("Podaj kierunek przekroczenia ( 1- w górę, 0 - w dół");
            k1.kierunek(Int32.Parse(Console.ReadLine()));
            Console.WriteLine("Podaj ścieżkę do logu w formacie c:\\log\\nazwalogu.txt");

            z1.utworz(Console.ReadLine());
            Timer aTimer;

            aTimer          = new System.Timers.Timer();
            aTimer.Interval = 2000;

            // Hook up the Elapsed event for the timer.
            aTimer.Elapsed += OnTimedEvent;

            // Have the timer fire repeated events (true is the default)
            aTimer.AutoReset = true;

            // Start the timer
            aTimer.Enabled = true;

            Console.WriteLine("Press the Enter key to exit the program at any time... ");
            Console.ReadLine();

            void OnTimedEvent(Object source, System.Timers.ElapsedEventArgs e)
            {
                Console.WriteLine("The Elapsed event was raised at {0}", e.SignalTime);
                z1.dopisz(k1.Sprawdz(Convert.ToString(e.SignalTime)));
            }

            /*    void OnTimedEvent(Object source, System.Timers.ElapsedEventArgs e)
             * {
             *  Console.WriteLine("czas", e.SignalTime);
             *      z1.dopisz(k1.Sprawdz());
             *
             * }
             */
            Console.ReadKey();
        }