private void UpdateAttributeWindow() { //如果文档为空,则返回 if (document.IsEmpty()) { return; } foreach (AttributeForm AttributeWindow in AllAttWnds.Values) { //如果属性窗口为空,则继续 if (AttributeWindow == null) { continue; } //如果属性窗口已经释放 则继续 if (AttributeWindow.IsDisposed) { continue; } //更新数据 AttributeWindow.UpdateData(); } ////如果属性窗口为空,则返回 //if (AttributeWindow == null) return; ////如果属性窗口已经释放 则返回 //if (AttributeWindow.IsDisposed) return; //调用属性窗口更新函数 //AttributeWindow.UpdateData(); }
public void OpenAttributeWindow(GISLayer layer) { AttributeForm AttributeWindow = null; //如果属性窗口之前已经存在了,就找到它,然后移除记录,稍后统一添加 if (AllAttWnds.ContainsKey(layer)) { AttributeWindow = AllAttWnds[layer]; AllAttWnds.Remove(layer); } //如果属性窗口没有初始化 则初始化 if (AttributeWindow == null) { AttributeWindow = new AttributeForm(layer, this); } //如果窗口资源被释放了 则初始化 if (AttributeWindow.IsDisposed) { AttributeWindow = new AttributeForm(layer, this); } //添加属性窗口与图层的关联记录 AllAttWnds.Add(layer, AttributeWindow); //显示窗口属性 AttributeWindow.Show(); //如果属性窗口最小化了 令他正常显示 if (AttributeWindow.WindowState == FormWindowState.Minimized) { AttributeWindow.WindowState = FormWindowState.Normal; } //吧属性窗口放在最前端显示 AttributeWindow.BringToFront(); }