Exemplo n.º 1
0
        /// <summary>
        /// Handles the Click event of the okButton control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        private void okButton_Click(object sender, EventArgs e)
        {
            // Make sure that the user chose surveillance and output systems.
            if (foundTrackingSystems.Count == 0 || foundOutputSystems.Count == 0)
            {
                showErrorMessage("No surveillance systems were found.Please check you configuration file.");
                return;
            }
            else
            {
                // Next retrieve the surveillance  and output systems.
                surveillance =
                    foundTrackingSystems[cmbAvailableTrackingSystems.SelectedIndex];
                output = foundOutputSystems[cmbAvailableOutputSystems.SelectedIndex];
                // Check that the user chose a video source.
                if (videoSource == null)
                {
                    showErrorMessage("No viseo source was chosen.");
                    return;
                }
            }

            DialogResult = DialogResult.OK;
            Hide();
        }
Exemplo n.º 2
0
        /// <summary>
        /// Singleton constructor.
        /// </summary>
        private TrackingSystemsFactory()
        {
            // Load available tracking systems.
            XmlDocument document = new XmlDocument();

            document.Load(Settings.Default.ConfigFile);

            // Use xml path.
            XmlNodeList result = document.SelectNodes("/Configuration/TrackingSystem");

            foreach (XmlNode node in result)
            {
                // Load values.
                String location  = node.Attributes["location"].InnerText;
                String className = node.Attributes["class"].InnerText;

                // Create instance.
                try
                {
                    ISurveillanceSystem value =
                        (ISurveillanceSystem)
                        Activator.CreateInstanceFrom(location, className).Unwrap();
                    availableTrackingSystems.Add(value);
                }catch (Exception)
                {
                    // Ignore
                    //TODO Notify the user.
                }
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// Handles the Click event of the mnuOpenLocalDevice control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        private void mnuOpenLocalDevice_Click(object sender, EventArgs e)
        {
            // Stop running when showing the configuration box.
            if (camera != null)
            {
                camera.Stop();
            }

            if (captureDeviceForm.ShowDialog(this) == DialogResult.OK)
            {
                // Clean previous data.
                Clean();

                IVideoSource source = captureDeviceForm.Device;

                // Update tracking system.
                surveillanceSystem = captureDeviceForm.Surveillance;
                // Update output system.
                outputSystem = captureDeviceForm.Output.GetOutput(captureDeviceForm.OutputConfiguration);

                // Check if you can display Runtime information.
                if (surveillanceSystem.HasRuntimeInformation)
                {
                    mnuShowRuntimeInformation.Enabled = true;
                }
                // Can it be configured during runtime.
                if (surveillanceSystem.IsRuntimeConfigurable)
                {
                    mnuConfigureTrackingSystem.Enabled = true;
                }
                // open it
                OpenVideoSource(source, surveillanceSystem, captureDeviceForm.TrackingConfiguration, outputSystem);
                mnuStart.Enabled = true;
            }
        }
Exemplo n.º 4
0
 /// <summary>
 /// Opens the video source and prepares the surveillance system.
 /// </summary>
 /// <param name="source">The video source.</param>
 /// <param name="surveillance">The surveillance system.</param>
 /// <param name="conf">The configuration for the image process.</param>
 /// <param name="output">The output.</param>
 private void OpenVideoSource(IVideoSource source, ISurveillanceSystem surveillance, IDictionary <string, object> conf, IOutput output)
 {
     // set busy cursor
     Cursor = Cursors.WaitCursor;
     // create camera
     camera = new Camera(source, surveillance.GetImageProcess(conf), output, surveillance.GraphicalOutput, pictureBox1);
     Cursor = Cursors.Default;
 }
Exemplo n.º 5
0
 /// <summary>
 /// Updates the configure button, description box and surveillance variable.
 /// If the surveillance system chosen can be configured then enable it,
 /// otherwise disable it.
 /// </summary>
 private void updateTrackingSystemGui()
 {
     surveillance = foundTrackingSystems[cmbAvailableTrackingSystems.SelectedIndex];
     // Update configuration options.
     if (surveillance.IsConfigurable)
     {
         // Dispose old one.
         if (trackingConfigForm != null)
         {
             trackingConfigForm.Dispose();
         }
         trackingConfigForm = surveillance.ConfigurationForm;
         // Get default configuration.
         trackingConfiguration = trackingConfigForm.GetConfiguration();
     }
     btnConfigureTrackingSystem.Enabled = surveillance.IsConfigurable;
     txtTrackingDescription.Text        = surveillance.Description;
 }
Exemplo n.º 6
0
		/// <summary>
		/// Handles the Click event of the mnuOpenLocalDevice control.
		/// </summary>
		/// <param name="sender">The source of the event.</param>
		/// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
		private void mnuOpenLocalDevice_Click(object sender, EventArgs e)
		{
			// Stop running when showing the configuration box.
			if (camera != null)
			{
				camera.Stop();
			}

			if (captureDeviceForm.ShowDialog(this) == DialogResult.OK)
			{
				// Clean previous data.
				Clean();

				IVideoSource source = captureDeviceForm.Device;
				
				// Update tracking system.
				surveillanceSystem = captureDeviceForm.Surveillance;
				// Update output system.
				outputSystem = captureDeviceForm.Output.GetOutput(captureDeviceForm.OutputConfiguration);

				// Check if you can display Runtime information.
				if (surveillanceSystem.HasRuntimeInformation)
				{
					mnuShowRuntimeInformation.Enabled = true;
				}
				// Can it be configured during runtime.
				if (surveillanceSystem.IsRuntimeConfigurable)
				{
					mnuConfigureTrackingSystem.Enabled = true;
				}
				// open it
				OpenVideoSource(source, surveillanceSystem, captureDeviceForm.TrackingConfiguration, outputSystem);
				mnuStart.Enabled = true;

			}
		}
Exemplo n.º 7
0
		/// <summary>
		/// Opens the video source and prepares the surveillance system.
		/// </summary>
		/// <param name="source">The video source.</param>
		/// <param name="surveillance">The surveillance system.</param>
		/// <param name="conf">The configuration for the image process.</param>
		/// <param name="output">The output.</param>
		private void OpenVideoSource(IVideoSource source, ISurveillanceSystem surveillance, IDictionary<string, object> conf, IOutput output)
		{
			// set busy cursor
			Cursor = Cursors.WaitCursor;
			// create camera
			camera = new Camera(source, surveillance.GetImageProcess(conf), output, surveillance.GraphicalOutput, pictureBox1);
			Cursor = Cursors.Default;
		}
Exemplo n.º 8
0
		/// <summary>
		/// Updates the configure button, description box and surveillance variable.
		/// If the surveillance system chosen can be configured then enable it,
		/// otherwise disable it.
		/// </summary>
		private void updateTrackingSystemGui()
		{
			surveillance = foundTrackingSystems[cmbAvailableTrackingSystems.SelectedIndex];
			// Update configuration options.
			if (surveillance.IsConfigurable)
			{
				// Dispose old one.
				if (trackingConfigForm != null)
				{
					trackingConfigForm.Dispose();
				}
				trackingConfigForm = surveillance.ConfigurationForm;
				// Get default configuration.
				trackingConfiguration = trackingConfigForm.GetConfiguration();
			}
			btnConfigureTrackingSystem.Enabled = surveillance.IsConfigurable;
			txtTrackingDescription.Text = surveillance.Description;
		}
Exemplo n.º 9
0
		/// <summary>
		/// Handles the Click event of the okButton control.
		/// </summary>
		/// <param name="sender">The source of the event.</param>
		/// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
		private void okButton_Click(object sender, EventArgs e)
		{
			// Make sure that the user chose surveillance and output systems.
			if (foundTrackingSystems.Count == 0 || foundOutputSystems.Count == 0)
			{
				showErrorMessage("No surveillance systems were found.Please check you configuration file.");
				return;
			}
			else
			{
				// Next retrieve the surveillance  and output systems.
				surveillance =
					foundTrackingSystems[cmbAvailableTrackingSystems.SelectedIndex];
				output = foundOutputSystems[cmbAvailableOutputSystems.SelectedIndex];
				// Check that the user chose a video source.
				if (videoSource == null)
				{
					showErrorMessage("No viseo source was chosen.");
					return;
				}
			}

			DialogResult = DialogResult.OK;
			Hide();
			
		}