public Vermittler(GuiInterface gui) { _getDaten = new GetDaten(); _setDaten = new SetDaten(); _guiInterface = gui; _guiInterface.NamesRequested += GuiNamesRequested; _guiInterface.ErgebnisseRequested += GuiErgebnisseRequested; _guiInterface.SchFestRequested += GuiSchFestRequested; _guiInterface.SchFestSetRequired += GuiSchFestSetRequired; _guiInterface.ShowMaterialRequested += GuiShowMaterialRequested; _guiInterface.AlterRequested += GuiAlterHeuteRequested; _guiInterface.SchiessKlasseRequested += GuiInterfaceSchiessKlasseRequested; _guiInterface.ProfilBerarbeitenSetRequired += GuiInterfaceProfilBerarbeitenSetRequired; _guiInterface.ErgebnisBearbeitenSetRequired += GuiInterfaceErgebnisBearbeitenSetRequired; _guiInterface.MaterialBearbeitenSetRequired += GuiInterfaceMaterialBearbeitenSetRequired; _guiInterface.StatistikToolSetRequired += GuiInterfaceStatistikToolSetRequired; _guiInterface.ProfilDeleteRequested += GuiInterfaceProfilDeleteRequested; _guiInterface.XMLDateiDatenbankBearbeitenRequired += GuiInterfaceXMLDateiDatenbankBearbeitenRequired; _guiInterface.DatenbankPathRequested += GuiInterfaceDatenbankPathRequested; _guiInterface.XMLDateiPasswordBearbeitenRequired += GuiInterfaceXMLDateiPasswordBearbeitenRequired; _guiInterface.AdminPassword += GuiInterfaceAdminPassword; _guiInterface.ErgebnisDeleteRequested += GuiInterfaceErgebnisDeleteRequested; _guiInterface.CreateNewDatabase += GuiInterfaceCreateNewDatabase; }
private void btnLoad_Click(object sender, EventArgs e) { string path = System.IO.Directory.GetParent(Application.ExecutablePath) + "\\ADS7828.dll"; Assembly guiLib = Assembly.LoadFile(path); //Type t = guiLib.GetType("I2CDIO8.MyGUI"); Type t = guiLib.GetType("ADS7828.MyGUI"); GuiInterface gui = (GuiInterface)Activator.CreateInstance(t); CommObj obj = new CommObj(this); gui.Show(obj); }
private void tvCommands_DoubleClick(object sender, EventArgs e) { TreeNode nd = tvCommands.SelectedNode; if (nd != null) { if (nd.Tag is DeviceCommand) { DeviceCommand cmd = (DeviceCommand)nd.Tag; txtQuickSend.Text = cmd.GetSendDataString(GetFormat() == emViewFormat.Hex); chkWrite.Checked = cmd.Write; chkRead.Checked = cmd.ReadDataLength > 0; numReadLength.Value = cmd.ReadDataLength; Send(); } else if (nd.Tag is DeviceGUICommand) { string path = ""; try { DeviceGUICommand cmd = (DeviceGUICommand)nd.Tag; path = System.IO.Directory.GetParent(Application.ExecutablePath) + "\\" + cmd.GUIPath; Assembly guiLib = Assembly.LoadFile(path); //Type t = guiLib.GetType("I2CDIO8.MyGUI"); Type t = guiLib.GetType(cmd.TypeName); GuiInterface gui = (GuiInterface)Activator.CreateInstance(t); CommObj obj = new CommObj(this); gui.Show(obj); } catch { MessageBox.Show("Fail to load GUI " + path); } } } }