SIL.FieldWorks.XWorks.DTMenuHandler.OnMoveDownObjectInSequence C# (CSharp) Method

OnMoveDownObjectInSequence() private method

private OnMoveDownObjectInSequence ( object cmd ) : bool
cmd object
return bool
		public virtual bool OnMoveDownObjectInSequence(object cmd)
		{
			Slice slice = m_dataEntryForm.CurrentSlice;
			Debug.Assert(slice != null, "No slice was current");
			Debug.Assert(!slice.IsDisposed, "The current slice is already disposed??");
			if (slice != null)
			{
				var cache = m_dataEntryForm.Cache;
				int hvoOwner = slice.Object.Owner.Hvo;
				int flid = slice.Object.OwningFlid;
				int chvo = cache.DomainDataByFlid.get_VecSize(hvoOwner, (int)flid);
				int ihvo = cache.DomainDataByFlid.GetObjIndex(hvoOwner, (int)flid, slice.Object.Hvo);
				if (ihvo >= 0 && ihvo + 1 < chvo)
				{
					// The slice might be invalidated by the MoveOwningSequence, so we get its
					// values first.  See LT-6670.
					XmlNode caller = slice.CallerNode;
					XmlNode config = slice.ConfigurationNode;
					int clid = slice.Object.ClassID;
					Control parent = slice.Parent;
					// We found it in the sequence, and it isn't already the last.
					// Quoting from VwOleDbDa.cpp, "Insert the selected records before the
					// DstStart object".  This means we need + 2 instead of + 1 for the
					// new location.
					UndoableUnitOfWorkHelper.Do(xWorksStrings.UndoMoveItem, xWorksStrings.RedoMoveItem, cache.ActionHandlerAccessor,
					()=>cache.DomainDataByFlid.MoveOwnSeq(hvoOwner, (int)flid, ihvo, ihvo,
						hvoOwner, (int)flid, ihvo + 2));
				}
			}
			return true;	//we handled this.
		}