diff --git a/App.config b/App.config new file mode 100644 index 0000000..aee9adf --- /dev/null +++ b/App.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/App.xaml b/App.xaml new file mode 100644 index 0000000..74a86bf --- /dev/null +++ b/App.xaml @@ -0,0 +1,14 @@ + + + + + + + + + + diff --git a/App.xaml.cs b/App.xaml.cs new file mode 100644 index 0000000..f13a95d --- /dev/null +++ b/App.xaml.cs @@ -0,0 +1,46 @@ +using System; +using System.Windows; +using ExcelHelper.Services; +using ExcelHelper.Utils; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Hosting; + +namespace ExcelHelper +{ + /// + /// App.xaml 的交互逻辑 + /// + public partial class App : Application + { + + public static App AppHost; + private readonly IHost _host = Host.CreateDefaultBuilder() + .AddViewAndViewModel() + .ConfigureServices((context, services) => + { + services.AddHostedService(); + services.AddSingleton(); + + + }) + .Build(); + protected override void OnStartup(StartupEventArgs e) + { + AppHost = this; + + base.OnStartup(e); + + // 初始化AppHost + _host.Start(); + } + + public T Get() + { + return _host.Services.GetService(); + } + public object Get(Type type) + { + return _host.Services.GetService(type); + } + } +} diff --git a/ExcelHelper.csproj b/ExcelHelper.csproj new file mode 100644 index 0000000..0da09ee --- /dev/null +++ b/ExcelHelper.csproj @@ -0,0 +1,57 @@ + + + net9.0-windows + WinExe + publish\ + true + Disk + false + Foreground + 7 + Days + false + false + true + 0 + 1.0.0.%2a + false + false + true + 12.0 + false + true + true + + + + False + Microsoft .NET Framework 4.8.1 %28x86 和 x64%29 + true + + + False + .NET Framework 3.5 SP1 + false + + + + + 8.3.2 + + + 3.5.1 + + + + 1.34.2 + + + 1.14.1 + runtime; build; native; contentfiles; analyzers; buildtransitive + all + + + + + + \ No newline at end of file diff --git a/ExcelHelper.sln b/ExcelHelper.sln new file mode 100644 index 0000000..a09320b --- /dev/null +++ b/ExcelHelper.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.11.35327.3 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ExcelHelper", "ExcelHelper.csproj", "{C7A7E24D-513F-4D66-9953-42EDBD0038B7}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {C7A7E24D-513F-4D66-9953-42EDBD0038B7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {C7A7E24D-513F-4D66-9953-42EDBD0038B7}.Debug|Any CPU.Build.0 = Debug|Any CPU + {C7A7E24D-513F-4D66-9953-42EDBD0038B7}.Release|Any CPU.ActiveCfg = Release|Any CPU + {C7A7E24D-513F-4D66-9953-42EDBD0038B7}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {F92EF236-3F64-4327-8CF6-C6FDBDC7939E} + EndGlobalSection +EndGlobal diff --git a/MainWindow.xaml b/MainWindow.xaml new file mode 100644 index 0000000..e5dfeb2 --- /dev/null +++ b/MainWindow.xaml @@ -0,0 +1,58 @@ + + + + + + + + + + + + + + + + + + + + + + +