浏览代码

Загрузить файлы ''

gr604_gavma 3 年之前
父节点
当前提交
0dc83af7a0
共有 5 个文件被更改,包括 85 次插入0 次删除
  1. 9 0
      App.xaml
  2. 17 0
      App.xaml.cs
  3. 24 0
      AppHelper.cs
  4. 10 0
      AssemblyInfo.cs
  5. 25 0
      WpfApp29.sln

+ 9 - 0
App.xaml

@@ -0,0 +1,9 @@
+<Application x:Class="WpfApp29.App"
+             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+             xmlns:local="clr-namespace:WpfApp29"
+             StartupUri="MainWindow.xaml">
+    <Application.Resources>
+         
+    </Application.Resources>
+</Application>

+ 17 - 0
App.xaml.cs

@@ -0,0 +1,17 @@
+using System;
+using System.Collections.Generic;
+using System.Configuration;
+using System.Data;
+using System.Linq;
+using System.Threading.Tasks;
+using System.Windows;
+
+namespace WpfApp29
+{
+    /// <summary>
+    /// Interaction logic for App.xaml
+    /// </summary>
+    public partial class App : Application
+    {
+    }
+}

+ 24 - 0
AppHelper.cs

@@ -0,0 +1,24 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+
+namespace WpfApp29
+{
+    public class AppHelper
+    {
+        public static T? GetWindowAtType<T>() where T: Window
+        {
+            foreach (var unknownWindoew in App.Current.Windows)
+            {
+                if (unknownWindoew is T window)
+                {
+                    return window;
+                }
+            }
+            return null;
+        }
+    }
+}

+ 10 - 0
AssemblyInfo.cs

@@ -0,0 +1,10 @@
+using System.Windows;
+
+[assembly: ThemeInfo(
+    ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
+                                     //(used if a resource is not found in the page,
+                                     // or application resource dictionaries)
+    ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
+                                              //(used if a resource is not found in the page,
+                                              // app, or any theme specific resource dictionaries)
+)]

+ 25 - 0
WpfApp29.sln

@@ -0,0 +1,25 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio Version 17
+VisualStudioVersion = 17.0.32126.317
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WpfApp29", "WpfApp29\WpfApp29.csproj", "{0F61592E-3D92-4EE6-8413-8FBAF32E7E98}"
+EndProject
+Global
+	GlobalSection(SolutionConfigurationPlatforms) = preSolution
+		Debug|Any CPU = Debug|Any CPU
+		Release|Any CPU = Release|Any CPU
+	EndGlobalSection
+	GlobalSection(ProjectConfigurationPlatforms) = postSolution
+		{0F61592E-3D92-4EE6-8413-8FBAF32E7E98}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{0F61592E-3D92-4EE6-8413-8FBAF32E7E98}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{0F61592E-3D92-4EE6-8413-8FBAF32E7E98}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{0F61592E-3D92-4EE6-8413-8FBAF32E7E98}.Release|Any CPU.Build.0 = Release|Any CPU
+	EndGlobalSection
+	GlobalSection(SolutionProperties) = preSolution
+		HideSolutionNode = FALSE
+	EndGlobalSection
+	GlobalSection(ExtensibilityGlobals) = postSolution
+		SolutionGuid = {29527258-2175-485D-BDA8-38C390D60804}
+	EndGlobalSection
+EndGlobal