示例#1
0
        /// <summary>
        /// Unregister all factories<br/>
        /// 注销所有工厂函数<br/>
        /// </summary>
        public void UnregisterAll()
        {
            Factories.Clear();
#pragma warning disable S1215
            GC.Collect();
#pragma warning restore S1215
        }
        public async Task LoadTestsAsync()
        {
            IsBusy = true;
            // Factories
            var factoriesResult = await Task.Run(() =>
            {
                List <FactoryViewModel> factories = new List <FactoryViewModel>();
                foreach (var factory in _engine.GetProviderFactories())
                {
                    var vm = new FactoryViewModel
                    {
                        Factory = factory
                    };
                    try
                    {
                        using (var provider = vm.Factory.CreateProvider())
                            vm.Version = provider.GetVersion();
                    }
                    catch (Exception ex)
                    {
                        vm.Version = $"ERR: {ex.Message}";
                    }
                    factories.Add(vm);
                }
                return(factories);
            });

            Factories.Clear();
            foreach (var f in factoriesResult)
            {
                Factories.Add(f);
            }
            // Tests
            var testsResult = await Task.Run(() =>
            {
                List <TestViewModel> tests = new List <TestViewModel>();
                foreach (var test in _engine.GetTests())
                {
                    var vm = new TestViewModel
                    {
                        Test       = test,
                        IsSelected = true
                    };
                    tests.Add(vm);
                }
                return(tests);
            });

            Tests.Clear();
            foreach (var t in testsResult)
            {
                Tests.Add(t);
            }

            IsBusy = false;
        }
示例#3
0
 /// <summary>
 /// Unregister all factories
 /// </summary>
 public void UnregisterAll()
 {
     FactoriesLock.EnterWriteLock();
     try {
         Factories.Clear();
     } finally {
         FactoriesLock.ExitWriteLock();
     }
     GC.Collect();
 }
示例#4
0
        /// <summary>
        /// Remove all game assets from the parcel
        /// </summary>
        public virtual void RemoveAllGameAssets()
        {
            lock (GameAssets)
            {
                lock (Game.GameAssets)
                    foreach (AbstractGameAsset ga in GameAssets.Values)
                    {
                        Game.GameAssets.Remove(ga.Uuid);
                    }

                GameAssets.Clear();
                Cropss.Clear();
                Housess.Clear();
                Factories.Clear();
                ChosenGameAssetTemplate = AbstractGameAsset.None;
            }
        }
 public void ClearInstances()
 {
     Factories.Clear();
     Instances.Clear();
 }
 public ILNodeDiagram()
 {
     Factories.Clear();
 }
 private void Reset()
 {
     Factories.Clear();
     _disposables.Clear();
 }
 protected override void BuildServiceInfoFactories()
 {
     Factories.Clear();
     Factories.Add(new TestServiceInfoFactory());
 }