private void menuData_Popup(object sender, EventArgs ea)
{
MDIChild mc = this.ActiveMdiChild as MDIChild;
bool bEnable = false;
if (mc != null && mc.DesignTab == DesignTabs.Design)
bEnable = true;
this.dataSourcesToolStripMenuItem1.Enabled = this.dataSetsToolStripMenuItem.Enabled = this.embeddedImagesToolStripMenuItem.Enabled = bEnable;
if (!bEnable)
return;
// Run thru all the existing DataSets
dataSetsToolStripMenuItem.DropDownItems.Clear();
dataSetsToolStripMenuItem.DropDownItems.Add(new ToolStripMenuItem(Strings.RdlDesigner_menuData_Popup_New, null,
new EventHandler(this.dataSetsToolStripMenuItem_Click)));
DesignXmlDraw draw = mc.DrawCtl;
XmlNode rNode = draw.GetReportNode();
XmlNode dsNode = draw.GetNamedChildNode(rNode, "DataSets");
if (dsNode != null)
{
foreach (XmlNode dNode in dsNode)
{
if (dNode.Name != "DataSet")
continue;
XmlAttribute nAttr = dNode.Attributes["Name"];
if (nAttr == null) // shouldn't really happen
continue;
dataSetsToolStripMenuItem.DropDownItems.Add(new ToolStripMenuItem(nAttr.Value, null,
new EventHandler(this.dataSetsToolStripMenuItem_Click)));
}
}
}