Beispiel #1
0
        /// <summary>
        /// Shorthand call to run both collection updates.
        /// </summary>
        private void UpdateVoteCollections()
        {
            VoteView1.Refresh();
            VoteView2.Refresh();

            if (lastPosition1 > VoteView1.Count)
            {
                VoteView1.MoveCurrentToLast();
            }
            else
            {
                VoteView1.MoveCurrentToPosition(lastPosition1);
            }

            if (lastPosition2 < 0)
            {
                VoteView2.MoveCurrentTo(lastSelected2 ?? "");
            }
            else if (lastPosition2 > VoteView2.Count)
            {
                VoteView2.MoveCurrentToLast();
            }
            else
            {
                VoteView2.MoveCurrentToPosition(lastPosition2);
            }

            // Retain the new position.
            lastPosition1 = VoteView1.CurrentPosition;
            lastPosition2 = VoteView2.CurrentPosition;
        }