//generate files for analyser
        private void generate_initialization()
        {
            var openFileDialog = new OpenFileDialog { Title = "Select filename", Filter = "Replay files|*.replay" };
            if (openFileDialog.ShowDialog() == true)
            {
                //get the pure filename(without path and extension)
                string path = openFileDialog.FileName;
                string filename = openFileDialog.SafeFileName;
                System.Console.WriteLine("path = " + path + "purepath= ");
                string pathwithoutextension = path.Remove(path.IndexOf('.'));
                replay = new KinectReplay(openFileDialog.FileName);
                message = string.Format("Replaying {0}", RecordOptions.ToString());
                videoWriter.FrameRate = 30;
                videoWriter.Open(pathwithoutextension + ".avi", 640, 480);
                //xmlwriter
                xmlwriter = new XMLWriter(pathwithoutextension + "_jointsdata.xml", pathwithoutextension + "_keyframes.xml", filename);

                IsGenerating = true;
                replay.AllFramesReady += ReplayAllFramesReady;
                replay.ReplayFinished += CleanupGeneration;
                replay.Start();
                generationstatus.Content = "generating analysis files, please wait";

            }
     
        }