private void LoadMedia() { if (ImgOrMedia != 2) { Load_Camera_Page(); } else if (ImgOrMedia == 2) //Txt file { if (ArgsInput == false) { loadFileClass = new LoadFileClass(); //取得對話框訊息 OpenFileDialog fileDialog = loadFileClass.openFileDialog(); if (string.IsNullOrEmpty(fileDialog.FileName)) { return; } imgPath = fileDialog.FileName; //取得完整路徑 fileName = fileDialog.SafeFileName; //取得檔名 ImgOrMedia = InitialLoadFile(); //進行載入檔案並進行初始化設定 } } }
private void MenuItem_Subtitle_Click(object sender, RoutedEventArgs e) { loadFileClass = new LoadFileClass(); //取得對話框訊息 OpenFileDialog fileDialog = loadFileClass.openFileDialog(); if (string.IsNullOrEmpty(fileDialog.FileName)) { return; } //取得完整路徑 sub_path = fileDialog.FileName; //取得檔名 sub_name = fileDialog.SafeFileName; srtModel = SrtHelper.ParseSrt(sub_path); int timeMiles = (int)main_Command.mediaTimePosition * 1000; string timeString = SrtHelper.GetTimeString(timeMiles); Subtitle_TextBlock.Text = timeString; }
}; //☆☆ 치환 단어의 개수에 따라 증감 시켜야 함 ☆☆ #endregion #region LoadFile 파일 로드 부분 public void LoadFile() { OpenFileDialog openFileDialog = new OpenFileDialog(); // 파일 열기 코드 openFileDialog.Multiselect = true; openFileDialog.Filter = "EasyCodingSupporter|*.txt"; openFileDialog.DefaultExt = ".txt"; Nullable <bool> dialogOK = openFileDialog.ShowDialog(); //string fileName = openFileDialog.FileName; if (dialogOK == true) { string strFilenames = ""; foreach (string strFilename in openFileDialog.FileNames) { strFilenames += ";" + strFilename; } strFilenames = strFilenames.Substring(1); tbxSelectedFile.Text = strFilenames; LoadFileClass setting = new LoadFileClass(); setting.loadedFile = tbxSelectedFile.Text; } }