private void btn_down_Click(object sender, EventArgs e) { try { ConnlistView.BeginUpdate(); if (ConnlistView.Items.Count != 0) { var curItem = ConnlistView.SelectedItems[0]; var index = curItem.Index; if (index < ConnlistView.Items.Count - 1) { //var tem = (ObjectId)curItem.Tag; ConnlistView.Items.RemoveAt(index); ConnlistView.Items.Insert(index + 1, curItem); ConnlistView.Focus(); ConnlistView.Items[index + 1].Selected = true; ConnlistView.Items[index + 1].Focused = true; ConnlistView.Items[index + 1].EnsureVisible(); } } UpdateList(); ConnlistView.EndUpdate(); } catch (Exception exception) { PublicMethod.Instance.AlertDialog(exception.Message); } }
/// <summary> /// 初始化面板view控件 /// </summary> /// <param name="nodeList"></param> public void InitializeList(List <ObjectId> nodeList) { Autodesk.AutoCAD.ApplicationServices.Application.UpdateScreen(); //this.ConnlistView.View = View.List; ConnlistView.SmallImageList = imageList1; ConnlistView.BeginUpdate(); ObjectId objid; long fno = 0, fid = 0, id = 0; string typeName; //nodeList.Clear(); ConnlistView.Clear(); for (int i = 0; i < nodeList.Count; i++) //for (int i = nodeList.Count - 1; i >= 0; i--) { var lvi = new ListViewItem(); objid = nodeList.ElementAt(i); DBEntityFinder.Instance.GetG3EIds(objid, ref id, ref fid, ref fno); if (FeatureMapping.instance.features.Keys.Contains(fno.ToString())) { typeName = FeatureMapping.instance.features[fno.ToString()]; } else { typeName = "xxxxx"; PublicMethod.Instance.Editor.WriteMessageWithReturn("FeatureMapping字典没有此fno" + fno + "设备"); } string devName = DCadApi.getDevNamebyfidfno(fid, fno); lvi.Tag = objid; //lvi.ImageIndex = i; lvi.Text = (i + 1) + @" " + typeName + @" " + devName; ConnlistView.Items.Add(lvi); } ConnlistView.EndUpdate(); }
private void btn_clean_Click(object sender, EventArgs e) { try { ConnlistView.BeginUpdate(); cleanObjCol(objList, objColDict); ConnlistView.Clear(); objColDict.Clear(); objList.Clear(); ConnlistView.EndUpdate(); } catch (Exception exception) { PublicMethod.Instance.AlertDialog(exception.Message); } }
private void btn_Del_Click(object sender, EventArgs e) { try { ConnlistView.BeginUpdate(); for (var i = 0; i < ConnlistView.SelectedItems.Count;) { var curItem = ConnlistView.SelectedItems[0]; var tem = (ObjectId)curItem.Tag; ConnlistView.Items.Remove(curItem); objColDict.Remove(tem); objList.Remove(tem); } UpdateList(); ConnlistView.EndUpdate(); } catch (Exception exception) { PublicMethod.Instance.AlertDialog(exception.Message); } }