Пример #1
0
 public void EventHandler()
 {
     //*
     if (GPB_realCOX.InvokeRequired)
     {
         delegate_void a_delegate_2 = new delegate_void(EventHandler);
         GPB_realCOX.Invoke(a_delegate_2);
     }
     else
     {
         MC.Counters.receiveResults();
         LBL_realCOX_RTCstate.Text     = MC.Counters.Status;
         LBL_realCOX_COA_Result.Text   = MC.Counters.COA.ToString();
         LBL_realCOX_COB_Result.Text   = MC.Counters.COB.ToString();
         LBL_realCOX_COC_Result.Text   = MC.Counters.COC.ToString();
         LBL_realCOX_RTC_OverTime.Text = MC.Counters.OverTime.ToString();
         //Cycles_performed++;
         ////TXB_realCOX_NumberOfMeasurments.Text = (Cycles - Cycles_performed).ToString();
         //
         //COX_buf = MC.Counters.COA;
         //if (COA_min > COX_buf) { COA_min = COX_buf; }
         //COA_mid = (COA_mid * (Cycles_performed - 1) + COX_buf) / Cycles_performed;
         //if (COA_max < COX_buf) { COA_max = COX_buf; }
         //
         //COX_buf = MC.Counters.COB;
         //if (COB_min > COX_buf) { COB_min = COX_buf; }
         //COB_mid = (COB_mid * (Cycles_performed - 1) + COX_buf) / Cycles_performed;
         //if (COB_max < COX_buf) { COB_max = COX_buf; }
         //
         //COX_buf = MC.Counters.COC;
         //if (COC_min > COX_buf) { COC_min = COX_buf; }
         //COC_mid = (COC_mid * (Cycles_performed - 1) + COX_buf) / Cycles_performed;
         //if (COC_max < COX_buf) { COC_max = COX_buf; }
         //
         //double RTC_buf = MC.Counters.OverTime;
         //if (RTC_min > RTC_buf) { RTC_min = RTC_buf; }
         //RTC_mid = (RTC_mid * (Cycles_performed - 1) + RTC_buf) / Cycles_performed;
         //if (RTC_max < RTC_buf) { RTC_max = RTC_buf; }
         //
         //if (Cycles_performed < Cycles)
         //{
         //    //Тут настройки SPI
         //    Thread.Sleep(20);
         //    MC.Counters.startMeasure(TXB_realCOX_MeasureTime.Text);
         //    LBL_realCOX_RTCstate.Text = MC.Counters.Status;
         //}
         //else
         //{
         //    LBL_realCOX_COA_Result.Text = COA_min + "..." + COA_mid + "..." + COA_max;
         //    LBL_realCOX_COB_Result.Text = COB_min + "..." + COB_mid + "..." + COB_max;
         //    LBL_realCOX_COC_Result.Text = COC_min + "..." + COC_mid + "..." + COC_max;
         //    LBL_realCOX_RTC_OverTime.Text = RTC_min + "..." + RTC_mid + "..." + RTC_max;
         //}
     }
     //*/
 }
Пример #2
0
 static void StartMaskine(int antal, delegate_void nårDuErFærdigFunktion)
 {
     Console.WriteLine("Maskine starter");
     // logik...
     // færdig...
     if (nårDuErFærdigFunktion != null)
     {
         nårDuErFærdigFunktion.Invoke();
     }
 }
Пример #3
0
 private DelayAction(double delay,delegate_void action)
 {
     DELAY = delay;
     ACTION = action;
     DISPOSED = false;
 }
Пример #4
0
 public static void Add(double delay,delegate_void action)
 {
     var d = new DelayAction(delay, action);
     PENDING.Add(d);
 }
Пример #5
0
        static void Main(string[] args)
        {
            // direkte
            Test1();
            Test2(2);
            int res1 = Test3(5, 1);

            Console.WriteLine("---");
            delegate_void d1 = new delegate_void(Test1);

            d1 += Test1;
            d1 += Test1;
            d1 += Test1a;
            d1 += Test1b;
            //Test1();
            d1.Invoke();
            Console.WriteLine("---");

            Console.WriteLine();
            delegate_voidint d2 = new delegate_voidint(Test2);

            Test2(54);
            d2.Invoke(6);

            Console.WriteLine();
            delegate_intintint d3 = new delegate_intintint(Test3);

            Console.WriteLine(Test3(6, 7));
            Console.WriteLine(d3.Invoke(6, 7));

            Console.WriteLine();
            StartMaskine(6, d1);

            Console.WriteLine();
            for (int i = 0; i < 5; i++)
            {
                System.Threading.Thread.Sleep(150);
                delegate_void d4 = FindFunktion();
                d4.Invoke();
            }

            Console.WriteLine();
            MinMaskine m = new MinMaskine();

            m.LogFunktion  = new delegate_voidstring(Test6);
            m.LogFunktion += Test5;
            m.LogFunktion += Console.WriteLine;
            m.LogFunktion += DebugSkriv;
            //m.LogFunktion += (t) => { System.Diagnostics.Debug.WriteLine(t); };
            m.Start();
            m.Stop();

            // ny syntaks

            Console.WriteLine("********");
            //delegate_void n1 = new delegate_void(Test1);
            delegate_void n1 = Test1;

            //StartMaskine(76, new delegate_void(Test1));
            StartMaskine(76, Test1);
            //n1.Invoke();
            n1();
        }
Пример #6
0
 public void EventHandler()
 {
     //*
     if (GPB_realCOX.InvokeRequired)
     {
         delegate_void a_delegate_2 = new delegate_void(EventHandler);
         GPB_realCOX.Invoke(a_delegate_2);
     }
     else
     {
         MC.Counters.receiveResults();
         LBL_realCOX_RTCstate.Text = MC.Counters.Status;
         LBL_realCOX_COA_Result.Text = MC.Counters.COA.ToString();
         LBL_realCOX_COB_Result.Text = MC.Counters.COB.ToString();
         LBL_realCOX_COC_Result.Text = MC.Counters.COC.ToString();
         LBL_realCOX_RTC_OverTime.Text = MC.Counters.OverTime.ToString();
         //Cycles_performed++;
         ////TXB_realCOX_NumberOfMeasurments.Text = (Cycles - Cycles_performed).ToString();
         //
         //COX_buf = MC.Counters.COA;
         //if (COA_min > COX_buf) { COA_min = COX_buf; }
         //COA_mid = (COA_mid * (Cycles_performed - 1) + COX_buf) / Cycles_performed;
         //if (COA_max < COX_buf) { COA_max = COX_buf; }
         //
         //COX_buf = MC.Counters.COB;
         //if (COB_min > COX_buf) { COB_min = COX_buf; }
         //COB_mid = (COB_mid * (Cycles_performed - 1) + COX_buf) / Cycles_performed;
         //if (COB_max < COX_buf) { COB_max = COX_buf; }
         //
         //COX_buf = MC.Counters.COC;
         //if (COC_min > COX_buf) { COC_min = COX_buf; }
         //COC_mid = (COC_mid * (Cycles_performed - 1) + COX_buf) / Cycles_performed;
         //if (COC_max < COX_buf) { COC_max = COX_buf; }
         //
         //double RTC_buf = MC.Counters.OverTime;
         //if (RTC_min > RTC_buf) { RTC_min = RTC_buf; }
         //RTC_mid = (RTC_mid * (Cycles_performed - 1) + RTC_buf) / Cycles_performed;
         //if (RTC_max < RTC_buf) { RTC_max = RTC_buf; }
         //
         //if (Cycles_performed < Cycles)
         //{
         //    //Тут настройки SPI
         //    Thread.Sleep(20);
         //    MC.Counters.startMeasure(TXB_realCOX_MeasureTime.Text);
         //    LBL_realCOX_RTCstate.Text = MC.Counters.Status;
         //}
         //else
         //{
         //    LBL_realCOX_COA_Result.Text = COA_min + "..." + COA_mid + "..." + COA_max;
         //    LBL_realCOX_COB_Result.Text = COB_min + "..." + COB_mid + "..." + COB_max;
         //    LBL_realCOX_COC_Result.Text = COC_min + "..." + COC_mid + "..." + COC_max;
         //    LBL_realCOX_RTC_OverTime.Text = RTC_min + "..." + RTC_mid + "..." + RTC_max;
         //}
     }
     //*/
 }