public void SetUpMessaging() { postbox = Postbox.InstanceFor(this.GetEditor().GetHashCode()); postbox.For <FoldClickedMessage>().Invoke(OnFoldClicked) .For <ScrollChangedMessage>().Invoke(OnScrollChanged); }
public void SetUpMessaging() { postbox = Postbox.InstanceFor(this.GetEditor().GetHashCode()); postbox.For(typeof(TextAddedMessage)).Invoke(OnTextAdded) .For(typeof(TextRemovedMessage)).Invoke(OnTextRemoved) .For(typeof(LinesRemovedMessage)).Invoke(OnLineRemoved) .For(typeof(FoldClickedMessage)).Invoke(OnFoldClicked); }
private void OnScrollChanged(object sender, ScrollChangedEventArgs evt) { if (evt.VerticalChange != 0) { var firstIdx = (int)Math.Round(evt.VerticalOffset / TextConfiguration.GetCharSize().Height); var lastIdx = (int)Math.Round((evt.VerticalOffset + evt.ViewportHeight) / TextConfiguration.GetCharSize().Height); Postbox.InstanceFor(GetHashCode()).Put(new ScrollChangedMessage { FirstVisibleLineIndex = firstIdx, LastVisibleLineIndex = lastIdx, LinesScrolled = Math.Abs((int)Math.Ceiling(evt.VerticalChange / TextConfiguration.GetCharSize().Height)) }); } }