first commit

This commit is contained in:
lihansani
2026-07-13 10:04:36 +08:00
commit 577aa128bd
870 changed files with 25849 additions and 0 deletions

View File

@@ -0,0 +1,20 @@
using System.Collections.Generic;
using System.Windows.Forms;
using DCIT.Core.Models;
namespace DCIT.App.Presentation
{
public interface IUserDialogService
{
DialogResult ShowMessage(IWin32Window owner, string text, string caption, MessageBoxButtons buttons, MessageBoxIcon icon);
AutoExtractPreviewResult ShowAutoExtractPreview(IWin32Window owner, IList<ExtractionCandidate> candidates);
}
public sealed class AutoExtractPreviewResult
{
public DialogResult DialogResult { get; set; }
public IList<ExtractionCandidate> SelectedCandidates { get; set; } = new List<ExtractionCandidate>();
}
}

View File

@@ -0,0 +1,33 @@
using System.IO;
using System.Windows.Forms;
namespace DCIT.App.Presentation
{
internal static class ModernFolderPicker
{
public static bool TrySelectFolder(IWin32Window owner, string initialDirectory, out string selectedPath)
{
selectedPath = null;
using (var dialog = new OpenFileDialog())
{
dialog.ValidateNames = false;
dialog.CheckFileExists = false;
dialog.CheckPathExists = true;
dialog.FileName = "选择当前文件夹";
dialog.Filter = "文件夹|*.folder";
if (!string.IsNullOrWhiteSpace(initialDirectory) && Directory.Exists(initialDirectory))
{
dialog.InitialDirectory = initialDirectory;
}
if (dialog.ShowDialog(owner) != DialogResult.OK)
{
return false;
}
selectedPath = Path.GetDirectoryName(dialog.FileName);
return !string.IsNullOrWhiteSpace(selectedPath);
}
}
}
}

View File

@@ -0,0 +1,31 @@
using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms;
using DCIT.App.Forms;
using DCIT.Core.Models;
namespace DCIT.App.Presentation
{
public sealed class UserDialogService : IUserDialogService
{
public DialogResult ShowMessage(IWin32Window owner, string text, string caption, MessageBoxButtons buttons, MessageBoxIcon icon)
{
return MessageBox.Show(owner, text, caption, buttons, icon);
}
public AutoExtractPreviewResult ShowAutoExtractPreview(IWin32Window owner, IList<ExtractionCandidate> candidates)
{
using (var preview = new AutoExtractPreviewForm(candidates))
{
var dialogResult = preview.ShowDialog(owner);
return new AutoExtractPreviewResult
{
DialogResult = dialogResult,
SelectedCandidates = preview.SelectedCandidates == null
? new List<ExtractionCandidate>()
: preview.SelectedCandidates.ToList(),
};
}
}
}
}