Exemplo n.º 1
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// End the undo task and call commit on root site
        /// </summary>
        /// ------------------------------------------------------------------------------------
        protected virtual void EndTheUndoTask()
        {
            //	Record an action that will handle replacing the selection on redo.
            SetupUndoSelection(false);

            if (ActionHandlerAccessor != null)
            {
                m_dataAccess.EndUndoTask();
            }

            if (m_fCommit && m_vwRootSite != null)
            {
                IVwRootBox rootBox = m_vwRootSite.RootBox;
                if (rootBox != null)
                {
                    IVwSelection vwsel = rootBox.Selection;
                    if (vwsel != null)
                    {
                        vwsel.Commit();
                    }
                }
            }
        }
Exemplo n.º 2
0
 /// <summary>
 ///
 /// </summary>
 public void EndUndoTask()
 {
     m_sda.EndUndoTask();
 }
Exemplo n.º 3
0
 /// <summary>
 /// End the current task sequence. If an outer sequence is in progress, that one will
 /// continue.
 ///</summary>
 public void EndUndoTask()
 {
     m_baseSda.EndUndoTask();
 }
Exemplo n.º 4
0
            int MakeRealObject(ITsString tssTyped)
            {
                // Figure whether owning atomic or owning collection or owning sequence. Throw if none.
                IFwMetaDataCache mdc   = m_fdoCache.MetaDataCacheAccessor;
                FieldType        iType = m_fdoCache.GetFieldType(m_flidEmptyProp);

                iType &= FieldType.kcptVirtualMask;
                ISilDataAccess sdaReal = m_fdoCache.MainCacheAccessor;
                // Make a new object of the specified class in the specified property.
                int ord = 0;

                switch (iType)
                {
                default:
                    throw new Exception("ghost string property must be owning object property");

                case FieldType.kcptOwningAtom:
                    ord = -2;
                    break;

                case FieldType.kcptOwningCollection:
                    ord = -1;
                    break;

                case FieldType.kcptOwningSequence:
                    // ord = 0 set above (inserting the first and only object at position 0).
                    break;
                }
                string sClassRaw = mdc.GetClassName((uint)m_clidDst);
                string sClass    = m_mediator.StringTbl.GetString(sClassRaw, "ClassNames");
                string sUndo     = String.Format(DetailControlsStrings.ksUndoCreate0, sClass);
                string sRedo     = String.Format(DetailControlsStrings.ksRedoCreate0, sClass);

                sdaReal.BeginUndoTask(sUndo, sRedo);
                int hvoNewObj = sdaReal.MakeNewObject((int)m_clidDst, m_hvoObj, m_flidEmptyProp, ord);
                // Set its property m_flidStringProp to tssTyped. If it is multilingual, choose based on ghostWs.
                FieldType iTypeString = m_fdoCache.GetFieldType(m_flidStringProp);

                iTypeString &= FieldType.kcptVirtualMask;
                switch (iTypeString)
                {
                default:
                    throw new Exception("ghost property must store strings!");

                case FieldType.kcptMultiString:
                case FieldType.kcptMultiBigString:
                case FieldType.kcptMultiUnicode:
                case FieldType.kcptMultiBigUnicode:
                    sdaReal.SetMultiStringAlt(hvoNewObj, m_flidStringProp, m_wsToCreate, tssTyped);
                    break;

                case FieldType.kcptString:
                case FieldType.kcptBigString:
                    sdaReal.SetString(hvoNewObj, m_flidStringProp, tssTyped);
                    break;
                }

                string ghostInitMethod = XmlUtils.GetOptionalAttributeValue(m_nodeObjProp, "ghostInitMethod");

                if (ghostInitMethod != null)
                {
                    ICmObject obj     = CmObject.CreateFromDBObject(m_fdoCache, hvoNewObj);
                    Type      objType = obj.GetType();
                    System.Reflection.MethodInfo mi = objType.GetMethod(ghostInitMethod);
                    mi.Invoke(obj, null);
                }
                // Issue PropChanged for the addition of the new object. (could destroy this).
                sdaReal.PropChanged(null, (int)PropChangeType.kpctNotifyAll, m_hvoObj, m_flidEmptyProp, 0, 1, 0);
                sdaReal.EndUndoTask();
                return(hvoNewObj);
            }