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的更多相关文章

  1. Handling events in an MVVM WPF application

      Posted: June 30, 2013 | Filed under: MVVM, WPF, XAML |1 Comment In a WPF application that uses the ...

  2. 【转】How to view word document in WPF application

    How to view word document in WPF application (CSVSTOViewWordInWPF) Introduction The Sample demonstra ...

  3. Merging a WPF application into a single EXE(WPF应用程序合并成单个Exe文件)

    I always dislike handing off little applications to people. Not because I can’t, but because of the ...

  4. C# WPF Application 下的文件操作

    好气哦,电脑好烂,每天花大把的时间在等电脑反应上. 没有钱买新电脑,连组台式机的钱都没有.好气哦. 啊啊啊啊文件操作是什么鬼???C++下我都懵了,C#下好多东西要学!!!我不会!我不会!我不会!!! ...

  5. 每天翻译一点点: WPF Application Framework (WAF)

    ps:http://waf.codeplex.com/wikipage?title=Model-View-ViewModel%20Pattern&referringTitle=Document ...

  6. WPF Application 类介绍以及怎样修改启动方式

    因为想要修改wpf的启动方式,所以研究了下Application类,现把一些有用的属性与大家分享下: 属性: Current                  获取当前 AppDomain的 Appl ...

  7. WPF Application

    Application类作为启动的入口,在VS中,通常自动代码为我们继承了Application类,这样做的有点,我还没有理解到,但是我们先学到这个知识点. 为了能够更好的控制整个启动过程,包括得到A ...

  8. vs 编译错误 The name 'InitializeComponent' does not exist in the current context in WPF application

    1:文件命名空间的问题 xaml文件和model.cs文件的命名空间 2:csproj 那么它究竟是给谁用的呢?那是给开发工具用的,例如我们在熟悉不过的Visual Studio,以及大家可以没有接触 ...

  9. WPF Application 执行顺序

    public static void Main() { ApplicationClass.App app = new ApplicationClass.App();app.InitializeComp ...

随机推荐

  1. Namenode服务挂

    BUG修复:HDFS-13112 这两天排查了小集群Crash的问题,这里先总结下这两天排查的结果 一.查看日志 首先查看了Namenode Crash的时候的日志 (一)以下是patch hdfs- ...

  2. centos与debian网卡

    debian    /etc/network/interfaces # This file describes the network interfaces available on your sys ...

  3. SpringMVC 理论

    应用系统三层架构: C/S:客户端/服务器 B/S:浏览器/服务器 标准分层: 表现层:WEB 层,接受结果,响应结果,分发请求:通常客户端使用 http 协议请求 web 层,web 层需要接受 h ...

  4. Content:"\2715",特殊字符和图标

    原文 项目中用到的一些特殊字符和图标 html代码 <div class="cross"></div> css代码 1 2 3 4 5 6 7 8 9 10 ...

  5. ADB命令指令控制Android系统的WIFI连接开启/关闭状态

    Android系统的usb调试已开启,连接电脑(有ADB环境) 1.在cmd中,进入shell指令模式 adb shell 2.进入ROOT指令模式 su 3. 打开WIFI指令 svc wifi e ...

  6. Python locust性能测试框架模板

    locust框架模板 from locust import HttpLocust, TaskSet, task import Queue class UserBehavior(TaskSet): de ...

  7. mac中的word内容丢失

    改了一晚上好不容易快搞完了,结果1万字的内容丢了,并且不知道自己当时怎么想的还清理了回收站 还是用mac自带的工具吧,同时代码也要及时上传github

  8. 系统调用与内存管理(sbrk、brk、mmap、munmap)(转)

    一.系统调用(System Call):在Linux中,4G内存可分为两部分——内核空间1G(3~4G)与用户空间3G(0~3G),我们通常写的C代码都是在对用户空间即0~3G的内存进行操作.而且,用 ...

  9. Base64加密 解密

    using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.T ...

  10. GitLab - 代码仓库管理工具GitLab简介

    1 - GitLab 基于git的开源的仓库管理系统项目,使用git作为代码管理工具,并在此基础上搭建web服务,拥有与Github类似的功能. 社区版(Community Edition,CE) 企 ...