1. 程式人生 > >WPF入門之Application屬性方法

WPF入門之Application屬性方法

複製程式碼
using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;

using System.Threading.Tasks;

using System.Windows;

 

namespace WpfApp1

{

    class App

    {

 [STAThread]

        static void Main()

        {

            // 定義Application物件作為整個應用程式入口 

            Application app 
= new Application(); MainWindow win = new MainWindow(); app.ShutdownMode = ShutdownMode.OnMainWindowClose; app.MainWindow = win; //是必須的,否則無法顯示窗體 win.Show(); app.Run(); app.Activated += app_Activated; app.Exit
+= app_Exit; } static void app_Activated(object sender, EventArgs e) { throw new NotImplementedException(); } static void app_Exit(object sender, ExitEventArgs e) { throw new NotImplementedException(); } } }
複製程式碼