//新建一个lamda的用来开启前台Ui线程,显示gif动画,并置顶
this.Dispatcher.Invoke(new Action(() =>
{
GlobalHelper._mainWindow.grid_prograssbar.Visibility = Visibility.Visible;
System.Windows.Controls.Panel.SetZIndex(GlobalHelper._mainWindow.grid_prograssbar, 10000 * 1000);
}));
//检测gif动画线程是否开启,如果之前存在,关闭,并释放资源
if (this._threadGif != null)
{
this._threadGif.Abort();
this._threadGif = null;
}
//新建一个lambda表达示:用来不停的检测切换函数是否执行完毕,如果执行完毕就关闭gif动画,并线程的资源和把标志量还原为false
this._threadGif = new Thread(() =>
{
while (true)
{
if (this._bIsOverofPanelAnaly == true)
{
this.Dispatcher.Invoke(new Action(() =>
{
GlobalHelper._mainWindow.grid_prograssbar.Visibility = Visibility.Hidden;
}));
this._bIsOverofPanelAnaly = false;
this._threadPanelAnaly.Abort();
this._threadPanelAnaly = null;
this._threadGif.Abort();
this._threadGif = null;
}
}
});
//开启gif显示线程
this._threadGif.Start();
//开启切换方法函数的线程
if (this._threadPanelAnaly != null)
{
this._threadPanelAnaly.Abort();
this._threadPanelAnaly = null;
}
this._threadPanelAnaly = new Thread(BigPanelAnaly);
this._threadPanelAnaly.Start();
wpf 多个窗口的显示与隐藏
最新推荐文章于 2022-11-21 15:02:00 发布