Пример #1
0
        public void AddControl(string key)
        {
            ServicesProfile profile = Wkl.MainCtrl.ServiceCtrl.GetProfile(key);

            PdmServiceProfile pdmProfile = profile.PdmProfile;

            profile.ContentService.MarkProntDoc = true;

            Word.Range rangeToInsert = Wkl.MainCtrl.CommonCtrl.CommonProfile.CurrentSelection.Range;
            rangeToInsert.Collapse(Word.WdCollapseDirection.wdCollapseEnd);

            try
            {
                ControlBase control = Add(pdmProfile.ControlType, rangeToInsert);

                pdmProfile.Control = control;

                ControlEventBinding(key);

                MarkProntoDoc(key);
            }
            catch (Exception ex)
            {
                profile.Error   = ex;
                profile.Message = ex.Message;
            }
        }
Пример #2
0
        private void PdmService_ControlEventBinding(string key)
        {
            PdmServiceProfile serviceProfile = Wkl.MainCtrl.ServiceCtrl.GetProfile(key).PdmProfile;
            ManagerProfile    managerProfile = Wkl.MainCtrl.ManagerCtrl.CreateProfile(key);

            managerProfile.PdmControl         = serviceProfile.Control;
            managerProfile.IsAddingPdmControl = serviceProfile.IsAdding;
            managerProfile.ServiceType        = ServiceType.ContentService;
            managerProfile.EventType          = EventType.ControlEventBinding;

            MainEvent(key);

            Wkl.MainCtrl.ManagerCtrl.RemoveDataObject(key);
        }
Пример #3
0
        public void Restore(string key)
        {
            VstoWord.Document doc = _vstoDoc;

            doc.RestoreControls();

            PdmServiceProfile profile = Wkl.MainCtrl.ServiceCtrl.GetProfile(key).PdmProfile;

            foreach (var control in doc.Controls.GetValidItems())
            {
                profile.Control  = control;
                profile.IsAdding = false;

                ControlEventBinding(key);
            }
        }