/// <summary> /// 关闭等待窗口 /// </summary> public void Close() { try { this._dispatcher?.BeginInvoke(new Action(delegate { waiting?.Close(); waiting = null; })); } catch (Exception ex) { throw ex; } }
/// <summary> /// 显示等待窗口 /// </summary> /// <param name="parentWindow">拥有该窗口的父窗口,一般传入当前窗口:this</param> /// <param name="message">显示的文本</param> public void Show(Window parentWindow, string message = "请稍等") { if (waiting == null) { Task.Run(() => { // 更新UI显示 this._dispatcher?.BeginInvoke(new Action(delegate { waiting = new Waiting(parentWindow, message.ToString()); waiting.Show(); })); }); } }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: this.Wait = ((WpfThemes.BusyIndicator.Waiting)(target)); return; case 2: this.mainBorder = ((System.Windows.Controls.Border)(target)); return; case 3: this.ProgressBar1 = ((WpfThemes.BusyIndicator.DZProgressBar)(target)); return; } this._contentLoaded = true; }