public void Terminate() { m_widget.Dispose(); m_widget = null; t.Abort(); t = null; //net.Dispose(); net = null; GC.Collect(); }
public ControlContainer(MMI.EBuLa.Tools.XMLLoader XMLConf) { InitializeComponent(); m_XMLConf = XMLConf; try { //m_parent = gotParent; mmi_widget = new MMI.MMIBR185.BR185Control(XMLConf, true); mmi_widget.Button_6_Pressed(this, new EventArgs()); m_widget = new DIAGNOSEControl(XMLConf,ref mmi_widget); 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 { if (m_widget.IsSiemens()) { if (System.IO.File.Exists(BACKGROUND_IMAGE_SIEMENS)) { // change to siemens pB_EBuLa.Image = new Bitmap(BACKGROUND_IMAGE_SIEMENS); } } else { if (m_widget.IsBR101()) { if (System.IO.File.Exists(BACKGROUND_IMAGE_ADTRANZ)) { // change to adtranz pB_EBuLa.Image = new Bitmap(BACKGROUND_IMAGE_ADTRANZ); } } else { if (System.IO.File.Exists(BACKGROUND_IMAGE_BOMBARDIER)) { // change to bombardier pB_EBuLa.Image = new Bitmap(BACKGROUND_IMAGE_BOMBARDIER); } } } } catch(Exception) { MessageBox.Show("Fehler! Das Hintergrundbild \""+BACKGROUND_IMAGE_BOMBARDIER+"\" konnte nicht geladen werden!"); } net = new Network(ref m_widget); net2 = new MMIBR185.Network(ref mmi_widget); net2.isEmbeded = true; if (t == null) { t = new Thread(new ThreadStart(net.Connect)); t.IsBackground = true; t.Priority = m_XMLConf.thread_prio; t.Start(); Thread.Sleep(1); } if (t2 == null) { t2 = new Thread(new ThreadStart(net2.Connect)); t2.IsBackground = true; t2.Priority = m_XMLConf.thread_prio; t2.Start(); Thread.Sleep(1); } }
public Network(ref DIAGNOSEControl control) { messages = new TextBox(); c = control; }