/// <summary>
 /// Edit a roof's properties.
 /// </summary>
 /// <param name="item">It contains a roof element.</param>
 private void EditRoofItem(object sender, RoofItem item)
 {
     try
     {
         m_roofsManager.BeginTransaction();
         DialogResult result = DialogResult.None;
         using (RoofEditorForm editorForm = new RoofEditorForm(m_roofsManager, item.Roof))
         {
             result = editorForm.ShowDialog();
         }
         if (result == DialogResult.OK)
         {
             if (m_roofsManager.EndTransaction() == TransactionStatus.Committed)
             {
                 ListView listView = sender as ListView;
                 if (item.Update())
                 {
                     listView.AutoResizeColumns(ColumnHeaderAutoResizeStyle.HeaderSize);
                 }
                 else
                 {
                     m_roofsManager.FootPrintRoofs.Erase(item.Roof);
                     listView.Items.Remove(item);
                     listView.Refresh();
                 }
             }
             else
             {
                 m_roofsManager.AbortTransaction();
             }
         }
         else
         {
             m_roofsManager.AbortTransaction();
         }
     }
     catch (Exception ex)
     {
         TaskDialog.Show("Revit", ex.Message);
         m_roofsManager.AbortTransaction();
     }
 }
Exemple #2
0
 /// <summary>
 /// Edit a roof's properties.
 /// </summary>
 /// <param name="item">It contains a roof element.</param>
 private void EditRoofItem(object sender, RoofItem item)
 {
     try
     {
         m_roofsManager.BeginTransaction();
         DialogResult result = DialogResult.None;
         using (RoofEditorForm editorForm = new RoofEditorForm(m_roofsManager, item.Roof))
         {
             result = editorForm.ShowDialog();
         }
         if (result == DialogResult.OK)
         {
             if (m_roofsManager.EndTransaction() == TransactionStatus.Committed)
             {
                 ListView listView = sender as ListView;
                 if (item.Update())
                 {
                     listView.AutoResizeColumns(ColumnHeaderAutoResizeStyle.HeaderSize);
                 }
                 else
                 {
                     m_roofsManager.FootPrintRoofs.Erase(item.Roof);
                     listView.Items.Remove(item);
                     listView.Refresh();
                 }
             }
             else
             {
                 m_roofsManager.AbortTransaction();
             }
         }
         else
         {
             m_roofsManager.AbortTransaction();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
         m_roofsManager.AbortTransaction();
     }
 }