From 3699afe0fbdb5494830eca80612edfdf87a780b0 Mon Sep 17 00:00:00 2001 From: croire <1432593898@qq.com> Date: Sat, 23 Oct 2021 00:42:55 +0800 Subject: [PATCH] =?UTF-8?q?=E9=80=89=E6=8B=A9=E8=A7=86=E9=A2=91dialog?= =?UTF-8?q?=E5=87=BD=E6=95=B0=E6=8F=90=E5=8F=96=E5=88=B0DialogUtils?= =?UTF-8?q?=E7=B1=BB=E4=B8=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- DownKyi/Utils/DialogUtils.cs | 19 +++++++++++++++++ .../ViewModels/Toolbox/ViewDelogoViewModel.cs | 21 +------------------ .../Toolbox/ViewExtractMediaViewModel.cs | 21 +------------------ 3 files changed, 21 insertions(+), 40 deletions(-) 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 ""; } - } - } }