Exemplo n.º 1
0
 static void Main(string[] args)
 {
     if(args.Length != 4 || args[0] == "-help" || args[0] == "-h")
     {
         Console.Out.WriteLine("Must Pass four arguments to the process");
         Console.Out.WriteLine("1) Device Id - This must be registered in the Database");
         Console.Out.WriteLine("2) Latitude");
         Console.Out.WriteLine("3) Longitude");
         Console.Out.WriteLine("4) Warning Temp");
     }
     int deviceId = int.Parse(args[0]);
     DatabaseConnection database = new DatabaseConnection();
     try
     {
         database.ActivateDevice(deviceId);
         Task.Factory.StartNew(() => Monitor(deviceId, args[1], args[2], args[3], database));
         Console.Out.WriteLine("Press any key to quit");
         Console.ReadKey();
         database.DeactivateDevices(deviceId);
     }
     catch
     {
         database.DeactivateDevices(deviceId);
         throw;
     }
 }