1
我一直在試圖實現一種方法來阻止用戶在Powershell中的WPF窗體上手動點擊紅色'x'。在線研究表明,最好的方法是使用表單關閉事件,停止事件並隱藏表單。看來在C#中有很多這樣做的方法,但我似乎找不到任何Powershell。例如,像這樣的東西可以在C#中使用。如何停止Powershell WPF窗體關閉
private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
{
e.Cancel = true;
this.Visibility = Visibility.Hidden;
}
是否有任何相當於我可以在Powershell中使用的東西?
在Powershell中關閉表單的事件是add_Closing
,但我不知道如何停止關閉表單。