예제 #1
0
        /// <summary>
        /// Populates the main menu entries from a main menu xml
        /// </summary>
        /// <param name="dbName">Name of the database.</param>
        /// <returns></returns>
        public async Task PopulateMainMenuSystems(string dbName = "")
        {
            IEnumerable <MainMenu> _systems = null;

            Systems.Clear();
            if (CurrentSystemsGames.Count > 0)
            {
                CurrentSystemsGames.Clear();
            }

            await Task.Run(async() =>
            {
                if (string.IsNullOrEmpty(dbName))
                {
                    dbName = "Main Menu";
                }

                //Get systems from main menu xml
                _systems = await _hsDataProvider.GetAllSystems(_settingsRepo.HypermintSettings.HsPath, "Main Menu", dbName);
            });

            //Add to system list
            if (_systems?.Count() > 0)
            {
                foreach (var system in _systems)
                {
                    Systems.Add(new MenuItemViewModel(system));
                }

                await GetSystemIconsAsync();
            }
        }
예제 #2
0
        private void cleanUpGalaxy()
        {
            foreach (Ship ship in Ships)
            {
                ship.Inventory.ClearInventory();
                ship.Nodes.Clear();
            }
            Ships.Clear();

            foreach (Faction faction in Factions)
            {
                faction.OwnedFactories.Clear();
                faction.OwnedMarkets.Clear();
                faction.OwnedShips.Clear();
                faction.OwnedStations.Clear();
            }

            factions.Clear();

            foreach (StarSystem system in Systems)
            {
                system.Planetoids.Clear();
            }

            Systems.Clear();
        }
예제 #3
0
        public void Dispose()
        {
            for (var index = Systems.Count - 1; index >= 0; index--)
            {
                RemoveSystem(Systems[index]);
            }

            Systems.Clear();
            ConventionalSystemHandlers.DisposeAll();
        }
        private async Task LoadSystemsStatuses(bool refresh)
        {
            var systems = await SystemStatusManager.Instance.LoadSystemsStatuses(refresh);

            Systems.Clear();

            if (!systems.IsNullOrEmpty())
            {
                foreach (var system in systems)
                {
                    Systems.Add(system);
                }
            }
        }
        public void SystemsClearsReactiveSystems()
        {
            var system = CreateReactiveSystem(_ctx);

            _systems.Add(system);

            _systems.Initialize();

            Assert.AreEqual(1, system.DidInitialize);

            _systems.Clear();
            _systems.Update();

            Assert.AreEqual(0, system.DidExecute);
        }
예제 #6
0
        public void Execute()
        {
            var filename = GlobalAppSettings.DataFileName;

            if (filename == null)
            {
                Status = LoadStatus.FileNameIsEmpty;
                throw new ArgumentException("Не указан путь к файлу для загрузки");
            }

            if (!File.Exists(filename))
            {
                Status = LoadStatus.FileNotExists;
                throw new ArgumentException("Указанный файл не существует");
            }

            try
            {
                var lines = File.ReadAllLines(filename);
                Systems.Clear();

                foreach (var line in lines)
                {
                    var arr  = line.Split('|');
                    var item = new InformationSystem
                    {
                        OperationSystem = arr[0],
                        Database        = arr[1],
                        RamAmount       = int.Parse(arr[2]),
                        MemoryAmount    = int.Parse(arr[3]),
                        Cost            = int.Parse(arr[4])
                    };

                    Systems.Add(item);
                }
                Status = LoadStatus.Success;
            }
            catch (Exception e)
            {
                Status = LoadStatus.GeneralError;
                Logger.Log(e);
                throw;
            }
        }
예제 #7
0
        public LabSystemViewModel(LabSystemsContextFactory contextFactory)
        {
            _service = new LabSystemService(contextFactory);

            RefreshCommand = new AsyncCommand(async() =>
            {
                Systems.Clear();
                IsNotScanning = false;

                Task <IEnumerable <LabSystem> > task = _service.GetAll();

                await task;

                foreach (LabSystem system in task.Result)
                {
                    Systems.Add(system);
                }

                IsNotScanning = true;
            });
        }
예제 #8
0
 /// <summary>
 /// 终结助手
 /// </summary>
 public void OnTermination()
 {
     Systems.Clear();
     Entities.Clear();
 }
예제 #9
0
 public void RemoveAllSystems(bool shouldNotify)
 {
     Systems.Clear(shouldNotify);
 }