コード例 #1
0
        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;
        }
コード例 #2
0
        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;
        }
コード例 #3
0
        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();
        }
コード例 #4
0
 public ObjectSummaryWindow(ModCopyModel modCopyModel)
 {
     this.ObjectSummaryViewModel = new ObjectSummaryViewModel(modCopyModel);
     this.InitializeComponent();
     this.DataContext = this.ObjectSummaryViewModel;
 }
コード例 #5
0
 public ValidateLanceDefViewModel(ModCopyModel modCopyModel)
 {
     this.modCopyModel = modCopyModel;
 }