Exemplo n.º 1
0
        public void OnDrop(LinkInput widget, int newIndex)
        {
            if (newIndex == -1)
            {
                newIndex = Links.Count - 1;
            }
            else
            {
                var minIndex = FixedLinksCount;
                if (newIndex < minIndex)
                {
                    newIndex = minIndex;
                }
            }

            Links.Remove(widget);
            Links.Insert(newIndex, widget);
            SaveLinks();
        }
Exemplo n.º 2
0
        private void Remove(LinkInput link)
        {
            PreviousSelectedQueue.Remove(link);

            link.PropertyChanged -= Link_PropertyChanged;
            link.Close           -= OnLinkClose;

            if (SelectedLink == link)
            {
                SelectedLink = PreviousSelectedQueue.DequeueOrDefault() ?? Links[Links.IndexOf(link) - 1];
            }

            if (SelectedLink == link)
            {
                SelectedLink = Links.FirstOrDefault();
            }

            Links.Remove(link);
            SaveLinks();
        }
Exemplo n.º 3
0
        public void AddAndSelect(string value)
        {
            var sameValue = Links.OfType <LinkInput>().FirstOrDefault(x => x.DisplayName == value);

            if (sameValue != null)
            {
                SelectedLink = sameValue;
                return;
            }

            var link = new LinkInput(_source, value);

            link.PropertyChanged += Link_PropertyChanged;
            link.Close           += OnLinkClose;

            Links.Insert(Links.Count - 1, link);
            SelectedLink = link;

            SaveLinks();
        }
Exemplo n.º 4
0
        private void Remove(LinkInput link) {
            PreviousSelectedQueue.Remove(link);

            link.PropertyChanged -= Link_PropertyChanged;
            link.Close -= Link_Close;

            if (SelectedLink == link) {
                SelectedLink = PreviousSelectedQueue.DequeueOrDefault() ?? Links[Links.IndexOf(link) - 1];
            }

            if (SelectedLink == link) {
                SelectedLink = Links.FirstOrDefault();
            }

            Links.Remove(link);
            SaveLinks();
        }
Exemplo n.º 5
0
        public void AddAndSelect(string value) {
            var sameValue = Links.OfType<LinkInput>().FirstOrDefault(x => x.DisplayName == value);
            if (sameValue != null) {
                SelectedLink = sameValue;
                return;
            }

            var link = new LinkInput(_source, value);
            link.PropertyChanged += Link_PropertyChanged;
            link.Close += Link_Close;

            Links.Insert(Links.Count - 1, link);
            SelectedLink = link;

            SaveLinks();
        }