public void InsertIf(IESpace espace, List <IKey> keys) { var links = espace.GetAllDescendantsOfType <GLink>().Where(s => keys.Contains(GetDestination(s).ObjectKey)); links = InsertIfplus(espace, keys, links); ToggleEntities t = new ToggleEntities(); ToggleAction a = new ToggleAction(); var entity = t.GetTogglesEntity(espace); var action = a.GetToggleAction(espace); foreach (GLink l in links.ToList()) { if (l.Parent is GParent1) { var parent = (GParent1)l.Parent; var rec = t.CreateRecord(entity, $"FT_{espace.Name}_{GetDestinationName(l)}", $"FT_{GetDestinationName(l)}", espace); CreateIf(parent, l, espace); } else if (l.Parent is GParent2) { var parent = (GParent2)l.Parent; var rec = t.CreateRecord(entity, $"FT_{espace.Name}_{GetDestinationName(l)}", $"FT_{GetDestinationName(l)}", espace); CreateIf2(parent, l, espace); } else { Console.WriteLine($"Bypass Link {l} because parent is not IPlaceholderContentWidget or IContainerWidget. Parent is {l.Parent}"); } } }
protected override void CreateIf(IPlaceholderContentWidget p, IWebBlockInstanceWidget o, IESpace eSpace) { ToggleAction a = new ToggleAction(); var action = a.GetToggleAction(eSpace); var instanceIf = p.CreateWidget <IIfWidget>(); instanceIf.SetCondition($"GetFTValue(Entities.FeatureToggles.FT_{eSpace.Name}_{GetName(o)})"); instanceIf.Name = $"If_FT_{GetName(o)}"; instanceIf.TrueBranch.Copy(o); }
public virtual void InsertIf(IESpace espace, List <IKey> keys) { var bl = espace.GetAllDescendantsOfType <GObjectSignature>().Where(s => keys.Contains(GetObjectKey(s))); ToggleEntities t = new ToggleEntities(); ToggleAction a = new ToggleAction(); var entity = t.GetTogglesEntity(espace); var action = a.GetToggleAction(espace); foreach (GObjectSignature o in bl.ToList()) { if (o.Parent is GParent) { var parent = (GParent)o.Parent; var rec = t.CreateRecord(entity, $"FT_{espace.Name}_{GetName(o)}", $"FT_{GetName(o)}", espace); CreateIf(parent, o, espace); o.Delete(); } else { Console.WriteLine($"Bypass Block {o} because parent is not IPlaceholderContentWidget. Parent is {o.Parent}"); } } }