69 lines
1.9 KiB
C#
69 lines
1.9 KiB
C#
using System.ComponentModel;
|
|
using System.Windows;
|
|
|
|
namespace WPF路由事件_4_生命周期;
|
|
|
|
/// <summary>
|
|
/// Interaction logic for MainWindow.xaml
|
|
/// </summary>
|
|
public partial class MainWindow : Window
|
|
{
|
|
public MainWindow()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
|
|
private void FrameworkElement_OnInitialized(object? sender, EventArgs e)
|
|
{
|
|
Console.WriteLine("初始化。。。");
|
|
ListBox.Items.Add("初始化。。。");
|
|
}
|
|
|
|
private void MainWindow_OnSourceInitialized(object? sender, EventArgs e)
|
|
{
|
|
Console.WriteLine("主窗口开始初始化。。。");
|
|
ListBox.Items.Add("主窗口开始初始化。。。");
|
|
}
|
|
|
|
private void MainWindow_OnActivated(object? sender, EventArgs e)
|
|
{
|
|
Console.WriteLine("Activated...");
|
|
ListBox.Items.Add("Activated...");
|
|
}
|
|
|
|
private void FrameworkElement_OnUnloaded(object sender, RoutedEventArgs e)
|
|
{
|
|
Console.WriteLine("加载完成。。。");
|
|
ListBox.Items.Add("加载完成。。。");
|
|
}
|
|
|
|
private void FrameworkElement_OnLoaded(object sender, RoutedEventArgs e)
|
|
{
|
|
Console.WriteLine("开始加载。。。");
|
|
ListBox.Items.Add("开始加载。。。");
|
|
}
|
|
|
|
private void MainWindow_OnContentRendered(object? sender, EventArgs e)
|
|
{
|
|
Console.WriteLine("主窗口---MainWindow_OnContentRendered");
|
|
ListBox.Items.Add("主窗口---MainWindow_OnContentRendered");
|
|
}
|
|
|
|
private void MainWindow_OnClosing(object? sender, CancelEventArgs e)
|
|
{
|
|
Console.WriteLine("Closing...");
|
|
ListBox.Items.Add("Closing...");
|
|
}
|
|
|
|
private void MainWindow_OnDeactivated(object? sender, EventArgs e)
|
|
{
|
|
Console.WriteLine("Deactivated...");
|
|
ListBox.Items.Add("Deactivated...");
|
|
}
|
|
|
|
private void MainWindow_OnClosed(object? sender, EventArgs e)
|
|
{
|
|
Console.WriteLine("Closed...");
|
|
ListBox.Items.Add("Closed...");
|
|
}
|
|
} |