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. 总结调试webview的方式(安卓)

    参考文章: 移动端真机调试指南 Mac 平台 Android 使用 Charles 抓包方法 Charles使用Map Local和Rewrite提高开发效率 通过chrome直接进行调试 chrom ...

  2. ndarray的axis问题

    始终记不住np中axis是对应到哪个,还没系统地去学习下 先暂记两个常用的结果 1.[:,np.newaxis] 与 [np.newaxis, :] 注:这是ndarray才有的分片方法(np重写了[ ...

  3. ci 框架中defined('BASEPATH') OR exit('No direct script access allowed');

    作用: OR 就是前面的是true时,就不走后面了. 加这个是为了防止不是从index.php访问到的控制器

  4. kotlin if

    val max = if (a > b) { print("Choose a") a } else { print("Choose b") b } 注意和 ...

  5. ubuntu如何删除刚添加的源?

    答: sudo add-apt-repository -r <source_url> 如: sudo add-apt-repository -r ppa:linaro-maintainer ...

  6. LC 873. Length of Longest Fibonacci Subsequence

    A sequence X_1, X_2, ..., X_n is fibonacci-like if: n >= 3 X_i + X_{i+1} = X_{i+2} for all i + 2 ...

  7. 魔法方法 __slots__ 方法

    场景解析 网游的用户, 大量的用户本质都是类的实例化对象, 在线人数百万级时对内存是很大的挑战, 如何减少这部分的内存 方法解析 __slots__ 方法 取消默认的类实例中的  __dict__  ...

  8. List自定义对象的排序,根据对象的某一列进行排序

    在工作中,经常需要对List对象集合进行排序操作,下面总结下搞个通用排序对象,原理是使用JAVA的 Comparator    接口实现排序   不多说直接上“干货” 1.存在实体类: @Data @ ...

  9. 一百一十一:CMS系统之后端权限验证功能

    实现方式 使用装饰器的形式,将权限判断加在视图上 声明接口需要什么权限,用户访问接口的时候,判断用户是否有此权限 权限判断,接收权限 def permission_required(permissio ...

  10. Linux服务器端使用tcpdump抓redis报文

    yum update yum install tcpdump tcpdump host -i ens192 -w /tmp/redis-zsetcapture.cap 其中ens192是网卡名, /t ...