예제 #1
0
        internal static VisualElement Create(string key, Type type, Codespace codespace, ElementType eltype)
        {
            try
            {
                // Simple method calling default ctor
                // create an object of the type
                //ICodespaceElement obj = (ICodespaceElement)Activator.CreateInstance(type);


                /*Another way is to use reflection: */

                // Get public constructors
                //var ctors = type.GetConstructors(BindingFlags.Public);

                var ctr = type.GetConstructor(BindingFlags.Instance | BindingFlags.Public, null, new Type[] { typeof(String), typeof(Codespace) }, null);

                if (ctr != null)
                {
                    var obj = (VisualElement)ctr.Invoke(new object[] { key, codespace });
                    obj.Type = eltype;
                    return(obj);
                }
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex.Message);
            }

            return(null);
        }
예제 #2
0
        public CodespaceElement(string key, Codespace parent)
            : base()
        {
            Debug.Assert(!String.IsNullOrEmpty(key));

            Key     = key;
            _parent = parent;
        }
예제 #3
0
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            //Create new Codespace

            _codespace1 = new Robots1("ROBOTS-1", this, 1000, 800);

            _codespace1.SetMode(Codespace.Mode.DesignTime);
            _codespace1.Layout();

            //Runtime invoked fromUI
        }
예제 #4
0
        /// <summary>
        /// Note: you must add one or more PathFigure to this collection
        /// </summary>
        internal static StaticPathElement StaticPathHelper(string key, Codespace codespace, Brush strokeBrush, int strokethickness, string imageSrc)
        {
            var sp = new StaticPathElement(key, codespace);

            sp.Init(strokeBrush, strokethickness, imageSrc);

            /*
             * <Path  Stroke ="Black" StrokeThickness="2" Data="M100,50 L140,60 L150,100 L125,120 L90,110 L80,80 z M15,40 L70,15 L80,30 L65,70 L80,115 L10,80 z M160,40 L170,50 L180,90 L180,120 L140,150 L130,130 L160,100 z" >
             *      <Path.Fill>
             *          <ImageBrush ImageSource="" TileMode="None" Stretch="UniformToFill" />
             *      </Path.Fill>
             *
             *  </Path>
             */


            return(sp);
        }
 public GraphicImageElement(string key, Codespace parent)
     : base(key, parent)
 {
 }
예제 #6
0
 public StaticPathElement(string key, Codespace parent) : base(key, parent)
 {
 }
예제 #7
0
 internal VirtualMachine(Codespace cs)
 {
     _codespace = cs;
 }
예제 #8
0
 public VisualElement(string key, Codespace parent) : base(key, parent)
 {
 }
예제 #9
0
 public DynamicElement(string key, Codespace parent) : base(key, parent)
 {
     MagneticState = Magnestism.None;
 }