Beispiel #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);
        }
Beispiel #2
0
        private void listBox1_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (SuppressListboxChange)
            {
                return;
            }
            ccPanel.Controls.Clear();
            int index = listBox1.SelectedIndex;

            if (index < 0)
            {
                return;
            }
            if (index == 0)
            {
                // global state
            }
            else
            {
                // Setup the panel from a given control.
                SignElementUI se = Elements[index - 1];
                if (se.ContentControl != null)
                {
                    Control c = se.ContentControl as Control;
                    if (c != null)
                    {
                        c.Location = Point.Empty;
                        c.Width    = ccPanel.Width;
                        c.Height   = ccPanel.Height;
                        ccPanel.Controls.Add(c);
                        c.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
                    }
                }
            }
        }
Beispiel #3
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);
        }