public void SetProject(Project project)
        {
            SoundUnit.Initialize();
            var vm = new MainWindowViewModel()
            {
                IsMute = project.IsMute,
                IsMusicMute = project.IsMusicMute,
                IsVoiceMute = project.IsVoiceMute,
                FontSize = project.FontSize
            };

            foreach (var file in Directory.EnumerateFiles(project.TextPath, project.FileExtension))
            {
                var textFile = TextFile.FromFile(file);
                textFile.FileIndex = vm.TextFiles.Count + 1;
                vm.TextFiles.Add(textFile);
            }

            if (String.IsNullOrEmpty(project.NameTablePath))
            {
                NameTableUnit.LoadNameTable(project.NameTablePath);
            }

            vm.PreviewVisibility = project.IsPreviewEnable ? Visibility.Visible : Visibility.Collapsed;


            this.DataContext = vm;

            FileList.SelectedIndex = Project.Current.FileIndex == -1 ? 0 : Project.Current.FileIndex;
            TextList.SelectedIndex = Project.Current.TextIndex == -1 ? 0 : Project.Current.FileIndex;
        }
        public MainWindow()
        {
            InitializeComponent();

            if (this.DataContext == null)
            {
                DataContext = new MainWindowViewModel();
            }
        }