Пример #1
0
        public void SetUpMessaging()
        {
            postbox = Postbox.InstanceFor(this.GetEditor().GetHashCode());

            postbox.For <FoldClickedMessage>().Invoke(OnFoldClicked)
            .For <ScrollChangedMessage>().Invoke(OnScrollChanged);
        }
Пример #2
0
        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);
        }
Пример #3
0
        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))
                });
            }
        }