private void mnuViewShowTrackedData_Clicked(object sender, RoutedEventArgs e)
        {
            if (tw1 == null)
            {
                tw1 = new TrajectoryWindow();
            }

            tw1.Show();

        }
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            this.drawingGroup = new DrawingGroup();
            this.imageSource = new DrawingImage(drawingGroup);

            Globals.ds = new TrajectoryDbDataSet();
            tw1 = new TrajectoryWindow();

            TotalPlayers = 0;
            PedestrianCounts = 0;

            //Default to open visualiser
            Expander.IsExpanded = true;

            //Start the db timer to update according to the time interval setting
            dbTimer = new System.Timers.Timer(Settings.Default.dbTimerSetting);
            dbTimer.Elapsed += new ElapsedEventHandler(dbTimer_Elapsed);
            dbTimer.Start();

            //Start the xml timer to update to the time interval setting
            xmlTimer = new System.Timers.Timer(Settings.Default.xmlTimerSetting);
            xmlTimer.Elapsed += new ElapsedEventHandler(xmlTimer_Elapsed);
            xmlTimer.Start();

            //Add hook for settings events
            Settings.Default.SettingChanging += new System.Configuration.SettingChangingEventHandler(Default_SettingChanging);

            ////Restart Management
            ////RecoveryData rd = new RecoveryData(RecoveryCallback, state);
            ////RecoverySettings rs = new RecoverySettings(rd, 1000);
            ////ApplicationRestartRecoveryManager.RegisterForApplicationRecovery(rs);
            ////ApplicationRestartRecoveryManager.RegisterForApplicationRestart(new RestartSettings("restart",RestartRestrictions.None));

            //RecoveryHelper.RestartRecoveryHelper<TrajectoryDbDataSet> rrh = new RecoveryHelper.RestartRecoveryHelper<TrajectoryDbDataSet>();
            //rrh.CheckForRestart();
            ////MessageBox.Show(ds1.trajectories.Count.ToString());

            ////Globals.ds = ds1;

            //rrh.RegisterForRestartAndRecovery("PedestrianTracker", "Recover", Globals.ds, 50000, RecoveryHelper.FileType.Xml, RecoveryHelper.RestartRestrictions.None);
            
            //Start logging
            Globals.Log("Starting Log");

            loadKinect();
        }