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); }
private static void SortBy(VehicleSortingRule sortBy) { var settings = GameClientExplorerSettings.Default; if (VehicleNodeVMBase.VehicleSortingRule == sortBy) { settings.SortTanksDescending = !settings.SortTanksDescending; } else { settings.SortTanksBy = (int)sortBy; } settings.Save(); }