Пример #1
0
 void UkurBaru(MetodeDeteksi metode, ArahTombol arah, int index)
 {
     pengukur        = new UCbutton1(new Action <HasilPengujian>(SelesaiUkur), metode, arah);
     pengukur.Parent = this;
     pengukur.Dock   = DockStyle.Fill;
     pengukur.BringToFront();
     indexUji = index;
 }
Пример #2
0
        public UCbutton1(Action <HasilPengujian> fungsiSelesai, MetodeDeteksi metode, ArahTombol arah)
        {
            InitializeComponent();
            selesaiUji        = fungsiSelesai;
            hasilTekan        = new bool[jumlahSesi];
            hasilDurasiRespon = new double[jumlahSesi];

            kendali = new KendaliTombol(metode);
            kendali.TambahTombol(tombol, new FungsiTombol(HasilCekTombol));

            px = new List <double>();
            py = new List <double>();
            px.Add(0);
            py.Add(0);
            px.Add(0);
            py.Add(0);
            px.Add(0);
            py.Add(0);

            px[0] = 240;
            py[1] = 110;
            px[2] = 150;
            py[2] = 540;

            switch (arah)
            {
            case ArahTombol.Horizontal:
                metod = 0;
                break;

            case ArahTombol.Vertikal:
                metod = 1;
                break;

            case ArahTombol.Diagonal:
                metod = 2;
                break;
            }

            timer = new Stopwatch();
            timer.Start();

            updater          = new Timer();
            updater.Tick    += Update;
            updater.Interval = timeStep;
            updater.Start();
            kendali.Start();
        }