Exemple #1
0
 private void RenameSection(SectionNameDetail sectionNameDetail)
 {
     using (Transaction t = new Transaction(_document, "rename sections")) {
         try {
             t.Start();
             for (int i = 0; i < _sections.Count; i++)
             {
                 var viewNameParam = _sections[i].LookupParameter("View Name");
                 if (viewNameParam != null)
                 {
                     if (!string.IsNullOrEmpty(sectionNameDetail.Suffiexs))
                     {
                         viewNameParam.Set($"{sectionNameDetail.Prefix}-{i + 1}-{sectionNameDetail.Suffiexs}");
                     }
                     else
                     {
                         viewNameParam.Set($"{sectionNameDetail.Prefix}-{i + 1}");
                     }
                 }
             }
             t.Commit();
             TaskDialog.Show("Section", "Đổi tên Section thành công");
         }
         catch (Exception ex) {
             if (t.HasStarted())
             {
                 t.RollBack();
             }
             TaskDialog.Show("Error", ex.StackTrace);
         }
     }
 }
Exemple #2
0
 private void SendSectionName(SectionNameDetail sectionNameDetail)
 {
     _sectionNameDetail = sectionNameDetail;
 }