示例#1
0
 void CheckDifference(PBPASetting origin)
 {
     IsSame_CenterPrefix = SettingTextMemo.CenterPrefix == origin.CenterPrefix;
     IsSame_TopPrefix    = SettingTextMemo.TopPrefix == origin.TopPrefix;
     IsSame_BottomPrefix = SettingTextMemo.BottomPrefix == origin.BottomPrefix;
     IsSame = IsSame_CenterPrefix && IsSame_TopPrefix && IsSame_BottomPrefix;
 }
示例#2
0
        public PBPASetting CloneText()
        {
            PBPASetting newSetting = new PBPASetting("");

            newSetting.CenterPrefix = this.CenterPrefix;
            newSetting.TopPrefix    = this.TopPrefix;
            newSetting.BottomPrefix = this.BottomPrefix;
            return(newSetting);
        }
示例#3
0
        public PBPAViewModel(UIApplication app) : base(app)
        {
            Model = new PBPAModel("");
            View  = new PBPAWindow(this);

            Setting = PBPAContext.GetSetting(Document);
            MemoHelper.SettingTextMemo = Setting.CloneText();
            TargetType_BranchPipe      = Setting.TargetType_BranchPipe;
            TargetType_Punch           = Setting.TargetType_Punch;
            AnnotationType             = Setting.AnnotationType;
            LocationType = Setting.LocationType;
            CenterPrefix = Setting.CenterPrefix;
            TopPrefix    = Setting.TopPrefix;
            BottomPrefix = Setting.BottomPrefix;
        }
示例#4
0
 /// <summary>
 /// 取数据Setting
 /// </summary>
 /// <param name="doc"></param>
 /// <returns></returns>
 public static PBPASetting GetSetting(Document doc)
 {
     Setting = DelegateHelper.DelegateTryCatch(
         () =>
     {
         string data = ExtensibleStorageHelper.GetData(doc, CStorageEntity, CStorageEntity.FieldOfSetting);
         return(new PBPASetting(data));
     },
         () =>
     {
         return(new PBPASetting(""));
     }
         );
     return(Setting);
 }
示例#5
0
        public void UpdateDifference(Document doc, PBPASetting origin, bool needUserConfirm = true)
        {
            bool IsPunchUpdate      = origin.TargetType_Punch;
            bool IsBranchPipeUpdate = origin.TargetType_BranchPipe;

            CheckDifference(origin);
            if (!IsSame)
            {
                if (!needUserConfirm || VLViewModel.ShowQuestion("前缀发生变化,是否更新所对应的标签") == DialogResult.OK)
                {
                    SettingTextMemo = origin.CloneText();
                    VLTransactionHelper.DelegateTransaction(doc, "RegenerateAllFor_L", (Func <bool>)(() =>
                    {
                        var collection = PBPAContext.GetCollection(doc);
                        if (!IsSame_CenterPrefix)
                        {
                            if (IsPunchUpdate)
                            {
                                var targetType   = PBPATargetType.Punch;
                                var locationType = PBPALocationType.Center;
                                RegenerateAllFor_Prefix(doc, collection, targetType, locationType);
                            }
                            if (IsBranchPipeUpdate)
                            {
                                var targetType   = PBPATargetType.BranchPipe;
                                var locationType = PBPALocationType.Center;
                                RegenerateAllFor_Prefix(doc, collection, targetType, locationType);
                            }
                        }
                        if (!IsSame_TopPrefix)
                        {
                            if (IsPunchUpdate)
                            {
                                var targetType   = PBPATargetType.Punch;
                                var locationType = PBPALocationType.Top;
                                RegenerateAllFor_Prefix(doc, collection, targetType, locationType);
                            }
                            if (IsBranchPipeUpdate)
                            {
                                var targetType   = PBPATargetType.BranchPipe;
                                var locationType = PBPALocationType.Top;
                                RegenerateAllFor_Prefix(doc, collection, targetType, locationType);
                            }
                        }
                        if (!IsSame_BottomPrefix)
                        {
                            if (IsPunchUpdate)
                            {
                                var targetType   = PBPATargetType.Punch;
                                var locationType = PBPALocationType.Bottom;
                                RegenerateAllFor_Prefix(doc, collection, targetType, locationType);
                            }
                            if (IsBranchPipeUpdate)
                            {
                                var targetType   = PBPATargetType.BranchPipe;
                                var locationType = PBPALocationType.Bottom;
                                RegenerateAllFor_Prefix(doc, collection, targetType, locationType);
                            }
                        }
                        collection.Save(doc);
                        return(true);
                    }));
                }
            }
            IsSame = true;
        }