private void OnCommandEnd(object sender, CommandEventArgs e)
 {
     if (e.GlobalCommandName.CompareTo("REVCLOUD") == 0)
     {
         Document doc = Application.DocumentManager.MdiActiveDocument;
         Database db  = doc.Database;
         PromptSelectionResult lastRes = doc.Editor.SelectLast();
         if (lastRes.Value != null && lastRes.Value.Count == 1)
         {
             //先给云线改颜色
             using (Transaction tr = db.TransactionManager.StartTransaction())
             {
                 //绑定数据
                 Autodesk.AutoCAD.Colors.Color selectedColor = Autodesk.AutoCAD.Colors.Color.FromRgb(255, 0, 0);
                 int index = ToolPanel.currentConnectedType;
                 if (index == 1)
                 {
                     selectedColor = Autodesk.AutoCAD.Colors.Color.FromRgb(233, 150, 122);
                 }
                 else if (index == 2)
                 {
                     selectedColor = Autodesk.AutoCAD.Colors.Color.FromRgb(30, 144, 255);
                 }
                 else if (index == 3)
                 {
                     selectedColor = Autodesk.AutoCAD.Colors.Color.FromRgb(102, 249, 207);
                 }
                 doc.Editor.WriteMessage(index.ToString());
                 if (index != 0)
                 {
                     Entity ent = (Entity)tr.GetObject(lastRes.Value[0].ObjectId, OpenMode.ForRead);
                     ent.UpgradeOpen();
                     ent.Color = selectedColor;
                     //是否继续循环
                 }
                 tr.Commit();
                 //Utility.makeImageBottom();
             }
             District district = new District(currentSolution);
             district.BaseObjectId = lastRes.Value[0].ObjectId;
             Error err = district.CheckAndSave(ToolPanel.currentConnectedType);
             if (err.Err != Error.ErrorCode.NoErr)
             {
                 System.Windows.MessageBox.Show(err.Message);
                 district.RemoveSelf();
             }
             currentSolution.Districts.Add(district.BaseObjectId, district);
             //MessageBox.Show("in");
             ToolPanel.DrawCloudLine();
         }
     }
 }