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

OnDisplayMoveUpObjectInSequence() private method

private OnDisplayMoveUpObjectInSequence ( object commandObject, XCore.UIItemDisplayProperties &display ) : bool
commandObject object
display XCore.UIItemDisplayProperties
return bool
		public virtual bool OnDisplayMoveUpObjectInSequence(object commandObject,
			ref UIItemDisplayProperties display)
		{
			Slice slice = m_dataEntryForm.CurrentSlice;
			Debug.Assert(slice == null || !slice.IsDisposed, "The current slice is already disposed??");
			if (slice == null || slice.Object == null)
			{
				display.Enabled = false;
				display.Visible = false;
				return true;
			}
			var cache = m_dataEntryForm.Cache;
			// FWR-2742 Handle a slice Object (like LexEntry) being unowned (and OwningFlid = 0)
			var type = CellarPropertyType.ReferenceAtomic;
			if (slice.Object.OwningFlid > 0)
				type = (CellarPropertyType) cache.DomainDataByFlid.MetaDataCache.GetFieldType(slice.Object.OwningFlid);
			if (type != CellarPropertyType.OwningSequence && type != CellarPropertyType.ReferenceSequence)
			{
				display.Enabled = false;
				display.Visible = false;
				return true;
			}
			int chvo = cache.DomainDataByFlid.get_VecSize(slice.Object.Owner.Hvo, (int)slice.Object.OwningFlid);
			if (chvo < 2)
			{
				display.Enabled = false;
			}
			else
			{
				int hvo = cache.DomainDataByFlid.get_VecItem(slice.Object.Owner.Hvo, (int)slice.Object.OwningFlid,
					0);
				display.Enabled = slice.Object.Hvo != hvo;
				// if the first LexEntryRef in LexEntry.EntryRefs is a complex form, and the
				// slice displays the second LexEntryRef in the sequence, then we can't move it
				// up, since the first slot is reserved for the complex form.
				if (display.Enabled && slice.Object.OwningFlid == LexEntryTags.kflidEntryRefs)
				{
					if (cache.DomainDataByFlid.get_VecSize(hvo, LexEntryRefTags.kflidComplexEntryTypes) > 0)
					{
						int hvo1 = cache.DomainDataByFlid.get_VecItem(slice.Object.Owner.Hvo, (int)slice.Object.OwningFlid, 1);
						display.Enabled = slice.Object.Hvo != hvo1;
					}
				}
			}
			display.Visible = true;
			return true; //we've handled this
		}