示例#1
0
        private void ChangeTemporaryDataCount()
        {
            int oldCount = PeopleTemp.Count;
            int newCount = DataCountTemp;

            // 要素数を合わせる
            if (oldCount < newCount)
            {
                for (int i = oldCount; i < newCount; i++)
                {
                    PeopleTemp.Add(new Person(i));
                }
            }
            else if (oldCount > newCount)
            {
                while (PeopleTemp.Count > newCount)
                {
                    PeopleTemp.RemoveAt(PeopleTemp.Count - 1);
                }
            }
            else
            {
                // nop
            }
        }
示例#2
0
        private void ResetTemporary()
        {
            DataCountTemp = MainModel.DataCount;

            var people = MainModel.People;

            PeopleTemp.Clear();
            for (int i = 0; i < people.Count; i++)
            {
                var person     = people[i];
                var personTemp = (Person)person.Clone();
                PeopleTemp.Add(personTemp);
            }
        }
示例#3
0
        private void ApplyToTemporary()
        {
            int oldCount = DataCountTemp;
            int newCount = MainModel.DataCount;

            // 要素数を合わせる
            if (oldCount < newCount)
            {
                for (int i = oldCount; i < newCount; i++)
                {
                    PeopleTemp.Add(new Person(i));
                }
            }
            else if (oldCount > newCount)
            {
                while (PeopleTemp.Count > newCount)
                {
                    PeopleTemp.RemoveAt(PeopleTemp.Count - 1);
                }
            }
            else
            {
                // nop
            }

            // 各要素のプロパティを適用
            DataCountTemp = newCount;
            var people = MainModel.People;

            for (int i = 0; i < newCount; i++)
            {
                var person = people[i];

                var personTemp = PeopleTemp[i];
                personTemp.Apply(person);
            }
        }