public CountAnalytics(AnalysisWindow a)
        {
            InitializeComponent();

            aw = a;

            track = new Tracking();

            step = 0;

            changing = false;

            cluster_Specs     = new List <List <ListBoxItem> >();
            cluster_locations = new List <List <System.Windows.Shapes.Rectangle> >();

            Tracking_Images = new List <Bitmap>();

            ScrollLeft_Init();

            ScrollRight_Init();

            ListBox_Init();

            Logo_Init();

            analysisInProgress = false;
        }
        // -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
        //      UI related functions
        // -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

        // This window is responsble for handling the captures of the object that represents, and thus
        // manages the MainCapture thread and hosts capture taking functions
        public CaptureWindow(CapturePreviews capt, Image img, int[] param, string folder, bool[] analysis, string name, PcPhysicalPoint location, System.Drawing.Point size, bool moved, string map)
        {
            InitializeComponent();

            this.Width  = 1200;
            this.Height = 900;

            this.Left = 300;
            this.Top  = 100;


            cp = capt;

            cfs = new List <captureFramework>();

            // A task holds details for a capture process (See <Task> constructior definition)
            List <Uri> u = new List <Uri>();

            t = new Task(this, param[0], param[1], param[2], param[3], u, folder, analysis[0], analysis[1], name, location, size);

            aw = new AnalysisWindow(this, t.getCountAnalysis(), t.getClassAnalysis(), map, folder);

            Directory.CreateDirectory(folder);
            file = new LogFile(t.getFolder(), t.getIndex(), t.getName(), t.getNumberOfCaptures());

            titleLabel.Content = name;

            if (!analysis[0] && !analysis[1])
            {
                generalAnalysisBut.Visibility = Visibility.Hidden;
            }

            // Thread initialization for triggering the captures

            MainCapture newCapture = new MainCapture();

            newCaptureThread = new Thread(newCapture.StartCapture);
            newCaptureThread.SetApartmentState(ApartmentState.STA);
            newCaptureThread.Start(t);
            running = true;
            playing = false;

            // UI elements initialization

            StackPanel aux   = new StackPanel();
            Rectangle  frame = new Rectangle();

            frame.Visibility = Visibility.Hidden;
            frame.Width      = 575;
            frame.Height     = 400;

            frame.Stroke          = Brushes.Black;
            frame.StrokeThickness = 4;

            aux.Children.Add(frame);
            StackPanel.SetZIndex(aux, 10);

            ImagesCanvas.Children.Add(aux);

            StackPanel aux2   = new StackPanel();
            Rectangle  frame2 = new Rectangle();

            frame2.Width  = 500;
            frame2.Height = 120;

            frame2.Stroke          = Brushes.Black;
            frame2.StrokeThickness = 4;

            aux2.Children.Add(frame2);
            StackPanel.SetZIndex(aux2, 10);

            EventsCanvas.Children.Add(aux2);

            FirstCapture(img, moved);

            Info_Init();

            Logo_Init();

            PlayNStop_Init();

            CapturesListBox.SelectionChanged += new SelectionChangedEventHandler(listBoxClicked);

            EventsListBox.SelectionChanged += new SelectionChangedEventHandler(eventClicked);

            if (analysis[0])
            {
                EventsListBox.Visibility = Visibility.Visible; CountAnalysisBut.Visibility = Visibility.Visible; frame.Visibility = Visibility.Visible;
            }

            speed = 1;
        }