Exemplo n.º 1
0
        void iContextMenu_Opening(object sender, CancelEventArgs e)
        {
            // Populate the context menu appropriate to whatever was
            // clicked on, or cancel it if the node doesn't have any
            // actions.
            iContextMenu.Items.Clear();
            e.Cancel = false;
            object nodeTag = iDeviceTreeView.SelectedNode.Tag;

            ZappSpy.UpnpServiceInfo serviceInfo = nodeTag as ZappSpy.UpnpServiceInfo;
            if (serviceInfo != null)
            {
                iContextMenu.Items.Add(
                    new ToolStripMenuItem(
                        "Show Service XML",
                        null,
                        (aSender, aE) =>
                {
                    var form        = new ShowXmlForm();
                    form.XmlContent = serviceInfo.DescriptionXml;
                    form.Text       = serviceInfo.ServiceId + " - Service XML";
                    form.Show();
                }));
                return;
            }
            ZappSpy.UpnpDeviceInfo deviceInfo = nodeTag as ZappSpy.UpnpDeviceInfo;
            if (deviceInfo != null)
            {
                iContextMenu.Items.Add(
                    new ToolStripMenuItem(
                        "Show Device XML",
                        null,
                        (aSender, aE) =>
                {
                    var form        = new ShowXmlForm();
                    form.XmlContent = deviceInfo.DeviceXml;
                    form.Text       = deviceInfo.FriendlyName + " - Device XML";
                    form.Show();
                }));
                return;
            }
            e.Cancel = true;
            return;
        }
Exemplo n.º 2
0
 void iContextMenu_Opening(object sender, CancelEventArgs e)
 {
     // Populate the context menu appropriate to whatever was
     // clicked on, or cancel it if the node doesn't have any
     // actions.
     iContextMenu.Items.Clear();
     e.Cancel = false;
     object nodeTag = iDeviceTreeView.SelectedNode.Tag;
     ZappSpy.UpnpServiceInfo serviceInfo = nodeTag as ZappSpy.UpnpServiceInfo;
     if (serviceInfo != null)
     {
         iContextMenu.Items.Add(
             new ToolStripMenuItem(
                 "Show Service XML",
                 null,
                 (aSender, aE) =>
                 {
                     var form = new ShowXmlForm();
                     form.XmlContent = serviceInfo.DescriptionXml;
                     form.Text = serviceInfo.ServiceId + " - Service XML";
                     form.Show();
                 }));
         return;
     }
     ZappSpy.UpnpDeviceInfo deviceInfo = nodeTag as ZappSpy.UpnpDeviceInfo;
     if (deviceInfo != null)
     {
         iContextMenu.Items.Add(
             new ToolStripMenuItem(
                 "Show Device XML",
                 null,
                 (aSender, aE) =>
                 {
                     var form = new ShowXmlForm();
                     form.XmlContent = deviceInfo.DeviceXml;
                     form.Text = deviceInfo.FriendlyName + " - Device XML";
                     form.Show();
                 }));
         return;
     }
     e.Cancel = true;
     return;
 }