private void partListView_MouseDoubleClick(object sender, MouseEventArgs e) { ListView.SelectedListViewItemCollection selItems = partListView.SelectedItems; if (selItems.Count == 1) { ListViewItem item = selItems[0]; long iNestPartID = (long)item.Tag; NestPartEx nestPart = m_nestPartList.GetNestPartByID(iNestPartID); if (nestPart != null) { NestPartForm nestPartForm = new NestPartForm(nestPart); if (nestPartForm.ShowDialog() == DialogResult.OK) { /************************************************************************/ // update the list control. // priority column. item.SubItems[2].Text = nestPart.GetPriority().GetVal().ToString(); // nest count column. item.SubItems[3].Text = nestPart.GetNestCount().ToString(); // priority column. item.SubItems[4].Text = NestHelper.GetRotateAngName(nestPart.GetRotStyle()); /************************************************************************/ } } } }
// add part to list control. private void AddPart_to_listCtrl(NestPartEx nestPart, string order) { // insert a row. int iCount = partListView.Items.Count + 1; ListViewItem item = partListView.Items.Add(iCount.ToString()); // part name column. item.SubItems.Add(nestPart.GetPart().GetName()); // priority column. item.SubItems.Add(nestPart.GetPriority().GetVal().ToString()); // nest count column. item.SubItems.Add(nestPart.GetNestCount().ToString()); // rotate angle column. String strRotateAng = NestHelper.GetRotateAngName(nestPart.GetRotStyle()); string temp = string.Empty; switch (strRotateAng.Trim()) { case "Free Rotate": temp = "自由旋转"; break; case "90 Increment": temp = "90度增量"; break; case "180 Increment": temp = "180度增量"; break; case "0 Fixed": temp = "0度固定"; break; case "90 Fixed": temp = "90度固定"; break; case "180 Fixed": temp = "180度固定"; break; case "270 Fixed": temp = "270度固定"; break; } item.SubItems.Add(temp); // "Part Size" column. Rect2DEx partRect = nestPart.GetPart().GetGeomItemList().GetRectBox(); StringBuilder sb = new StringBuilder(); sb.Append(partRect.GetWidth().ToString("0.00")).Append("(W) * ").Append(partRect.GetHeight().ToString("0.00")).Append("(H)"); item.SubItems.Add(sb.ToString()); //添加订单号 item.SubItems.Add(order); // hold the ID. item.Tag = nestPart.GetID(); OrderManagerDal.Instance.AddOrder(nestPart.GetPart().GetID(), order); }