Пример #1
0
        private void WindowOnClosed(object sender, EventArgs e)
        {
            Task.Run(
                () =>
            {
                try
                {
                    ModCopyPage.Self.ModCopyModel.MainModel.IsBusy = true;
                    var selectWindow    = sender as SimpleObjectSelectorWindow;
                    var selectedObjects = selectWindow.SelectedItems;
                    selectedObjects.ToList().ForEach(
                        definition =>
                    {
                        IMtmTreeViewItem node = null;
                        if (MtmTreeViewItem.DictRefsToTreeViewItems.TryGetValue(definition, out node))
                        {
                            node.IsChecked = true;
                        }
                    });
                    ModCopyPage.Self.Dispatcher.Invoke(
                        () =>
                    {
                        if (this.SelectedEligibleUnits.Count != this.previousSelectedUnitsCount)
                        {
                            this.previousSelectedUnitsCount = this.SelectedEligibleUnits.Count;
                            this.OnPropertyChanged(nameof(this.SelectedEligibleUnits));
                            this.lanceNode.LanceSlots.Where(model => model != this).ToList().ForEach(
                                model =>
                            {
                                model.OnPropertyChanged(nameof(this.SelectedEligibleUnits));
                                model.OnPropertyChanged(nameof(this.ObjectStatus));
                            });
                        }

                        if (this.SelectedEligiblePilots.Count != this.previousSelectedPilotsCount)
                        {
                            this.previousSelectedPilotsCount = this.SelectedEligiblePilots.Count;
                            this.OnPropertyChanged(nameof(this.SelectedEligiblePilots));
                            this.lanceNode.LanceSlots.Where(model => model != this).ToList().ForEach(
                                model =>
                            {
                                model.OnPropertyChanged(nameof(this.SelectedEligiblePilots));
                                model.OnPropertyChanged(nameof(this.ObjectStatus));
                            });
                        }

                        this.OnPropertyChanged(nameof(this.ObjectStatus));
                    });
                }
                finally
                {
                    ModCopyPage.Self.ModCopyModel.MainModel.IsBusy = false;
                }
            }).ConfigureAwait(false);
        }
Пример #2
0
 public ManifestEntryNode(
     IMtmTreeViewItem parent,
     List <IManifestEntry> manifestEntries,
     List <HashSet <IObjectDefinition> > objectLists,
     IReferenceFinderService referenceFinderService)
     : base(parent, manifestEntries, referenceFinderService)
 {
     this.ManifestEntries = manifestEntries;
     objectLists.ForEach(
         list => list.OrderBy(definition => definition.Name).ToList().ForEach(
             definition => this.Children.Add(new ObjectDefinitionNode(this, definition, referenceFinderService))));
 }
        public MtmTreeViewItem(IMtmTreeViewItem parent, object o, IReferenceFinderService referenceFinderService)
        {
            this.Parent = parent;
            this.Object = o;
            this.ReferenceFinderService = referenceFinderService;
            if (this.Object is IReferenceableObject referenceableObject)
            {
                DictRefsToTreeViewItems.Add(referenceableObject, this);
            }

            if (parent != null)
            {
                this.PropertyChanged += this.Parent.IncestPropertyChanged;
            }
        }
Пример #4
0
 public LanceDefNode(IMtmTreeViewItem parent, LanceDefObjectDefinition objectDefinition, IReferenceFinderService referenceFinderService)
     : base(parent, objectDefinition, referenceFinderService)
 {
     objectDefinition.LanceSlots.ForEach(
         definition =>
     {
         var slot = new LanceSlotModel(definition, this, LanceDefNode.factionService);
         this.LanceSlots.Add(slot);
         slot.PropertyChanged += (sender, args) =>
         {
             if (sender is LanceSlotModel && args.PropertyName == nameof(LanceSlotModel.ObjectStatus))
             {
                 this.OnPropertyChanged(nameof(this.ObjectStatus));
             }
         };
     });
 }
Пример #5
0
 public ManifestEntryNode(IMtmTreeViewItem parent, List <IManifestEntry> manifestEntries, ObjectType entryType, IReferenceFinderService referenceFinderService)
     : base(parent, manifestEntries, referenceFinderService)
 {
     this.ManifestEntries             = manifestEntries;
     this.EntryType                   = entryType;
     this.ManifestEntryLookupByObject = new Dictionary <IMtmTreeViewItem, IManifestEntry>();
     this.ManifestEntries.ForEach(
         entry =>
     {
         entry.Objects.ToList().ForEach(
             definition =>
         {
             var objectDefinitionNode = definition.ObjectType == ObjectType.LanceDef ? new LanceDefNode(this, definition as LanceDefObjectDefinition, referenceFinderService) : new ObjectDefinitionNode(this, definition, referenceFinderService);
             this.Children.Add(objectDefinitionNode);
             this.ManifestEntryLookupByObject.Add(objectDefinitionNode, entry);
         });
     });
 }
Пример #6
0
        private static void PreProcessRefs(IMtmTreeViewItem curNode)
        {
            var references = curNode.ObjectReferences;

            curNode.Children.ToList().ForEach(PreProcessRefs);
        }
Пример #7
0
 public ResourceNode(IMtmTreeViewItem parent, IResourceDefinition resourceDefinition, IReferenceFinderService referenceFinderService)
     : base(parent, resourceDefinition, referenceFinderService)
 {
 }
 public ObjectDefinitionNode(IMtmTreeViewItem parent, IObjectDefinition objectDefinition, IReferenceFinderService referenceFinderService)
     : base(parent, objectDefinition, referenceFinderService)
 {
     this.ObjectDefinition = objectDefinition;
 }