Пример #1
0
        /// <summary>
        /// チェック状態を保存する
        /// </summary>
        public void SaveCheckState() => SettingDatabase.Instance.BeginTransaction(db =>
        {
            // 前回値クリア
            db.Execute("DELETE FROM SelectModuleCheckStateModuleTypes");
            db.Execute("DELETE FROM SelectModuleCheckStateModuleOwners");

            // モジュール種別のチェック状態保存
            var checkedTypes = ModuleTypes.Where(x => x.IsChecked);
            db.Execute("INSERT INTO SelectModuleCheckStateModuleTypes(ID) VALUES (:ID)", checkedTypes);

            // 派閥一覧のチェック状態保存
            var checkedFactions = ModuleOwners.Where(x => x.IsChecked).Select(x => x.Faction);
            db.Execute("INSERT INTO SelectModuleCheckStateModuleOwners(ID) VALUES (:FactionID)", checkedFactions);
        });
Пример #2
0
        /// <summary>
        /// モジュール一覧を更新する
        /// </summary>
        private void UpdateModulesMain()
        {
            var query = $@"
SELECT
    DISTINCT Module.ModuleID,
	Module.Name
FROM
    Module,
	ModuleOwner
WHERE
	Module.ModuleID = ModuleOwner.ModuleID AND
    Module.NoBlueprint = 0 AND
    Module.ModuleTypeID   IN ({string.Join(", ", ModuleTypes.Where(x => x.IsChecked).Select(x => $"'{x.ID}'"))}) AND
	ModuleOwner.FactionID IN ({string.Join(", ", ModuleOwners.Where(x => x.IsChecked).Select(x => $"'{x.Faction.FactionID}'"))})"    ;

            var list = new List <ModulesListItem>();

            X4Database.Instance.ExecQuery(query, SetModules, list);
            Modules.Reset(list);
        }