Example #1
0
 int OperationUR(int countSteps = 1, bool undo = true)
 {
     lock (locker)
     {
         isUndo = true;
         if (m_fileWork == null && !m_fileWork.isOpen)
         {
             return(-1);
         }
         for (int a = 0; a < countSteps; a++)
         {
             object ob = new object();
             if (undo)
             {
                 if (!m_fileWork.Undo(ref ob))
                 {
                     return(a);
                 }
             }
             else
             {
                 if (!m_fileWork.Redo(ref ob))
                 {
                     return(a);
                 }
                 else
                 {
                     dataUREventArgs o = ob as dataUREventArgs;
                     if (o != null)
                     {
                         o.ReverceData();
                     }
                 }
             }
             if (mReparsingDataUndoRedo != null)
             {
                 mReparsingDataUndoRedo(m_OnUndoRedoEvent, ob as dataUREventArgs);
             }
         }
         isUndo = false;
     }
     return(countSteps);
 }
Example #2
0
        public void WriteStep(object sender, dataUREventArgs args)
        {
            if (isUndo)
            {
                return;
            }
            if (m_fileWork == null && !m_fileWork.isOpen)
            {
                Error("Фал записи накатов и откатов не открыт. Запись действий не будет выполненна.");
                return;
            }

            if (args == null)
            {
                Error("Аргумент евента с данными нулевой");
                return;
            }

            m_fileWork.Add(args);
        }