WPF——Application
Posted feipeng8848
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了WPF——Application相关的知识,希望对你有一定的参考价值。
Application类处于WPF应用程序的最顶端,main函数就在这个类中。
Application类的作用:
截图连接 https://docs.microsoft.com/zh-cn/dotnet/api/system.windows.application?view=netframework-4.8
https://docs.microsoft.com/zh-cn/dotnet/framework/wpf/app-development/application-management-overview
#region Assembly PresentationFramework, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
// C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.5\\PresentationFramework.dll
#endregion
using System.Collections;
using System.Reflection;
using System.Security;
using System.Windows.Markup;
using System.Windows.Navigation;
using System.Windows.Resources;
using System.Windows.Threading;
namespace System.Windows
public class Application : DispatcherObject, IHaveResources, IQueryAmbient
[SecurityCritical]
public Application();
public static Assembly ResourceAssembly get; set;
public static Application Current get;
public WindowCollection Windows get;
public Window MainWindow get; set;
public ShutdownMode ShutdownMode get; set;
[Ambient]
public ResourceDictionary Resources get; set;
public Uri StartupUri get; set;
public IDictionary Properties get;
public event StartupEventHandler Startup;
public event ExitEventHandler Exit;
public event EventHandler Deactivated;
public event SessionEndingCancelEventHandler SessionEnding;
public event DispatcherUnhandledExceptionEventHandler DispatcherUnhandledException;
public event NavigatingCancelEventHandler Navigating;
public event NavigatedEventHandler Navigated;
public event NavigationProgressEventHandler NavigationProgress;
public event NavigationFailedEventHandler NavigationFailed;
public event LoadCompletedEventHandler LoadCompleted;
public event EventHandler Activated;
public event NavigationStoppedEventHandler NavigationStopped;
public event FragmentNavigationEventHandler FragmentNavigation;
[SecurityCritical]
public static StreamResourceInfo GetContentStream(Uri uriContent);
public static string GetCookie(Uri uri);
[SecurityCritical]
public static StreamResourceInfo GetRemoteStream(Uri uriRemote);
[SecurityCritical]
public static StreamResourceInfo GetResourceStream(Uri uriResource);
public static object LoadComponent(Uri resourceLocator);
[SecurityCritical]
public static void LoadComponent(object component, Uri resourceLocator);
public static void SetCookie(Uri uri, string value);
public object FindResource(object resourceKey);
[SecurityCritical]
public int Run(Window window);
public int Run();
public void Shutdown();
[SecurityCritical]
public void Shutdown(int exitCode);
public object TryFindResource(object resourceKey);
protected virtual void OnActivated(EventArgs e);
protected virtual void OnDeactivated(EventArgs e);
protected virtual void OnExit(ExitEventArgs e);
protected virtual void OnFragmentNavigation(FragmentNavigationEventArgs e);
protected virtual void OnLoadCompleted(NavigationEventArgs e);
protected virtual void OnNavigated(NavigationEventArgs e);
protected virtual void OnNavigating(NavigatingCancelEventArgs e);
protected virtual void OnNavigationFailed(NavigationFailedEventArgs e);
protected virtual void OnNavigationProgress(NavigationProgressEventArgs e);
protected virtual void OnNavigationStopped(NavigationEventArgs e);
protected virtual void OnSessionEnding(SessionEndingCancelEventArgs e);
protected virtual void OnStartup(StartupEventArgs e);
在xml文件中指定启动的Page或者Windows就可启动窗体。
以上是关于WPF——Application的主要内容,如果未能解决你的问题,请参考以下文章
WPF 中的 Application.DoEvents() 在哪里?
SpringBoot中表单提交报错“Content type ‘application/x-www-form-urlencoded;charset=UTF-8‘ not supported“(代码片段
add application window with unknown token XXX Unable to add window;is your activity is running?(代码片段
add application window with unknown token XXX Unable to add window;is your activity is running?(代码片段
C#-WebForm-★内置对象简介★Request-获取请求对象Response相应请求对象Session全局变量(私有)Cookie全局变量(私有)Application全局公共变量Vi(代码片段