private string GetPrefix(PBPATargetType targetType, PBPALocationType locationType) { string prefix = ""; switch (locationType) { case PBPALocationType.Center: prefix = SettingTextMemo.CenterPrefix; break; case PBPALocationType.Top: prefix = SettingTextMemo.TopPrefix; break; case PBPALocationType.Bottom: prefix = SettingTextMemo.BottomPrefix; break; default: break; } return(prefix); }
public override bool LoadData(string data) { if (string.IsNullOrEmpty(data)) { return(false); } try { StringReader sr = new StringReader(data); TargetType_Punch = sr.ReadFormatStringAsBoolean(); TargetType_BranchPipe = sr.ReadFormatStringAsBoolean(); AnnotationType = sr.ReadFormatStringAsEnum <PBPAAnnotationType>(); LocationType = sr.ReadFormatStringAsEnum <PBPALocationType>(); CenterPrefix = sr.ReadFormatString(); TopPrefix = sr.ReadFormatString(); BottomPrefix = sr.ReadFormatString(); return(true); } catch { return(false); } }
private void RegenerateAllFor_Prefix(Document doc, PBPAModelCollection collection, PBPATargetType targetType, PBPALocationType locationType) { string prefix = GetPrefix(targetType, locationType); var dataToChange = collection.Data.Where(c => c.TargetType == targetType && c.LocationType == locationType).ToList(); for (int i = dataToChange.Count - 1; i >= 0; i--) { var model = dataToChange[i]; model.Document = doc; model.IsRegenerate = true; model.AnnotationPrefix = prefix; var element = doc.GetElement(model.TargetId); element.GetParameters(PBPAContext.SharedParameterPL).FirstOrDefault().Set(model.GetFull_L(element)); if (!PBPAContext.Creator.Regenerate(model)) { collection.Data.Remove(model); } } }