aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Video/DefaultVideoCaptureProvider.cs
blob: f710cf0828c51aa38fd07cfb72c90bbf9c36d12b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Tango.Video.DirectCapture;

namespace Tango.MachineStudio.Common.Video
{
    /// <summary>
    /// Represents the default implementation of <see cref="IVideoCaptureProvider"/>.
    /// </summary>
    /// <seealso cref="Tango.MachineStudio.Common.Video.IVideoCaptureProvider" />
    public class DefaultVideoCaptureProvider : IVideoCaptureProvider
    {
        /// <summary>
        /// Gets the available capture devices.
        /// </summary>
        public ObservableCollection<CaptureDevice> AvailableCaptureDevices { get; private set; }

        /// <summary>
        /// Initializes a new instance of the <see cref="DefaultVideoCaptureProvider"/> class.
        /// </summary>
        public DefaultVideoCaptureProvider()
        {
            AvailableCaptureDevices = new ObservableCollection<CaptureDevice>();

            var availableDevices = CaptureDevice.GetAvailableCaptureDevices();

            for (int i = 0; i < availableDevices.Count; i++)
            {
                AvailableCaptureDevices.Add(new CaptureDevice() { Device = availableDevices[i] });
            }

            while (AvailableCaptureDevices.Count < 3)
            {
                AvailableCaptureDevices.Add(new CaptureDevice()
                {
                    Device = null,
                });
            }
        }
    }
}
an>+ product_name + " Installer_v2.0.0.msi"; builder.Build("2.0.0", output_file).Wait(); File.Delete(added_file); Assert.IsTrue(File.Exists(output_file)); var process = Process.Start(output_file); process.WaitForExit(); File.Delete(output_file); String installationFolder = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), manufacturer, product_name); Assert.IsTrue(File.Exists(Path.Combine(installationFolder, Path.GetFileName(added_file)))); Thread.Sleep(2000); bool installed = builder.IsInstalled().Result; Assert.IsTrue(installed); builder.Uninstall().Wait(); Thread.Sleep(2000); installed = builder.IsInstalled().Result; Assert.IsFalse(installed); } } }