using System;
using System.Threading;
using Microsoft.SPOT;
using Microsoft.SPOT.Hardware;
using SecretLabs.NETMF.Hardware;
using SecretLabs.NETMF.Hardware.Netduino;

namespace RemoteCam.Server
{
    public class Program
    {
        public static void Main()
        {
            using (Worker worker = new Worker())
            {
                worker.Start();
                int i = 0;
                while (!worker.IsDone)
                {
                    i++;
                    //if (i > 10)
                    //    break;
                    //if (worker.ShouldTakeSnapshot)
                    //{
                    //    //Thread.Sleep(2000);
                    //    //worker.TakeSnapshotAndSendIt();
                    //}
                    if (worker.SnapshotRequired)
                        worker.TakeSnapshotAndSendIt();
                    //if ((i % 200) == 0)
                    //    worker.TakeSnapshotAndSendIt();
                    Thread.Sleep(10);
                }
            }
        }
    }
}
