Beispiel #1
0
        static void Main(string[] args)
        {
            bool isElevated;
            WindowsIdentity identity = WindowsIdentity.GetCurrent();
            WindowsPrincipal principal = new WindowsPrincipal(identity);
            isElevated = principal.IsInRole(WindowsBuiltInRole.Administrator);

            if (!isElevated)
            {
                Console.WriteLine("Must be run as administrator!");
                Thread.Sleep(5000);
                Environment.Exit(1);
            }

            Console.WriteLine("Starting Kinect Streamer");
            Streamer streamer = new Streamer();
            Console.WriteLine("Saving colour images to: " + streamer.path);

            Console.WriteLine("Press Ctrl+C to exit");
            Console.CancelKeyPress += delegate
            {
                Cleanup(streamer);
            };

            while (true) { Thread.Sleep(1); }
        }
Beispiel #2
0
        private static void Cleanup(Streamer streamer)
        {
            Console.WriteLine("Cleaning up...");
            if (streamer.colorFrameReader != null)
            {
                // ColorFrameReder is IDisposable
                streamer.colorFrameReader.Dispose();
                streamer.colorFrameReader = null;
            }

            if (streamer.kinectSensor != null)
            {
                streamer.kinectSensor.Close();
                streamer.kinectSensor = null;
            }
            Environment.Exit(0);
        }