diff --git a/DownKyi/Utils/DialogUtils.cs b/DownKyi/Utils/DialogUtils.cs index 48bc315..2376ae7 100644 --- a/DownKyi/Utils/DialogUtils.cs +++ b/DownKyi/Utils/DialogUtils.cs @@ -22,5 +22,24 @@ namespace DownKyi.Utils ? string.IsNullOrEmpty(dialog.SelectedPath) ? "" : dialog.SelectedPath : ""; } + /// + /// 选择视频dialog + /// + /// + public static string SelectVideoFile() + { + // 选择文件 + var dialog = new Microsoft.Win32.OpenFileDialog + { + Filter = "mp4 (*.mp4)|*.mp4" + }; + var showDialog = dialog.ShowDialog(); + if (showDialog == true) + { + return dialog.FileName; + } + else { return ""; } + } + } } diff --git a/DownKyi/ViewModels/Toolbox/ViewDelogoViewModel.cs b/DownKyi/ViewModels/Toolbox/ViewDelogoViewModel.cs index d1dbc89..000959e 100644 --- a/DownKyi/ViewModels/Toolbox/ViewDelogoViewModel.cs +++ b/DownKyi/ViewModels/Toolbox/ViewDelogoViewModel.cs @@ -93,7 +93,7 @@ namespace DownKyi.ViewModels.Toolbox return; } - VideoPath = SelectVideoFile(); + VideoPath = DialogUtils.SelectVideoFile(); } // 去水印事件 @@ -172,24 +172,5 @@ namespace DownKyi.ViewModels.Toolbox #endregion - /// - /// 选择视频dialog - /// - /// - private string SelectVideoFile() - { - // 选择文件 - var dialog = new Microsoft.Win32.OpenFileDialog - { - Filter = "mp4 (*.mp4)|*.mp4" - }; - var showDialog = dialog.ShowDialog(); - if (showDialog == true) - { - return dialog.FileName; - } - else { return ""; } - } - } } diff --git a/DownKyi/ViewModels/Toolbox/ViewExtractMediaViewModel.cs b/DownKyi/ViewModels/Toolbox/ViewExtractMediaViewModel.cs index 286d558..bd8e1e7 100644 --- a/DownKyi/ViewModels/Toolbox/ViewExtractMediaViewModel.cs +++ b/DownKyi/ViewModels/Toolbox/ViewExtractMediaViewModel.cs @@ -60,7 +60,7 @@ namespace DownKyi.ViewModels.Toolbox return; } - VideoPath = SelectVideoFile(); + VideoPath = DialogUtils.SelectVideoFile(); } // 提取音频事件 @@ -155,24 +155,5 @@ namespace DownKyi.ViewModels.Toolbox #endregion - /// - /// 选择视频dialog - /// - /// - private string SelectVideoFile() - { - // 选择文件 - var dialog = new Microsoft.Win32.OpenFileDialog - { - Filter = "mp4 (*.mp4)|*.mp4" - }; - var showDialog = dialog.ShowDialog(); - if (showDialog == true) - { - return dialog.FileName; - } - else { return ""; } - } - } }