private void VisualizeCommand_Executed(object sender, ExecutedRoutedEventArgs e)
        {
            TableManager tm = new TableManager();
            tm.CreateRawTable((int)e.Parameter);

            Window w = new VistrailOptions((int)e.Parameter);

            w.ShowDialog();
        }
        private void ExportCommand_Executed(object sender, ExecutedRoutedEventArgs e)
        {
            SaveFileDialog saveFileDialog = new SaveFileDialog();

            saveFileDialog.Filter = "CSV File(*.csv)|*.*";

            if (saveFileDialog.ShowDialog() != DialogResult.OK) return;

            TableManager tm = new TableManager();
            tm.CreateRawTable((int)e.Parameter);

            string path = ConfigurationManager.AppSettings["CMDSQLPath"];

            string savePath = saveFileDialog.FileName;
            if (!savePath.Contains(".csv"))
                savePath += ".csv";

            //make sure we backup to a unique name

            FileInfo fInfo = new FileInfo(savePath);

            Process p = new Process();
            p.StartInfo.FileName = "sqlcmd";
            p.StartInfo.Arguments =
                "-S (local)\\SQL2008  -d DMU -E -Q \"SET NOCOUNT ON; SELECT * FROM tmpVizStorage\"  -s\";\" -w 999 -W -o " + ConfigurationManager.AppSettings["TMPPath"] + "\\" +
                fInfo.Name;
            p.StartInfo.WorkingDirectory = path;
            p.StartInfo.UseShellExecute = true;
            p.Start();

            p.WaitForExit();

            if (File.Exists(ConfigurationManager.AppSettings["TMPPath"] + "\\" + fInfo.Name))
            File.Move(ConfigurationManager.AppSettings["TMPPath"] + "\\" + fInfo.Name, savePath);
            else
            {
                Logger.Message("An error has occured.");
                return;
            }

            Logger.Message("The data has been exported.");
        }