Esempio n. 1
0
        void AddSignElement(SignContentType e)
        {
            SignElementUI se = new SignElementUI();

            se.ContentType = e;
            se.Content     = SignContentFactory.Create(e);
            try
            {
                se.ContentControl = SignContentFactory.CreateControl(e);
                se.ContentControl.BindToContent(se.Content);
                se.ContentControl.ContentChange += ContentControl_ContentChange;
            }
            catch
            {
                se.ContentControl = null; // If there are errors, don't use the UI. (allow controls without UI)
            }

            ISignContent[] newElements;
            lock (Elements)
            {
                Elements.Add(se);

                listBox1.Items.Add(se.Content.Summary);

                newElements = Elements.Select(i => i.Content).ToArray();
            }

            Animate.SetContent(newElements);
        }
Esempio n. 2
0
        public static ISignContent Create(SignContentType t)
        {
            object o = Assembly.GetCallingAssembly().CreateInstance(t.ContentClassType.FullName);

            if (o is ISignContent)
            {
                return((ISignContent)o);
            }
            throw new Exception("Mislabeled Sign content type: " + t.ContentClassType.FullName);
        }
Esempio n. 3
0
        public static ISignContentControl CreateControl(SignContentType t)
        {
            object o = Assembly.GetCallingAssembly().CreateInstance(t.ContentClassType.FullName + "Control");

            if (o is ISignContentControl)
            {
                return((ISignContentControl)o);
            }
            throw new Exception("No content control available for type: " + t.ContentClassType.FullName);
        }
Esempio n. 4
0
 public static IEnumerable <SignContentType> EnumerateContentTypes()
 {
     if (Types == null)
     {
         List <SignContentType> generateTypes = new List <SignContentType>();
         TypeMap = new Dictionary <string, SignContentType>();
         Assembly a = Assembly.GetCallingAssembly();
         foreach (Type t in a.GetTypes())
         {
             SignContentAttribute sc = t.GetCustomAttribute <SignContentAttribute>(false);
             if (sc != null)
             {
                 SignContentType sct = new SignContentType();
                 sct.Name             = sc.ContentName;
                 sct.ContentClassType = t;
                 generateTypes.Add(sct);
                 TypeMap.Add(sct.Name, sct);
             }
         }
         Types = generateTypes.ToArray();
     }
     return(Types);
 }
Esempio n. 5
0
        void AddSignElement(SignContentType e)
        {
            SignElementUI se = new SignElementUI();
            se.ContentType = e;
            se.Content = SignContentFactory.Create(e);
            try
            {
                se.ContentControl = SignContentFactory.CreateControl(e);
                se.ContentControl.BindToContent(se.Content);
                se.ContentControl.ContentChange += ContentControl_ContentChange;
            }
            catch
            {
                se.ContentControl = null; // If there are errors, don't use the UI. (allow controls without UI)
            }

            ISignContent[] newElements;
            lock(Elements)
            {
                Elements.Add(se);

                listBox1.Items.Add(se.Content.Summary);

                newElements = Elements.Select(i => i.Content).ToArray();
            }

            Animate.SetContent(newElements);
        }
Esempio n. 6
0
 public static ISignContent Create(SignContentType t)
 {
     object o = Assembly.GetCallingAssembly().CreateInstance(t.ContentClassType.FullName);
     if(o is ISignContent)
     {
         return (ISignContent)o;
     }
     throw new Exception("Mislabeled Sign content type: " + t.ContentClassType.FullName);
 }
Esempio n. 7
0
 public static IEnumerable<SignContentType> EnumerateContentTypes()
 {
     if(Types == null)
     {
         List<SignContentType> generateTypes = new List<SignContentType>();
         TypeMap = new Dictionary<string, SignContentType>();
         Assembly a = Assembly.GetCallingAssembly();
         foreach(Type t in a.GetTypes())
         {
             SignContentAttribute sc = t.GetCustomAttribute<SignContentAttribute>(false);
             if(sc != null)
             {
                 SignContentType sct = new SignContentType();
                 sct.Name = sc.ContentName;
                 sct.ContentClassType = t;
                 generateTypes.Add(sct);
                 TypeMap.Add(sct.Name, sct);
             }
         }
         Types = generateTypes.ToArray();
     }
     return Types;
 }
Esempio n. 8
0
 public static ISignContentControl CreateControl(SignContentType t)
 {
     object o = Assembly.GetCallingAssembly().CreateInstance(t.ContentClassType.FullName + "Control");
     if(o is ISignContentControl)
     {
         return (ISignContentControl)o;
     }
     throw new Exception("No content control available for type: " + t.ContentClassType.FullName);
 }