public void AttachGui(GuiData guiData) { m_guiData = guiData; if (m_guiData.MainWindow is System.Windows.Forms.Form) { var menuItem = guiData.MenuItem as System.Windows.Forms.MenuItem; if (menuItem != null) { m_subMenuItem = new System.Windows.Forms.MenuItem("Debugger", menu_Click); menuItem.MenuItems.Add(m_subMenuItem); } } }
public void DetachGui() { if (m_guiData.MainWindow is System.Windows.Forms.Form) { if (m_subMenuItem != null) { m_subMenuItem.Parent.MenuItems.Remove(m_subMenuItem); m_subMenuItem.Dispose(); m_subMenuItem = null; } if (m_form != null) { m_form.AllowClose = true; m_form.Close(); m_form = null; } } m_guiData = null; }
protected virtual void OnVmBusConnected(object sender, EventArgs e) { var list = m_vm.Spectrum.BusManager.FindDevices<IGuiExtension>(); list.Sort(GuiExtensionNameComparison); foreach (var wfe in list) { try { var guiData = new GuiData(this, menuTools); wfe.AttachGui(guiData); } catch (Exception ex) { LogAgent.Error(ex); } } }