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); }
public SignControl() { InitializeComponent(); Targets = new List <SignTargetUI>(); Elements = new List <SignElementUI>(); Animate = new SignAnimate(); Animate.FrameComplete += Animate_FrameComplete; comboBox1.Items.Add("Test Board"); comboBox1.Items.Add("Sign Preview"); comboBox1.SelectedIndex = 0; foreach (SignContentType t in SignContentFactory.EnumerateContentTypes()) { comboBox2.Items.Add(t.Name); } comboBox2.SelectedIndex = 0; listBox1.Items.Add("Global Configuration"); // Add some things for test purproses. AddSignTarget(new SignPreview()); AddSignElement(SignContentFactory.GetFromName("Simple Text")); }
private void button2_Click(object sender, EventArgs e) { // Add a sign element AddSignElement(SignContentFactory.GetFromName((string)comboBox2.SelectedItem)); }