C#等待另一个打开的窗口关闭,然后再执行其余的功能

时间:2015-07-27 12:56:24

标签: c# wpf

我创建了2个WPF窗口。

对于窗口1:

//Get IC Detail First
COAKeyInAccountICCanvas COAKeyInAccountCanvas = new COAKeyInAccountICCanvas(this, _PrinterIsOn);
COAKeyInAccountCanvas.Topmost = true;
COAKeyInAccountCanvas.Show();

if(CheckCOAKeyInICStatus.checkCOAKeyInAccountICStatus == true)
{
    //Check User Ownership
    checkCOAOwner.Visibility = Visibility.Visible; // let user to choose whether is owner or representer
}
else
{
    accountNumber = "";
    checkCOAOwner.Visibility = Visibility.Hidden;
    GetAccountCanvas.Visibility = Visibility.Visible;
}

最初,COAKeyinAccountCanvas窗口会检查并将CheckCOAKeyInICStatus.checkCOAKeyInAccountICStatus更新为" false "或" true "。

如何在COAKeyInAccountCanvas窗口完成所有功能之前取消执行if-else语句功能?

1 个答案:

答案 0 :(得分:4)

使用:

COAKeyInAccountCanvas.ShowDialog();

代替:

COAKeyInAccountCanvas.Show();