internal void ComputeVisibility(JewelOverrideViewModel jewelOverrideViewModel, SearchStatement searchStatement = null) { if (visibilityMode == DecorationOverrideVisibilityMode.Modified) { if (jewelOverrideViewModel.IsOverriding == false && jewelOverrideViewModel.Count == 0) { jewelOverrideViewModel.IsVisible = false; return; } } else if (visibilityMode == DecorationOverrideVisibilityMode.Unmodified) { if (jewelOverrideViewModel.IsOverriding || jewelOverrideViewModel.Count > 0) { jewelOverrideViewModel.IsVisible = false; return; } } if (searchStatement == null) { searchStatement = SearchStatement.Create(searchText, GlobalData.Instance.Aliases); } jewelOverrideViewModel.ApplySearchText(searchStatement); }
public DecorationsOverrideViewModel(IList <IJewel> jewels, Func <IList <DecorationsSaveSlotInfo>, DecorationsSaveSlotInfo> saveSlotInfoSelector) { this.saveSlotInfoSelector = saveSlotInfoSelector; Jewels = jewels .Select(x => new JewelOverrideViewModel(this, x, 0)) .ToList(); Dictionary <string, DecorationOverrideConfigurationItem> decorationOverrides = GlobalData.Instance.Configuration.InParameters?.DecorationOverride?.Items; CancelCommand = new AnonymousCommand(OnCancel); OpenIntegratedHelpCommand = new AnonymousCommand(OnOpenIntegratedHelp); ImportCommand = new AnonymousCommand(OnImport); if (decorationOverrides != null) { isLoadingConfiguration = true; try { foreach (KeyValuePair <string, DecorationOverrideConfigurationItem> decoOverride in decorationOverrides) { JewelOverrideViewModel vm = Jewels.FirstOrDefault(x => Core.Localization.GetDefault(x.Name) == decoOverride.Key); if (vm != null) { vm.IsOverriding = decoOverride.Value.IsOverriding; vm.Count = decoOverride.Value.Count; } } } finally { isLoadingConfiguration = false; } } }