public IfElseControl() { margin = new Thickness(14, 0, 0, 0); slot = new ConditionSlot(new BooleanExpressionFitter()); slot.MinWidth = 100; slot.Padding = new Thickness(4); consequenceSpine = new Spine(new SpineFitter(), 1); alternativeSpine = new Spine(new SpineFitter(), 1); slot.Changed += delegate { OnChanged(new EventArgs()); }; consequenceSpine.Changed += delegate { OnChanged(new EventArgs()); }; alternativeSpine.Changed += delegate { OnChanged(new EventArgs()); }; InitializeComponent(); stackPanel.Children.Insert(1, slot); Consequences = consequenceSpine; Alternative = alternativeSpine; }
public DoWhileControl() { slot = new ConditionSlot(new BooleanExpressionFitter()); slot.Padding = new Thickness(10); consequenceSpine = new Spine(new SpineFitter(), 1, 10); slot.Changed += delegate { OnChanged(new EventArgs()); }; consequenceSpine.Changed += delegate { OnChanged(new EventArgs()); }; InitializeComponent(); Grid.SetRow(slot, 3); Grid.SetColumn(slot, 0); grid.Children.Add(slot); Grid.SetRow(consequenceSpine, 1); Grid.SetColumn(consequenceSpine, 0); grid.Children.Add(consequenceSpine); }
public IfControl() { slot = new ConditionSlot(new BooleanExpressionFitter()); slot.MinWidth = 100; slot.Padding = new Thickness(4); spine = new Spine(new SpineFitter(), 1); spine.Margin = new Thickness(14, 0, 0, 0); slot.Changed += delegate { OnChanged(new EventArgs()); }; spine.Changed += delegate { OnChanged(new EventArgs()); }; InitializeComponent(); spine.Extends = border.Height + 20; stackPanel.Children.Insert(1, slot); Grid.SetRow(spine, 0); Grid.SetColumn(spine, 0); Grid.SetZIndex(spine, -1); grid.Children.Add(spine); }
public ScriptStats GetStatistics() { ScriptStats s = Spine.GetStatistics(); s.Add(triggerSlot.GetStatistics()); return(s); }
public void WriteXml(XmlWriter writer) { writer.WriteAttributeString("BasedOn", CurrentScriptIsBasedOn); writer.WriteStartElement("Code"); Spine.WriteXml(writer); writer.WriteEndElement(); }
public void AssignImage(ImageProvider imageProvider) { if (imageProvider == null) { throw new ArgumentNullException("imageProvider"); } Spine.AssignImage(imageProvider); }
public virtual string GetLogText() { Moveable moveable = UIHelper.TryFindParent <Moveable>(this); if (moveable != null) { return(moveable.GetLogText()); } ConditionalFrame conditionalFrame = UIHelper.TryFindParent <ConditionalFrame>(this); if (conditionalFrame != null) { return(conditionalFrame.GetLogText()); } Spine spine = UIHelper.TryFindParent <Spine>(this); if (spine != null) { return("Script"); // if we find a Spine but not a Moveable it must be the main script } TriggerBar triggerBar = UIHelper.TryFindParent <TriggerBar>(this); if (triggerBar != null) { return(triggerBar.GetLogText()); } DependencyObject parent = UIHelper.GetParentObject(this); if (parent != null) { return(parent.ToString()); } return("unknown"); }
public TriggerBar(Fitter fitter) { if (fitter == null) { throw new ArgumentNullException("fitter"); } currentScriptIsBasedOn = String.Empty; spine = new Spine(fitter, 3); Grid.SetRow(spine, 0); Grid.SetColumn(spine, 0); spine.Margin = new Thickness(14, 0, 0, 0); triggerSlot = new TriggerSlot(new TriggerFitter()); triggerSlot.AllowDrop = true; triggerSlot.Margin = new Thickness(100, 0, 0, 0); InitializeComponent(); triggerBarPanel.Children.Add(triggerSlot); saveButton = new BigButton("Save"); saveButton.Margin = new Thickness(35, 5, 5, 5); triggerBarPanel.Children.Add(saveButton); spine.Extends = border.Height + 20; Grid.SetZIndex(spine, 1); Grid.SetZIndex(border, 2); mainGrid.Children.Add(spine); Effect = new DropShadowEffect(); triggerSlot.Changed += delegate { OnChanged(new EventArgs()); }; spine.Changed += delegate { OnChanged(new EventArgs()); }; }
public void ReadXml(XmlReader reader) { reader.MoveToContent(); if (reader.IsEmptyElement) { throw new FormatException("Script is empty."); } reader.ReadStartElement(); CurrentScriptIsBasedOn = reader.GetAttribute("BasedOn"); reader.MoveToContent(); if (reader.LocalName != "Code") { throw new FormatException("Script does not include Code."); } Spine.ReadXml(reader); reader.MoveToElement(); reader.ReadEndElement(); reader.MoveToElement(); }
public void Clear() { TriggerControl = null; Spine.Clear(); }