Ejemplo n.º 1
0
        // ###INVIO DATI ALL'ELETTRONICA SULLA SERIALE###
        public static bool sendOnSerial(string packet)
        {
            /* Invio dati su seriale */
            try
            {
                SerialConfig.sendData(packet);
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }

            return(true);
        }
Ejemplo n.º 2
0
        public void shutdownPC()
        {
            /* Abbassamento tende */
            /* Invio dati ai circuiti elettronici */
            if (curtains)
            {
                string packet = "#G0;$"; // creo il pacchetto per le opzioni da inviare
                try
                {
                    result = sendOnSerial(packet);
                    Console.WriteLine("Inviato: " + packet);
                }
                catch (Exception ex)
                {
                    //throw new Exception(ex.Message);
                }
            }

            /* Chiusura connessione seriale */
            SerialConfig.CloseConnection();

            /* Spegnimento computer */
            Process.Start("shutdown", "/f /s /t 5"); // shutdown pc
        }