Esempio n. 1
0
        public void SetCommandAtIndex(int index, RelCommand cmd)
        {
            if (index >= _relocations.Count || index < 0)
            {
                return;
            }

            if (_relocations[index].Command != null)
            {
                _relocations[index].Command.Remove();
            }

            _relocations[index].Command = cmd;

            RelCommand c = GetCommandBefore(index);

            if (c != null)
            {
                cmd.InsertAfter(c);
            }
            else
            {
                c = GetCommandAfter(index);
                if (c != null)
                {
                    cmd.InsertBefore(c);
                }
            }
            GetFirstCommand();
        }