Beispiel #1
0
 public PackageModel(IdeCollection <IdeBaseItem> src) : base(src) //new item
 {
     _pack = new Pack
     {
         Name  = "Package",
         Id    = Guid.NewGuid(),
         Items = new List <object>(),
         Set   = ((SetModel)Source.Parent)._set
     };
     Items = new IdeCollection <IdeBaseItem>(this);
     Items.CollectionChanged += (a, b) =>
     {
         BuildPackDef(b);
     };
     Includes = new IdeCollection <IdeBaseItem>(this);
     Includes.CollectionChanged += (a, b) =>
     {
         BuildIncludesDef(b);
     };
     PackageDropHandler  = new PackageDropHandler();
     GeneratePackCommand = new RelayCommand(GeneratePack);
     AddOptionsCommand   = new RelayCommand(AddOptions);
     AddPickCommand      = new RelayCommand(AddPick);
     AddIncludeCommand   = new RelayCommand(AddInclude);
 }
Beispiel #2
0
 public PackageModel(PackageModel p, IdeCollection <IdeBaseItem> src) : base(src) //copying item
 {
     _pack = new Pack
     {
         Name     = p.Name,
         Id       = Guid.NewGuid(),
         Set      = p._pack.Set,
         Items    = new List <object>(),
         Includes = new List <Include>()
     };
     Items = new IdeCollection <IdeBaseItem>(this);
     Items.CollectionChanged += (a, b) =>
     {
         BuildPackDef(b);
     };
     foreach (var packItem in p.Items)
     {
         if (packItem is PickModel pick)
         {
             Items.Add(new PickModel(pick, Items));
         }
         else if (packItem is OptionsModel options)
         {
             Items.Add(new OptionsModel(options, Items));
         }
     }
     Includes = new IdeCollection <IdeBaseItem>(this);
     Includes.CollectionChanged += (a, b) =>
     {
         BuildIncludesDef(b);
     };
     foreach (IncludeModel include in p.Includes)
     {
         Includes.Add(new IncludeModel(include, Includes));
     }
     PackageDropHandler  = new PackageDropHandler();
     IncludeDropHandler  = new PackageDropHandler();
     GeneratePackCommand = new RelayCommand(GeneratePack);
     AddOptionsCommand   = new RelayCommand(AddOptions);
     AddPickCommand      = new RelayCommand(AddPick);
     AddIncludeCommand   = new RelayCommand(AddInclude);
 }
Beispiel #3
0
        public PackageModel(Pack p, IdeCollection <IdeBaseItem> src) : base(src) //loading item
        {
            _pack = p;
            Items = new IdeCollection <IdeBaseItem>(this);
            foreach (var item in p.Items)
            {
                if (item is OptionsList options)
                {
                    Items.Add(new OptionsModel(options, Items));
                }
                else if (item is Pick pick)
                {
                    Items.Add(new PickModel(pick, Items));
                }
            }
            Items.CollectionChanged += (a, b) =>
            {
                BuildPackDef(b);
            };

            Includes = new IdeCollection <IdeBaseItem>(this);
            foreach (var include in p.Includes)
            {
                Includes.Add(new IncludeModel(include, Includes));
            }
            Includes.CollectionChanged += (a, b) =>
            {
                BuildIncludesDef(b);
            };

            PackageDropHandler  = new PackageDropHandler();
            IncludeDropHandler  = new PackageDropHandler();
            GeneratePackCommand = new RelayCommand(GeneratePack);
            AddOptionsCommand   = new RelayCommand(AddOptions);
            AddPickCommand      = new RelayCommand(AddPick);
            AddIncludeCommand   = new RelayCommand(AddInclude);
        }