private static readonly Regex Regex = new Regex("[^0-9.-]+"); // regex that matches disallowed text public MechSelectorWindow(ModCopyModel modCopyModel) { this.WindowStartupLocation = WindowStartupLocation.Center; Self = this; this.MechSelectorModel = new MechSelectorModel(modCopyModel); this.InitializeComponent(); this.SelectAllCommand = new AwaitableDelegateCommand <bool>( b => { var unfilteredMechs = this.MechSelectorModel.FilteredMechs; return(Task.Run(() => this.MechSelectorModel.SelectAllMechs(b, unfilteredMechs))); }); this.DataContext = this; }
public MechSelectorModel(ModCopyModel modCopyModel) { this.ModCopyModel = modCopyModel; var chassisTypes = new List <ObjectType> { ObjectType.MechDef // ObjectType.VehicleDef }; this.mechs = this.ModCopyModel.ModCollectionNode.ModCollection.GetReferenceableObjects() .Where(referenceableObject => chassisTypes.Contains(referenceableObject.ObjectType)).ToList(); // Hit it with a hammer for the moment... this.PropertyChanged += this.Filter; }
public ObjectSummaryViewModel(ModCopyModel modCopyModel) { this.ModCopyModel = modCopyModel; this.FilterableObjectTypeOptions = new ObservableCollection <FilterOption>( this.filterableObjectTypes.Select(type => new FilterOption(type.ToString(), false, type))); this.ObjectNodes = new ObservableCollection <ObjectDefinitionNode>( this.ModCopyModel.ModCollectionNode.AllChildren.Where( item => item is ObjectDefinitionNode obj && this.filterableObjectTypes.Contains(obj.ObjectDefinition.ObjectType)) .Cast <ObjectDefinitionNode>()); var objectNodesView = CollectionViewSource.GetDefaultView(this.ObjectNodes); objectNodesView.Filter += this.Filter; this.selectedObjectTypeFilters.CollectionChanged += (sender, args) => this.RefreshObjectView(); }
public ObjectSummaryWindow(ModCopyModel modCopyModel) { this.ObjectSummaryViewModel = new ObjectSummaryViewModel(modCopyModel); this.InitializeComponent(); this.DataContext = this.ObjectSummaryViewModel; }
public ValidateLanceDefViewModel(ModCopyModel modCopyModel) { this.modCopyModel = modCopyModel; }