Esempio n. 1
0
        private void setCurrentMod(Views.ModListItem mod)
        {
            if (currentMod == mod)
                return;

            currentMod = mod;
            Resources.Clear();
            References.Clear();

            setCurrentResource(null);

            if (mod != null)
            {
                //System.Diagnostics.Debug.WriteLine("Start: {0}", sw.Elapsed);
                var dispatcher = App.Current.Dispatcher;
                foreach (var resource in mod.Mod.Resources.OrderBy(r => r.Valid).ThenBy(r => r.Location))
                {
                    dispatcher.InvokeAsync(() =>
                    {
                        var resourceView = new Views.ResourceListItem(resource, true);
                        Resources.Add(resourceView);

                        if (resource is Manifest)
                            setCurrentResource(resourceView);

                    }, DispatcherPriority.Background);
                }
            }

            RaisePropertyChanged("CurrentMod");
            RaisePropertyChanged("CurrentModItem");
        }
Esempio n. 2
0
        public void RefreshMods()
        {
            Mod currentMod = CurrentMod;
            Resource currentResource = CurrentResource;
            Reference currentReference = CurrentReference;

            CurrentMod = null;

            Mods.Clear();
            Resources.Clear();
            References.Clear();

            ResourceManager.Initialize();
            ResourceManager.LoadMods();
            ResourceManager.LoadManifests();
            ResourceManager.LoadMagic();
            ResourceManager.ProccessQueue();

            foreach (var mod in ResourceManager.Mods)
            {
                var modView = new Views.ModListItem(mod);
                this.Mods.Add(modView);
                if (currentMod != null && currentMod.Name == mod.Name)
                    setCurrentMod(modView);
            }

            if (currentResource != null)
            {
                foreach (var listItem in Resources)
                    if (listItem.Resource.Location == currentResource.Location)
                        setCurrentResource(listItem);
            }
        }