public RealTimeDetectionViewModel(Models.AlgorithmsModel malgorithms)
        {
            this._malgorithms = malgorithms;
            this._algorithms = new ObservableCollection<AlgorithmViewModel>();
            foreach (Models.AlgorithmModel algorithm in this._malgorithms.Algorithms)
            {
                // only a reference to the object
                if (algorithm != null) this._algorithms.Add(new AlgorithmViewModel(algorithm, true));
            }
            this._aposition = 0;
            this._malgorithm = new AlgorithmModel(this._malgorithms.Algorithms[this._aposition], true);
            this._currentImage = null;

            // Capture image from Active WebCam
            this._capture = new Capture();

            System.Windows.Interop.ComponentDispatcher.ThreadIdle += delegate
            {
                FrameGrabber();            
            };
        }
        //public int TotalTasks { get { return totalTasks; } }

        #endregion 

        #region Constructor

        public MainViewModel(Models.AlgorithmsModel malgorithms, Models.SesionModel msesion, Views.MainView vmain)
        {
            // Models references
            this._malgorithms = malgorithms;
            this._msesion = msesion;
            this._vmain = vmain;

            // Initialize TreeViewItems with drives
            this._drives = new ObservableCollection<DirectoryViewModel>();
            foreach (string drive in Directory.GetLogicalDrives())
            {
                this._drives.Add(new DirectoryViewModel(new DirectoryInfo(@drive)));
            }

            // Initialize Original-Algorithms-Task-Results ListView Collections
            this._oimages = new ObservableCollection<OriginalCollectionViewModel>();

            this._algorithms = new ObservableCollection<AlgorithmViewModel>();
            foreach (Models.AlgorithmModel algorithm in this._malgorithms.Algorithms)
            {
                // only a reference to the object
                if (algorithm != null) this._algorithms.Add(new AlgorithmViewModel(algorithm));
            }

            _tasks = new ObservableCollection<TaskViewModel>();
            _atask = new ObservableCollection<ActiveTaskViewModel>();

            this.aposition = 0;
            this.tposition = -1;
            this.atposition = -2;
            this.tenabled = false;
            this.cameraIndex = 0;
            this._cpVisible = "Hidden";
            this._taenabled = false;
            //this._vmain.circularProgressBar.StopSpinning();
        }