Ejemplo n.º 1
0
 public void SetExpression(ScratchNet.Expression exp)
 {
     if (exp == null)
     {
         if (this.Children.Count > 3)
         {
             this.Children.RemoveAt(3);
         }
         //this.TextInput.Visibility = Visibility.Visible;
         LeftPart.Visibility   = Visibility.Visible;
         CenterPart.Visibility = Visibility.Visible;
         RightPart.Visibility  = Visibility.Visible;
     }
     else
     {
         LeftPart.Visibility   = Visibility.Collapsed;
         CenterPart.Visibility = Visibility.Collapsed;
         RightPart.Visibility  = Visibility.Collapsed;
         if (this.Children.Count > 3)
         {
             this.Children.RemoveAt(3);
         }
         if (exp.Type == "number")
         {
             NumberExpressionControl ctrl = new NumberExpressionControl();
             Grid.SetColumnSpan(ctrl, 3);
             ctrl.Expression = exp;
             this.Children.Add(ctrl);
         }
         else if (exp.Type == "boolean")
         {
             BooleanExpressionControl ctrl = new BooleanExpressionControl();
             Grid.SetColumnSpan(ctrl, 3);
             ctrl.Expression = exp;
             this.Children.Add(ctrl);
         }
         else
         {
             ObjectExpressionControl ctrl = new ObjectExpressionControl();
             Grid.SetColumnSpan(ctrl, 3);
             ctrl.Expression = exp;
             this.Children.Add(ctrl);
         }
     }
 }
Ejemplo n.º 2
0
        public void SetExpression(ScratchNet.Expression exp)
        {
            if (exp == null)
            {
                if (CenterPart.Children.Count > 3)
                {
                    CenterPart.Children.RemoveAt(3);
                }
                LeftPart.Visibility   = Visibility.Visible;
                CenterPart.Visibility = Visibility.Visible;
                RightPart.Visibility  = Visibility.Visible;
            }
            else
            {
                if (CenterPart.Children.Count > 3)
                {
                    CenterPart.Children.RemoveAt(3);
                }
                LeftPart.Visibility   = Visibility.Collapsed;
                CenterPart.Visibility = Visibility.Collapsed;
                RightPart.Visibility  = Visibility.Collapsed;

                if (descriptor.Type == "boolean")
                {
                    BooleanExpressionControl ctrl = new BooleanExpressionControl();
                    ctrl.Expression = exp;
                    this.Children.Add(ctrl);
                }
                //if (descriptor.Type == "number")
                {
                    NumberExpressionControl ctrl = new NumberExpressionControl();
                    ctrl.Expression = exp;
                    this.Children.Add(ctrl);
                }

                /*
                 * else
                 * {
                 *  ObjectExpressionControl ctrl = new ObjectExpressionControl();
                 *  ctrl.Expression = exp;
                 *  this.Children.Add(ctrl);
                 * }*/
            }
        }