/// <summary>
 /// Raises when asociated settings has changed
 /// </summary>
 /// <param name="settings"></param>
 private void settings_RecoHumanSettingsChanged(RecoHumanSettigs settings)
 {
     UpdateSettings();
 }
        public static bool Save(string path, RecoHumanSettigs settings)
        {
            XmlSerializer xs = new XmlSerializer(typeof(RecoHumanSettigs));
            FileStream fs;

            try
            {
                fs = File.OpenWrite(path);
                xs.Serialize(fs, settings);
                fs.Close();
                return true;
            }
            catch{return false;}
        }
        /// <summary>
        /// Initiates a new instance of FrmRecoHuman
        /// </summary>
        public HumanRecognizer(IImageSource imageSource)
        {
            if (imageSource == null)
                throw new ArgumentNullException();
            this.imageSource = imageSource;
            LoadKnownFaces();
            lastDetectedFaces = new FaceCollection();

            settings = RecoHumanSettigs.Load("Settings.xml");
            if (settings == null) settings = RecoHumanSettigs.Default;

            //capturedImages = new ProducerConsumer<NImage>(10);

            mainThread = new Thread(new ThreadStart(MainThreadTask));
            mainThread.IsBackground = true;
        }
		/// <summary>
		/// Initiates a new instance of FrmRecoHuman
		/// </summary>
		public FrmRecoHuman()
		{
			InitializeComponent();
			SetImageSource(ImageSourceType.Camera);
			log = new TextBoxStreamWriter(txtConsole);
			//VideoClientPort = 2001;
			//VideoClientAddress = IPAddress.Parse("127.0.0.1");

			//LoadKnownFaces();
			//lastDetectedFaces = new FaceCollection();

			settings = RecoHumanSettigs.Load("Settings.xml");
			if (settings == null) settings = RecoHumanSettigs.Default;
			settingsPannel.Settings = settings;

			SetupAdapters();
			SetupSourceManager();
			SetupEngine();
			SetupCommandManager();
			SetupConnectionManager();
			SetupSharedVariables();
			chkAutoFind.Checked = autoFind;
			SetupEventHandlers();
		}