Esempio n. 1
0
        static void GameClientExplorerSettings_PropertyChanged(object sender, PropertyChangedEventArgs e)
        {
            if (e.PropertyName == "SortTanksBy" || e.PropertyName == "SortTanksDescending")
            {
                VehicleNodeVMBase.UpdateSortItemStates();

                if (VehicleNodeVMBase.VehicleSortingRuleChanged != null)
                {
                    VehicleNodeVMBase.VehicleSortingRuleChanged(null, EventArgs.Empty);
                }
            }
        }
Esempio n. 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;
        }
Esempio n. 3
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);
        }