public void ResolveAs(Side side) { ResultBlock result; if (!HasSide(side)) { result = new ResultBlock(string.Empty, PrevBlock); } else if (side == Side.Left) { result = new ResultBlock(left, PrevBlock); } else { result = new ResultBlock(right, PrevBlock); } result.NextBlock = NextBlock; if (NextBlock != null) { NextBlock.PrevBlock = result; } RebuildRequested?.Invoke(this, new RebuildRequestEventArgs(result)); }
private void Result_RebuildRequested(object sender, RebuildRequestEventArgs e) { if (Root == sender) { Root = e.First; } (sender as ResultBlock).RebuildRequested -= Result_RebuildRequested; RebuildRequested?.Invoke(sender, e); }
public void ResolveAs(Side first, Side second) { RebuildRequestEventArgs args; ResultBlock firstBlock = null; ResultBlock secondBlock = null; var current = this; if (HasSide(first)) { ResultBlock result; if (first == Side.Left) { result = new ResultBlock(left, PrevBlock); } else { result = new ResultBlock(right, PrevBlock); } result.NextBlock = NextBlock; if (NextBlock != null) { current.NextBlock.PrevBlock = result; } firstBlock = current = result; } if (HasSide(second)) { ResultBlock result; var prev = HasSide(first) ? current : PrevBlock; if (second == Side.Left) { result = new ResultBlock(left, prev); } else { result = new ResultBlock(right, prev); } result.NextBlock = NextBlock; if (NextBlock != null) { current.NextBlock.PrevBlock = result; } if (current == this) { firstBlock = current = result; } else { secondBlock = result; } } args = new RebuildRequestEventArgs(firstBlock, secondBlock); RebuildRequested?.Invoke(this, args); RebuildRequested = null; }