wpf 多个窗口的显示与隐藏

来源:互联网 发布:dnf趣味数据网址 编辑:程序博客网 时间:2024/06/03 13:11
  //新建一个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();   
0 0