Exemplo n.º 1
0
        public SetModel(SetModel s, IdeCollection <IdeBaseItem> src) : base(src) //for copying the item
        {
            _set = new Set()
            {
                Name        = s._set.Name,
                Id          = Guid.NewGuid(),
                GameId      = s._set.GameId,
                Hidden      = s._set.Hidden,
                ShortName   = s._set.ShortName,
                Description = s._set.Description,
                ReleaseDate = s._set.ReleaseDate
            };

            var setAsset = ViewModelLocator.AssetsTabViewModel.NewAsset(new string[] { "Sets", _set.Id.ToString() }, "set", ".xml");

            _set.Filename     = setAsset.FullPath;
            _set.ImagePackUri = Path.Combine(Config.Instance.ImageDirectoryFull, _set.GameId.ToString(), "Sets", _set.Id.ToString());

            setAsset.IsReserved = true;
            setAsset.LockName   = true;
            Asset = new AssetController(AssetType.Xml);
            Asset.SelectedAsset    = setAsset;
            Asset.PropertyChanged += AssetUpdated;

            CardItems = new IdeCollection <IdeBaseItem>(this, typeof(CardModel));
            CardItems.CollectionChanged += (a, b) =>
            {
                BuildCardDef(b);
            };
            CardItems.SelectedItemChanged += (a, b) =>
            {
                SelectDefaultAlt(b);
            };
            foreach (CardModel card in s.CardItems)
            {
                CardItems.Add(new CardModel(card, CardItems));
            }

            PackageItems = new IdeCollection <IdeBaseItem>(this, typeof(PackageModel));
            PackageItems.CollectionChanged += (a, b) =>
            {
                BuildPackageDef(b);
            };
            foreach (PackageModel package in s.PackageItems)
            {
                PackageItems.Add(new PackageModel(package, PackageItems));
            }
            ;

            AddCardCommand    = new RelayCommand(AddCard);
            AddPackageCommand = new RelayCommand(AddPackage);
            ImportCSVCommand  = new RelayCommand(ImportCSV);

            CanDragDrop = false;
        }
Exemplo n.º 2
0
Arquivo: Set.cs Projeto: wlk0/OCTGN
        public SetModel(SetModel s, IdeCollection <IdeBaseItem> src) : base(src) //for copying the item
        {
            var    id          = Guid.NewGuid();
            string installPath = Path.Combine(ViewModelLocator.GameLoader.GamePath, "Sets", id.ToString());

            _set = new Set()
            {
                Name        = s._set.Name,
                Id          = id,
                GameId      = s._set.GameId,
                Hidden      = s._set.Hidden,
                ShortName   = s._set.ShortName,
                Description = s._set.Description,
                ReleaseDate = s._set.ReleaseDate,
                InstallPath = installPath,
                Filename    = Path.Combine(installPath, "set.xml"),
                PackUri     = Path.Combine(installPath, "Cards")
            };
            CardItems = new IdeCollection <IdeBaseItem>(this);
            CardItems.CollectionChanged += (a, b) =>
            {
                BuildCardDef(b);
            };
            CardItems.SelectedItemChanged += (a, b) =>
            {
                SelectDefaultAlt(b);
            };
            foreach (CardModel card in s.CardItems)
            {
                CardItems.Add(new CardModel(card, CardItems));
            }

            PackageItems = new IdeCollection <IdeBaseItem>(this);
            PackageItems.CollectionChanged += (a, b) =>
            {
                BuildPackageDef(b);
            };
            foreach (PackageModel package in s.PackageItems)
            {
                PackageItems.Add(new PackageModel(package, PackageItems));
            }
            ;

            AddCardCommand    = new RelayCommand(AddCard);
            AddPackageCommand = new RelayCommand(AddPackage);
            ImportCSVCommand  = new RelayCommand(ImportCSV);

            CanDragDrop = false;
        }