Esempio n. 1
0
 protected virtual void DenoteEmptyUnSelectedList(MutableObject mutable, MutableObject defaultObject)
 {
     if (!UnSelectedList.Any())
     {
         UnSelectedList.Add(defaultObject);
     }
 }
Esempio n. 2
0
 protected void bttnLeft_Click(object sender, EventArgs e)
 {
     try
     {
         foreach (ListItem item in lstSelected.Items)
         {
             if (item.Selected)
             {
                 StrategyInfo info = StrategyConfigs.Instance[item.Value.Trim()];
                 if (info == null)
                 {
                     continue;
                 }
                 UnSelectedList.Add(info);
                 //SelectedList.Remove(info);
                 Remove(SelectedList, info);
             }
         }
         bindData();
     }
     catch (Exception ex)
     {
         Messages.ShowError("当前操作出错!<br />详细信息:" + ex.Message);
     }
 }
Esempio n. 3
0
        public IEnumerator Deselect(VisualPayload payload)
        {
            SelectedList.Remove(payload);

            UnSelectedList.Add(payload);

            payload.VisualData.Bound.ClearBounds();

            IEnumerator iterator;

            if (!SelectedList.Any())
            {
                iterator = SendNoneSelected();
                while (iterator.MoveNext())
                {
                    yield return(null);
                }
            }
            else
            {
                iterator = NormalState.Transmit(payload);
                while (iterator.MoveNext())
                {
                    yield return(null);
                }
            }

            iterator = TransmitMultiStates();
            while (iterator.MoveNext())
            {
                yield return(null);
            }
        }
Esempio n. 4
0
        public IEnumerator Deselect(IEnumerable <VisualPayload> payloads)
        {
            if (!payloads.Any())
            {
                yield return(null);

                yield break;
            }

            IEnumerator iterator;

            foreach (var payload in payloads)
            {
                if (UnSelectedList.Contains(payload))
                {
                    continue;
                }

                SelectedList.Remove(payload);
                UnSelectedList.Add(payload);
            }

            //var newNodeState = SelectedList.Count == 0 ? NoneSelectedState : NormalState;

            if (SelectedList.Any())
            {
                foreach (var payload in payloads)
                {
                    payload.VisualData.Bound.ClearBounds();

                    iterator = NormalState.Transmit(payload);
                    while (iterator.MoveNext())
                    {
                        yield return(null);
                    }
                }
            }
            else
            {
                iterator = SendNoneSelected();
                while (iterator.MoveNext())
                {
                    yield return(null);
                }
            }


            iterator = TransmitMultiStates();
            while (iterator.MoveNext())
            {
                yield return(null);
            }
        }
        protected override void SelectGroups(List <MutableObject> entry)
        {
            SelectedList.Clear();
            UnSelectedList.Clear();

            var maintainCountAtEdges = MaintainCountAtEdgesField.GetLastKeyValue(entry.Last());

            var entries      = EntryField.GetEntries(entry);
            var entriesCount = entries.Count();

            if (entriesCount == 0)
            {
                Debug.LogError("What?  Empty entries?");
            }

            var beforeWidth = SelectBeforeCount.GetLastKeyValue(entry.Last());
            var afterWidth  = SelectAfterCount.GetLastKeyValue(entry.Last());

            var lowerBound = maintainCountAtEdges?Mathf.Min(beforeWidth, entriesCount - 1):0;
            var upperBound = maintainCountAtEdges ? Mathf.Max(entriesCount - afterWidth - 1, 0) : entriesCount - 1;

            if (lowerBound >= upperBound)
            {
                // use the lower of the two values for both bounds to avoid overlap
                lowerBound = Mathf.Min(lowerBound, upperBound);
                upperBound = Mathf.Min(lowerBound, upperBound);
            }

            var index = Mathf.Clamp(CenterIndex.GetLastKeyValue(entry.Last()),
                                    lowerBound, upperBound);

            var minIndex = Mathf.Max(index - beforeWidth, 0);
            var maxIndex = Mathf.Min(index + afterWidth, entriesCount - 1);

            //var i = 0;
            //foreach ( var entry in entries )
            //{
            //    if ( i < minIndex )
            //    UnSelectedList.
            //}

            bool selectedListOnly = SelectedListOnly.GetValue(entry);

            int currentIndex = 0;

            if (selectedListOnly)
            {
                foreach (var subEntry in EntryField.GetEntries(entry))
                {
                    if (currentIndex > maxIndex)
                    {
                        break;
                    }
                    if (currentIndex >= minIndex)
                    {
                        SelectedList.Add(subEntry.Last());
                    }
                    currentIndex++;
                }
            }
            else
            {
                foreach (var subEntry in EntryField.GetEntries(entry))
                {
                    if (currentIndex < minIndex || currentIndex > maxIndex)
                    {
                        UnSelectedList.Add(subEntry.Last());
                    }
                    else
                    {
                        SelectedList.Add(subEntry.Last());
                    }

                    currentIndex++;
                }
            }
        }