public void Terminate()
 {
     m_widget.Dispose();
     if (m_widget_ebula != null)
     {
         m_widget_ebula.Terminate();
         if (m_widget_ebula.t != null)
             m_widget_ebula.t.Abort();
         m_widget_ebula.Dispose();
     }
     m_widget = null;
     m_widget_ebula = null;
     t.Abort();
     t = null;
     net = null;
     GC.Collect();
 }
        public ControlContainer(MMI.EBuLa.Tools.XMLLoader XMLConf, int side)
        {
            InitializeComponent();

            m_XMLConf = XMLConf;

            try
            {
                //m_parent = gotParent;
                m_widget = new DavidControl(XMLConf, this);
                P_Display.Controls.Add(m_widget);
                if (m_XMLConf.Inverse)
                {
                    m_widget.Inverse();
                }
                else
                {
                    m_widget.Inverse();
                    m_widget.Inverse();
                }
            }
            catch (Exception e)
            {
                MessageBox.Show("Fehler beim Erstellen des Widgets! ("+e.Message+")");
            }

            try
            {
                SwitchBackground();
            }
            catch(Exception)
            {
                MessageBox.Show("Fehler! Das Hintergrundbild \""+BACKGROUND_IMAGE_ABB+" oder "+BACKGROUND_IMAGE_ADTRANZ+"\" konnte nicht geladen werden!");
            }

            if (side == 1)
                net = new Network(ref m_widget, "(links)");
            else if (side == 2)
                net = new Network(ref m_widget, "(rechts)");
            else
                return;

            if (t == null)
            {
                t = new Thread(new ThreadStart(net.Connect));
                t.Priority = m_XMLConf.thread_prio;
                t.IsBackground = true;
                t.Start();
                Thread.Sleep(0);
            }

            if (side == 2)
            {
                m_widget_ebula = new MMI.EBuLa.EbulaControl(m_XMLConf, true);
                m_widget_ebula.Visible = false;
                P_Display.Controls.Add(m_widget_ebula);
                if (m_XMLConf.Inverse)
                {
                    m_widget_ebula.Inverse();
                }
            }
        }
 public Network(/*ref TextBox tb, */ref DavidControl control, string side)
 {
     messages = new TextBox();
     c = control;
     side_text = side;
 }