Example #1
0
 private void CurrentChanging(ItemPreviewModel oldValue)
 {
     if (oldValue == null)
     {
         return;
     }
     oldValue.GeometryInfo.ValueChanged -= CurrentGeoChanged;
 }
Example #2
0
 private void CurrentChanged(ItemPreviewModel newValue)
 {
     if (newValue != null)
     {
         newValue.GeometryInfo.ValueChanged += CurrentGeoChanged;
     }
     if (Mode == SelectionMode.Current)
     {
         UpdateFromCurrent();
     }
 }
Example #3
0
        public void Receive(SearchChangedMessage message)
        {
            if (message.SearchTags.SequenceEqual(_currentSearchTags))
            {
                return;
            }
            _currentSearchTags = message.SearchTags ?? Enumerable.Empty <string>();

            var data = _library.GetItemPreviewMetadata(message.SearchTags);

            _items.SetSource(data);
            _lastToggled = null;
        }
Example #4
0
        public void Receive(SelectionChangedMessage message)
        {
            var sender = message.Sender;

            if (SelectRange)
            {
                // Block subsequent select handler calls ...
                SelectRange = false;

                var lastPos = _lastToggled != null ? -1 : 0;
                var newPos  = -1;
                for (var i = 0; i < _items.Count; i++)
                {
                    if (lastPos != -1 && newPos != -1)
                    {
                        break;
                    }
                    if (_items[i] == sender)
                    {
                        newPos = i;
                    }
                    if (_items[i] == _lastToggled)
                    {
                        lastPos = i;
                    }
                }

                if (lastPos != -1)
                {
                    var start = Mathf.Min(lastPos, newPos);
                    var end   = Mathf.Max(lastPos, newPos);
                    if (lastPos > newPos)
                    {
                        end++;
                    }

                    using (NotifyMassSelection())
                    {
                        for (var i = start; i < end; i++)
                        {
                            // ... from here
                            _items[i].Selected.Value = sender.Selected;
                        }
                    }
                }
            }

            _lastToggled = sender;
        }
Example #5
0
        private void CurrentChanged(ItemPreviewModel current)
        {
            if (Mode != Current)
            {
                return;
            }
            if (current == null)
            {
                Tags.Clear();
                return;
            }

            var filtered = Filter(current.Tags);

            Tags.ChangeTo(filtered.Select(text => new TagModel(text, RemoveTag)));
        }