Application.Deactivated 이벤트
정의
중요
일부 정보는 릴리스되기 전에 상당 부분 수정될 수 있는 시험판 제품과 관련이 있습니다. Microsoft는 여기에 제공된 정보에 대해 어떠한 명시적이거나 묵시적인 보증도 하지 않습니다.
애플리케이션이 포그라운드 애플리케이션이 되는 것을 중지할 때 발생합니다.
public:
event EventHandler ^ Deactivated;
public event EventHandler Deactivated;
member this.Deactivated : EventHandler
Public Custom Event Deactivated As EventHandler
Public Event Deactivated As EventHandler
이벤트 유형
예제
다음 예제에서는 독립 실행형 애플리케이션이 비활성화되고 활성화되는 시기를 감지하는 방법을 보여 줍니다.
<Application
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
x:Class="SDKSample.App"
StartupUri="MainWindow.xaml"
Activated="App_Activated"
Deactivated="App_Deactivated" />
using System;
using System.Windows;
namespace SDKSample
{
public partial class App : Application
{
bool isApplicationActive;
void App_Activated(object sender, EventArgs e)
{
// Application activated
this.isApplicationActive = true;
}
void App_Deactivated(object sender, EventArgs e)
{
// Application deactivated
this.isApplicationActive = false;
}
}
}
Imports System.Windows
Namespace SDKSample
Partial Public Class App
Inherits Application
Private isApplicationActive As Boolean
Private Sub App_Activated(ByVal sender As Object, ByVal e As EventArgs)
' Application activated
Me.isApplicationActive = True
End Sub
Private Sub App_Deactivated(ByVal sender As Object, ByVal e As EventArgs)
' Application deactivated
Me.isApplicationActive = False
End Sub
End Class
End Namespace
설명
열려 있는 창이 하나 이상 있는 Windows Presentation Foundation 애플리케이션은 사용자가 다음을 수행할 때 비활성화됩니다(포그라운드 애플리케이션이 되는 것을 중지).
Alt+TAB을 사용하거나 작업 관리자를 사용하여 다른 애플리케이션으로 전환합니다.
다른 애플리케이션의 창에 대한 작업 표시줄 단추를 클릭합니다.
비활성화를 검색해야 하는 애플리케이션은 이벤트를 처리할 Deactivated 수 있습니다.
애플리케이션이 처음 활성화된 후에는 수명 동안 여러 번 비활성화되고 다시 활성화될 수 있습니다. 애플리케이션의 동작 또는 상태가 활성화 상태에 따라 달라지는 경우 이벤트와 Activated 이벤트를 모두 Deactivated 처리하여 해당 상태를 확인할 수 있습니다.
Deactivated XBAP(XAML 브라우저 애플리케이션)에 대해 발생하지 않습니다.