public TemplateModel(TemplateModel p, IdeCollection <IdeBaseItem> source) : base(source) //copy { CanBeDefault = true; CanEdit = false; _def = new TemplateDefinition() { OverlayBlocks = p._def.OverlayBlocks, TextBlocks = p._def.TextBlocks, Matches = p._def.Matches, }; Asset = new AssetController(AssetType.Image); Asset.Register(p._def.src); _def.src = Asset.SelectedAsset.FullPath; Asset.PropertyChanged += AssetUpdated; Matches = new IdeCollection <IdeBaseItem>(this); Matches.CollectionChanged += (a, b) => { BuildMatchDef(b); }; foreach (MatchModel match in p.Matches) { Matches.Add(new MatchModel(match, Matches)); } OverlayContainer = new BlockContainer(p.OverlayContainer); OverlayContainer.OnContainerChanged += (a, b) => { _def.OverlayBlocks = OverlayContainer.BuildTemplateBlockDef(b); }; _def.OverlayBlocks = OverlayContainer.BuildTemplateBlockDef(null); TextBlockContainer = new BlockContainer(p.TextBlockContainer); TextBlockContainer.OnContainerChanged += (a, b) => { _def.TextBlocks = TextBlockContainer.BuildTemplateBlockDef(b); }; _def.TextBlocks = TextBlockContainer.BuildTemplateBlockDef(null); AddMatchCommand = new RelayCommand(AddMatch); AddOverlayConditionalCommand = new RelayCommand(AddOverlayConditional); AddOverlaySwitchCommand = new RelayCommand(AddOverlaySwitch); AddTextConditionalCommand = new RelayCommand(AddTextConditional); AddTextSwitchCommand = new RelayCommand(AddTextSwitch); OverlayDropHandler = new TemplateMainDropHandler() { IsOverlayHandler = true }; TextDropHandler = new TemplateMainDropHandler() { IsOverlayHandler = false }; DragHandler = new TemplateMainDragHandler(); }
public SwitchCaseModel(SwitchCaseModel switchcase, IdeCollection <IdeBaseItem> source) : base(source) //copy { _case = new CaseDefinition() { linkList = new List <LinkDefinition.LinkWrapper>(), contains = switchcase._case.contains, value = switchcase._case.value, switchBreak = switchcase._case.switchBreak }; BlockContainer = new BlockContainer(switchcase.BlockContainer); BlockContainer.OnContainerChanged += (a, b) => { _case.linkList = BlockContainer.BuildTemplateBlockDef(b); }; _case.linkList = BlockContainer.BuildTemplateBlockDef(null); }
public ElseCaseModel(ElseCaseModel caseItem, IdeCollection <IdeBaseItem> source) : base(source) //copy { _case = new CaseDefinition() { linkList = new List <LinkDefinition.LinkWrapper>(), contains = caseItem._case.contains, property = caseItem._case.property, value = caseItem._case.property }; BlockContainer = new BlockContainer(caseItem.BlockContainer); BlockContainer.OnContainerChanged += (a, b) => { _case.linkList = BlockContainer.BuildTemplateBlockDef(b); }; _case.linkList = BlockContainer.BuildTemplateBlockDef(null); CanDragDrop = false; }
public ElseIfCaseModel(ElseIfCaseModel conditionalCase, IdeCollection <IdeBaseItem> source) : base(source) //copy { _case = new CaseDefinition() { linkList = new List <LinkDefinition.LinkWrapper>(), contains = conditionalCase._case.contains, value = conditionalCase._case.property }; BlockContainer = new BlockContainer(conditionalCase.BlockContainer); BlockContainer.OnContainerChanged += (a, b) => { _case.linkList = BlockContainer.BuildTemplateBlockDef(b); }; _case.linkList = BlockContainer.BuildTemplateBlockDef(null); Property = conditionalCase.Property; Messenger.Default.Register <CustomPropertyChangedMessage>(this, action => CustomPropertyChanged(action)); }
public SwitchCaseModel(CaseDefinition caseItem, IdeCollection <IdeBaseItem> source) : base(source) //load { _case = caseItem; BlockContainer = new BlockContainer(caseItem.linkList); BlockContainer.OnContainerChanged += (a, b) => { _case.linkList = BlockContainer.BuildTemplateBlockDef(b); }; }
public ElseCaseModel(IdeCollection <IdeBaseItem> source) : base(source) //new { _case = new CaseDefinition(); BlockContainer = new BlockContainer(); BlockContainer.OnContainerChanged += (a, b) => { _case.linkList = BlockContainer.BuildTemplateBlockDef(b); }; CanDragDrop = false; }
public ElseIfCaseModel(CaseDefinition caseItem, IdeCollection <IdeBaseItem> source) : base(source) //load { _case = caseItem; _property = (PropertyItemModel)CustomProperties.FirstOrDefault(x => ((PropertyItemModel)x)._property.Name == _case.property); BlockContainer = new BlockContainer(caseItem.linkList); BlockContainer.OnContainerChanged += (a, b) => { _case.linkList = BlockContainer.BuildTemplateBlockDef(b); }; Messenger.Default.Register <CustomPropertyChangedMessage>(this, action => CustomPropertyChanged(action)); }
public SwitchCaseModel(IdeCollection <IdeBaseItem> source) : base(source) //new { _case = new CaseDefinition { value = "" }; BlockContainer = new BlockContainer(); BlockContainer.OnContainerChanged += (a, b) => { _case.linkList = BlockContainer.BuildTemplateBlockDef(b); }; }
public ElseIfCaseModel(IdeCollection <IdeBaseItem> source) : base(source) //new { _case = new CaseDefinition { value = "" }; Property = (PropertyItemModel)CustomProperties.First(); BlockContainer = new BlockContainer(); BlockContainer.OnContainerChanged += (a, b) => { _case.linkList = BlockContainer.BuildTemplateBlockDef(b); }; Messenger.Default.Register <CustomPropertyChangedMessage>(this, action => CustomPropertyChanged(action)); }
public TemplateModel(IdeCollection <IdeBaseItem> source) : base(source) //new { CanBeDefault = true; CanEdit = false; _def = new TemplateDefinition { Matches = new List <Property>(), OverlayBlocks = new List <LinkDefinition.LinkWrapper>(), TextBlocks = new List <LinkDefinition.LinkWrapper>(), }; Asset = new AssetController(AssetType.Image); _def.src = Asset.SelectedAsset.FullPath; Asset.PropertyChanged += AssetUpdated; Matches = new IdeCollection <IdeBaseItem>(this); Matches.CollectionChanged += (a, b) => { BuildMatchDef(b); }; OverlayContainer = new BlockContainer(); OverlayContainer.OnContainerChanged += (a, b) => { _def.OverlayBlocks = OverlayContainer.BuildTemplateBlockDef(b); }; TextBlockContainer = new BlockContainer(); TextBlockContainer.OnContainerChanged += (a, b) => { _def.TextBlocks = TextBlockContainer.BuildTemplateBlockDef(b); }; AddMatchCommand = new RelayCommand(AddMatch); AddOverlayConditionalCommand = new RelayCommand(AddOverlayConditional); AddOverlaySwitchCommand = new RelayCommand(AddOverlaySwitch); AddTextConditionalCommand = new RelayCommand(AddTextConditional); AddTextSwitchCommand = new RelayCommand(AddTextSwitch); OverlayDropHandler = new TemplateMainDropHandler() { IsOverlayHandler = true }; TextDropHandler = new TemplateMainDropHandler() { IsOverlayHandler = false }; DragHandler = new TemplateMainDragHandler(); }
public TemplateModel(TemplateDefinition t, IdeCollection <IdeBaseItem> source) : base(source) //load { CanBeDefault = true; CanEdit = false; _def = t; Asset = new AssetController(AssetType.Image); Asset.Register(t.src); Asset.PropertyChanged += AssetUpdated; Matches = new IdeCollection <IdeBaseItem>(this); foreach (var match in t.Matches) { Matches.Add(new MatchModel(match, Matches)); } Matches.CollectionChanged += (a, b) => { BuildMatchDef(b); }; OverlayContainer = new BlockContainer(t.OverlayBlocks); OverlayContainer.OnContainerChanged += (a, b) => { _def.OverlayBlocks = OverlayContainer.BuildTemplateBlockDef(b); }; TextBlockContainer = new BlockContainer(t.TextBlocks); TextBlockContainer.OnContainerChanged += (a, b) => { _def.TextBlocks = TextBlockContainer.BuildTemplateBlockDef(b); }; AddMatchCommand = new RelayCommand(AddMatch); AddOverlayConditionalCommand = new RelayCommand(AddOverlayConditional); AddOverlaySwitchCommand = new RelayCommand(AddOverlaySwitch); AddTextConditionalCommand = new RelayCommand(AddTextConditional); AddTextSwitchCommand = new RelayCommand(AddTextSwitch); OverlayDropHandler = new TemplateMainDropHandler() { IsOverlayHandler = true }; TextDropHandler = new TemplateMainDropHandler() { IsOverlayHandler = false }; DragHandler = new TemplateMainDragHandler(); }
public TemplateModel(IdeCollection <IdeBaseItem> source) : base(source) //new { CanBeDefault = true; CanEdit = false; _def = new TemplateDefinition { Matches = new List <Property>(), OverlayBlocks = new List <LinkDefinition.LinkWrapper>(), TextBlocks = new List <LinkDefinition.LinkWrapper>(), rootPath = ViewModelLocator.GameLoader.ProxyDef.RootPath }; Matches = new IdeCollection <IdeBaseItem>(this); Matches.CollectionChanged += (a, b) => { BuildMatchDef(b); }; OverlayContainer = new BlockContainer(); OverlayContainer.OnContainerChanged += (a, b) => { _def.OverlayBlocks = OverlayContainer.BuildTemplateBlockDef(b); }; TextBlockContainer = new BlockContainer(); TextBlockContainer.OnContainerChanged += (a, b) => { _def.TextBlocks = TextBlockContainer.BuildTemplateBlockDef(b); }; Asset = AssetManager.Instance.Assets.FirstOrDefault(x => x.Type == AssetType.Image); AddMatchCommand = new RelayCommand(AddMatch); AddOverlayConditionalCommand = new RelayCommand(AddOverlayConditional); AddOverlaySwitchCommand = new RelayCommand(AddOverlaySwitch); AddTextConditionalCommand = new RelayCommand(AddTextConditional); AddTextSwitchCommand = new RelayCommand(AddTextSwitch); OverlayDropHandler = new TemplateMainDropHandler() { IsOverlayHandler = true }; TextDropHandler = new TemplateMainDropHandler() { IsOverlayHandler = false }; DragHandler = new TemplateMainDragHandler(); }