Example #1
0
        public void SetTarget(BattleSortTarget sortTarget, bool reverse)
        {
            var target = this.sortableColumns.FirstOrDefault(x => x.Target == sortTarget);

            if (target == null)
            {
                return;
            }

            if (reverse)
            {
                switch (target.Direction)
                {
                case SortDirection.None:
                    target.Direction = SortDirection.Descending;
                    break;

                case SortDirection.Descending:
                    target.Direction = SortDirection.Ascending;
                    break;

                case SortDirection.Ascending:
                    target = this.noneColumn;
                    break;
                }
            }
            else
            {
                switch (target.Direction)
                {
                case SortDirection.None:
                    target.Direction = SortDirection.Ascending;
                    break;

                case SortDirection.Ascending:
                    target.Direction = SortDirection.Descending;
                    break;

                case SortDirection.Descending:
                    target = this.noneColumn;
                    break;
                }
            }

            this.currentSortTarget = target;
            this.sortableColumns.Where(x => x.Target != target.Target).ForEach(x => x.Direction = SortDirection.None);
        }
Example #2
0
        public BattleSortWorker()
        {
            this.DateColumn      = new DateColumnViewModel();
            this.MvpColumn       = new MvpColumnViewModel();
            this.FlagshipColumn  = new FlagshipColumnViewModel();
            this.GetShipColumn   = new GetShipColumnViewModel();
            this.WinRankColumn   = new WinRankColumnViewModel();
            this.QuestNameColumn = new QuestNameColumnViewModel();

            this.sortableColumns = new List <SortableColumnViewModel>
            {
                this.noneColumn,
                this.DateColumn,
                this.MvpColumn,
                this.FlagshipColumn,
                this.GetShipColumn,
                this.WinRankColumn,
                this.QuestNameColumn
            };

            this.currentSortTarget = this.noneColumn;
        }