Esempio n. 1
0
    void DisplayUpdate()
    {
        const int timeoutSeconds = 60;

        if (lastSignalReceived.IsOver(seconds: timeoutSeconds).InPastComparedTo(World.UtcNow))
        {
            if (lastUpdate.IsOver(seconds: 1).InPastComparedTo(World.UtcNow))
            {
                lastUpdate = World.UtcNow;
                var backupLastSingalReceived = lastSignalReceived;

                client.EraseDisplay();
                client.WriteLine();
                client.WriteLine();
                if (backupLastSingalReceived == DateTime.MinValue)
                {
                    client.WriteLine("no signal received");
                }
                else
                {
                    client.WriteLine("last signal received " + World.UtcNow.Subtract(backupLastSingalReceived).TotalSeconds.Round().ToInt() + " seconds ago");
                }
                client.WriteLine("debug info:");
                client.WriteLine("	current time: "+ World.UtcNow.ToString("yyyy-MM-dd HH:mm:ss"));
                client.WriteLine("	columns: "+ device.ColumnsCount);
                client.WriteLine("	rows: "+ device.RowsCount);
                client.WriteLine();
                client.WriteLine();

                lastSignalReceived = backupLastSingalReceived;
            }
        }


        myWriteStream.UnityUpdate();
        UpdateTextArea();
    }