コード例 #1
0
		private void ProcessIndicesSimpleContext(IFdoOwningSequence<IPhSimpleContext> seq, ICmObject[] ctxts, bool preRemovalSideEffects,
			int idx)
		{
			if (ctxts == null || idx > ctxts.Length - 1 || idx < 0)
				return;

			var c = (IPhSimpleContext) ctxts[idx];
			if (preRemovalSideEffects)
				c.PreRemovalSideEffects();
			seq.Remove(c);
		}
コード例 #2
0
		protected int InsertContextInto(IPhSimpleContext ctxt, SelectionHelper sel, IFdoOwningSequence<IPhSimpleContext> seq)
		{
			ICmObject[] ctxts = seq.Cast<ICmObject>().ToArray();
			int index = GetInsertionIndex(ctxts, sel);
			// if the current selection is a range remove the items we are overwriting
			if (sel.IsRange)
			{
				var indices = GetIndicesToRemove(ctxts, sel);
				foreach (int idx in indices)
				{
					var c = (IPhSimpleContext) ctxts[idx];
					c.PreRemovalSideEffects();
					seq.Remove(c);
				}
			}
			seq.Insert(index, ctxt);
			return index;
		}