Exemplo n.º 1
0
 public ECP40(string host, int port)
 {
     InitializeComponent();
     client            = new ipClient(host, port);
     client.NewLogMsg += client_NewLogMsg;
     tmr_Run();
     Connection.Focusable = true;
     Connection.Focus();
 }
Exemplo n.º 2
0
 private void Current_Exit(object sender, ExitEventArgs e)
 {
     if (_client != null)
     {
         _client.Dispose();
         _client.DisposeThreads();
     }
     _client = null;
     Environment.Exit(0);
 }
Exemplo n.º 3
0
 private void Window_Closed(object sender, EventArgs e)
 {
     if (client != null)
     {
         client.Dispose();
         client.DisposeThreads();
     }
     client = null;
     tmr_Stop();
 }
Exemplo n.º 4
0
        // Main window - methods run on startup
        private void MainWindow_OnLoaded(object sender, RoutedEventArgs e)
        {
            DispatcherTimer timerGuiRefresh = new DispatcherTimer();

            // Network initialization
            _client = new ipClient(host, port);
            TcpClientRun();
            udpServerDiscoverer            = new UdpDiscovery();
            udpServerDiscoverer.NewLogMsg += UdpServerDiscoverer_NewLogMsg;

            ///////////////////////////////////////////////////////////////////////////
            // Constructor inits

            abo.setCpm(cpm);
            abo.setStorage(storage);
            abo.setTimerClass(tc);

            asva.setChecks(checks);
            asva.setLeds(leds);
            asva.setStorage(storage);
            asva.setGamePlayers(gamePlayers);

            answersSerial.setAsva(asva);
            answersSerial.setGsr(gsr);
            answersSerial.setLeds(leds);
            answersSerial.setStorage(storage);

            bcc.setCpm(cpm);
            bcc.setGsr(gsr);
            bcc.setTc(tc);
            bcc.setChecks(checks);
            bcc.setStorage(storage);

            cpm.setLeds(leds);
            cpm.setStorage(storage);
            cpm.setIpClient(_client);

            gpi.setPlayer(gamePlayers);
            gpi.setLedb(ledb);
            gpi.setLidb(lidb);

            gsr.setCpm(cpm);
            gsr.setStorage(storage);

            ledb.setValuePlayers(gamePlayers);
            lidb.setPlayers(gamePlayers);
            lidb.setGpi(gpi);

            tc.setCpm(cpm);
            tc.setGsr(gsr);
            tc.setChecks(checks);
            tc.setStorage(storage);

            ///////////////////////////////////////////////////////////////////////////

            relayStates_get();

            // Set initial default value
            gamePlayers.allowedPPT = 12;
            // Summon lists
            gamePlayers.plInfoGuests = new string[gamePlayers.allowedPPT];
            gamePlayers.plInfoHome   = new string[gamePlayers.allowedPPT];

            // Proceed to program
            commandslogs.ItemsSource = _logs;
            _logsCount            = 0;
            checks.VSTimerStarted = false;
            tc.OnShotTimer        = null;
            tc.timer_Run();
            LEDConnection.Focusable = true;
            LEDConnection.Focus();
            //gameEnteredColorChange();
            elipseFillCheck();

            GTIMEOUT.Content = "TIME" + "\n" + "OUT";
            HTIMEOUT.Content = "TIME" + "\n" + "OUT";
            START.Content    = "START/" + "\n" + "STOP";

            // Timer dispatcher thread
            timerGuiRefresh.Interval = new TimeSpan(0, 0, 0, 0, 20);
            timerGuiRefresh.Tick    += TimerTick;
            timerGuiRefresh.Start();
        }