Esempio n. 1
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. 2
0
        private void RemoveItemExecute(object obj)
        {
            Payment payment = obj as Payment;

            if (SelectedList.Contains(payment))
            {
                SelectedList.Remove(payment);
                TotalSumToPay = TotalSumToPay - payment.Sum;
            }
        }
Esempio n. 3
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);
            }
        }
Esempio n. 4
0
        private void btnMoveLeft_Click(object sender, RoutedEventArgs e)
        {
            int old = lvRight.SelectedIndex; // this is used to preserve the user's previous position in the list

            foreach (RecordEntitySetting l in this.lvRight.SelectedItems)
            {
                SelectedList.Remove(l);
                l.IsRecorded = false;
            }

            UpdateListViews();
            lvRight.SelectedIndex = old < lvRight.Items.Count ? old : lvRight.Items.Count - 1;
        }
Esempio n. 5
0
        /// <summary>
        /// Move selected item down
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnMoveDown_Click(object sender, RoutedEventArgs e)
        {
            var list = from RecordEntitySetting item in this.lvRight.SelectedItems
                       orderby SelectedList.IndexOf(item) descending
                       select new Tuple <RecordEntitySetting, int>(item, SelectedList.IndexOf(item));

            foreach (var l in list)
            {
                SelectedList.Remove(l.Item1);
                SelectedList.Insert(l.Item2 + 1, l.Item1);
            }

            UpdateReorderButtons();
            UpdateListViews();
        }
Esempio n. 6
0
        /// <summary>
        /// Switch listviewitem side on doubleclick
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void ListViewItem_MouseDoubleClick(object sender, MouseButtonEventArgs e)
        {
            var lvi      = sender as ListViewItem;
            var listView = ItemsControl.ItemsControlFromItemContainer(lvi) as ListView;
            var records  = from l in this.List where l.Id == (lvi.Content as RecordEntitySetting).Id select l;
            var record   = records.FirstOrDefault();

            if (listView == lvLeft)
            {
                SelectedList.Add(record);
                record.IsRecorded = true;
            }
            else
            {
                SelectedList.Remove(lvi.Content as RecordEntitySetting);
                record.IsRecorded = false;
            }
            UpdateListViews();
        }
Esempio n. 7
0
        public void Remove(Data.Skill.Skill skill)
        {
            List <Data.Skill.Skill> SelectedList;
            int limit;

            if (skill == null)
            {
                Debug.Log("ConstellationPreset.Remove() skill null");
                throw new Exception();
            }

            switch (skill.Category)
            {
            case Data.Skill.Skill.ECategory.Ability:
                SelectedList = SelectedAbilityList;
                limit        = App.Content.GameSettings.NumAbilities;
                break;

            case Data.Skill.Skill.ECategory.Class:
                SelectedList = SelectedClassList;
                limit        = App.Content.GameSettings.NumClasses;
                break;

            case Data.Skill.Skill.ECategory.Kit:
                SelectedList = SelectedKitList;
                limit        = App.Content.GameSettings.NumKits;
                break;

            default:
                Debug.Log("ConstellationPreset.Remove() skill no type");
                throw new Exception();
            }

            if (SelectedList.Count == 0 || !SelectedList.Contains(skill))
            {
                Debug.Log("ConstellationPreset.Remove() can't");
                throw new Exception();
            }

            /*if (skill.Type == Skill.TypeEnum.Ability)
             * {
             *      //clear if preset doesn't contain a starting node
             *      bool hasStartingAbility = false;
             *      foreach (var startingAbilityNodeIndex in Constellation.StartingAbilityNodeIndexList)
             *      {
             *              Skill startingSkill = Constellation.AbilityNodeList[startingAbilityNodeIndex].Skill;
             *              if (SelectedAbilityList.Contains(startingSkill))
             *              {
             *                      hasStartingAbility = true;
             *                      break;
             *              }
             *      }
             *      if (!hasStartingAbility)
             *      {
             *              Clear();
             *              return;
             *      }
             *
             *      SelectedAbilityList.Remove(skill);
             *      //unselect classes and kits that were solely dependent on this ability
             *      var newSelectedClassList = new List<Skill>();
             *      foreach (var selectedClass in SelectedClassList)
             *      {
             *              var selectedClassNode = Constellation.ClassNode(selectedClass);
             *              foreach (var selectedAbility in SelectedAbilityList)
             *              {
             *                      if (Constellation.AbilityNode(selectedAbility).ClassNodeList.Contains(selectedClassNode))
             *                      {
             *                              newSelectedClassList.Add(selectedClass);
             *                              break;
             *                      }
             *              }
             *      }
             *      SelectedClassList = newSelectedClassList;
             *      var newSelectedKitList = new List<Skill>();
             *      foreach (var selectedKit in SelectedKitList)
             *      {
             *              var selectedKitNode = Constellation.KitNode(selectedKit);
             *              foreach (var selectedAbility in SelectedAbilityList)
             *              {
             *                      if (Constellation.AbilityNode(selectedAbility).KitsNodeList.Contains(selectedKitNode))
             *                      {
             *                              newSelectedKitList.Add(selectedKit);
             *                              break;
             *                      }
             *              }
             *      }
             *      SelectedKitList = newSelectedKitList;
             * }
             * else*/
            SelectedList.Remove(skill);

            PresetUpdated();
        }