예제 #1
0
        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;
        }
예제 #2
0
        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);
        }
예제 #3
0
        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);
        }
예제 #4
0
        public ScriptStats GetStatistics()
        {
            ScriptStats s = Spine.GetStatistics();

            s.Add(triggerSlot.GetStatistics());
            return(s);
        }
예제 #5
0
 public void WriteXml(XmlWriter writer)
 {
     writer.WriteAttributeString("BasedOn", CurrentScriptIsBasedOn);
     writer.WriteStartElement("Code");
     Spine.WriteXml(writer);
     writer.WriteEndElement();
 }
예제 #6
0
        public void AssignImage(ImageProvider imageProvider)
        {
            if (imageProvider == null)
            {
                throw new ArgumentNullException("imageProvider");
            }

            Spine.AssignImage(imageProvider);
        }
예제 #7
0
        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");
        }
예제 #8
0
        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()); };
        }
예제 #9
0
        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();
        }
예제 #10
0
 public void Clear()
 {
     TriggerControl = null;
     Spine.Clear();
 }