Example #1
0
        private static ExplorerTreeContextMenuItemVM CreateSortMenuItem(VehicleSortingRule sortBy)
        {
            string name;

            switch (sortBy)
            {
            case VehicleSortingRule.Class:
                name = Localization.Instance.L("game_client_explorer", "sort_by_class_menu_item");
                break;

            case VehicleSortingRule.Name:
                name = Localization.Instance.L("game_client_explorer", "sort_by_name_menu_item");
                break;

            case VehicleSortingRule.Tier:
                name = Localization.Instance.L("game_client_explorer", "sort_by_tier_menu_item");
                break;

            default:
                throw new ArgumentException("sortBy");
            }
            var menuItem = new ExplorerTreeContextMenuItemVM(0, name, new RelayCommand(() => VehicleNodeVMBase.SortBy(sortBy)));

            menuItem.IsCheckable = true;
            menuItem.IsChecked   = false;
            return(menuItem);
        }
Example #2
0
        static VehicleNodeVMBase()
        {
            s_sortByMenu           = new ExplorerTreeContextMenuItemVM(100, Localization.Instance.L("game_client_explorer", "sort_tanks_by_menu_item"), null);
            s_sortByMenu.IsDefault = false;

            s_sortByMenu.MenuItems.Add(VehicleNodeVMBase.CreateSortMenuItem(VehicleSortingRule.Name));
            s_sortByMenu.MenuItems.Add(VehicleNodeVMBase.CreateSortMenuItem(VehicleSortingRule.Tier));
            s_sortByMenu.MenuItems.Add(VehicleNodeVMBase.CreateSortMenuItem(VehicleSortingRule.Class));

            s_sortByMenuItems = s_sortByMenu.MenuItems.ToArray();

            VehicleNodeVMBase.UpdateSortItemStates();

            GameClientExplorerSettings.Default.PropertyChanged += VehicleNodeVMBase.GameClientExplorerSettings_PropertyChanged;
        }