Hi,
I've developed a plug-in application that basically is constructed of 2
pieces 1). the "main framework" 2). channels. Using Reflection in the Main
Framework, i dynamically load Channels. This works fine and great. My
problem is w/ menus. Each Channel returns a Popup Menu (based on an
interface requirement) that gets placed in the Main Framework's main
menubar. Again, works fine. However, what i'm unsure of is the
eventhandler for those specific menu choices. Since the Main Framework only
Hosts the Channel and adds the menu choices to the Main menu bar, when a
user clicks on one of those specific menu items, the Framework does NOT know
what to do with it only the individual Channel will.
Question: If I'm using the wrong approach on this question, please correct
me - how do I dynamically (via Reflection) pass that event firing back to
the Channel? I can't have any hardcoded values in the Framework because I
don't know what each Channel will require. Any sort of example code would
be great if possible or a URL to something.
Thanks in advance,
Doug 4 1485
Doug Handler wrote: Hi,
I've developed a plug-in application that basically is constructed of 2 pieces 1). the "main framework" 2). channels. Using Reflection in the Main Framework, i dynamically load Channels. This works fine and great. My problem is w/ menus. Each Channel returns a Popup Menu (based on an interface requirement) that gets placed in the Main Framework's main menubar. Again, works fine. However, what i'm unsure of is the eventhandler for those specific menu choices. Since the Main Framework only Hosts the Channel and adds the menu choices to the Main menu bar, when a user clicks on one of those specific menu items, the Framework does NOT know what to do with it only the individual Channel will.
Question: If I'm using the wrong approach on this question, please correct me - how do I dynamically (via Reflection) pass that event firing back to the Channel? I can't have any hardcoded values in the Framework because I don't know what each Channel will require. Any sort of example code would be great if possible or a URL to something.
Thanks in advance, Doug
I have a similar application. What I do is when I create the context
menus inside my plugins I hook up the events right away to handlers
inside of my plugin. So there is actually no overhead in my hosting
framework.
HTH,
Andy
--
To email me directly, please remove the *NO*SPAM* parts below:
*NO*SPAM*xmen40@*NO*SPAM*gmx.net
Andreas,
Thanks for the info...I hate to impose, but can you provide me a quick
example so i know exactly what you mean. Right now i'm trying to use
CreateDelegate (via Reflection) and I'm not being very successful <sigh>
d
"Andreas Mueller" <me@privacy.net> wrote in message
news:42*************@individual.net... Doug Handler wrote: Hi,
I've developed a plug-in application that basically is constructed of 2 pieces 1). the "main framework" 2). channels. Using Reflection in the Main Framework, i dynamically load Channels. This works fine and great. My problem is w/ menus. Each Channel returns a Popup Menu (based on an interface requirement) that gets placed in the Main Framework's main menubar. Again, works fine. However, what i'm unsure of is the eventhandler for those specific menu choices. Since the Main Framework only Hosts the Channel and adds the menu choices to the Main menu bar, when a user clicks on one of those specific menu items, the Framework does NOT know what to do with it only the individual Channel will.
Question: If I'm using the wrong approach on this question, please correct me - how do I dynamically (via Reflection) pass that event firing back to the Channel? I can't have any hardcoded values in the Framework because I don't know what each Channel will require. Any sort of example code would be great if possible or a URL to something.
Thanks in advance, Doug I have a similar application. What I do is when I create the context menus inside my plugins I hook up the events right away to handlers inside of my plugin. So there is actually no overhead in my hosting framework.
HTH, Andy -- To email me directly, please remove the *NO*SPAM* parts below: *NO*SPAM*xmen40@*NO*SPAM*gmx.net
Doug Handler wrote: Andreas,
Thanks for the info...I hate to impose, but can you provide me a quick example so i know exactly what you mean. Right now i'm trying to use CreateDelegate (via Reflection) and I'm not being very successful <sigh>
d "Andreas Mueller" <me@privacy.net> wrote in message news:42*************@individual.net...
Doug Handler wrote:
Hi,
I've developed a plug-in application that basically is constructed of 2 pieces 1). the "main framework" 2). channels. Using Reflection in the Main Framework, i dynamically load Channels. This works fine and great. My problem is w/ menus. Each Channel returns a Popup Menu (based on an interface requirement) that gets placed in the Main Framework's main menubar. Again, works fine. However, what i'm unsure of is the eventhandler for those specific menu choices. Since the Main Framework only Hosts the Channel and adds the menu choices to the Main menu bar, when a user clicks on one of those specific menu items, the Framework does NOT know what to do with it only the individual Channel will.
Question: If I'm using the wrong approach on this question, please correct me - how do I dynamically (via Reflection) pass that event firing back to the Channel? I can't have any hardcoded values in the Framework because I don't know what each Channel will require. Any sort of example code would be great if possible or a URL to something.
Thanks in advance, Doug
I have a similar application. What I do is when I create the context menus inside my plugins I hook up the events right away to handlers inside of my plugin. So there is actually no overhead in my hosting framework.
HTH, Andy -- To email me directly, please remove the *NO*SPAM* parts below: *NO*SPAM*xmen40@*NO*SPAM*gmx.net
Here is a extremely simplified version of what I do:
using System;
using System.Windows.Forms;
namespace ConsoleApplication13
{
public interface PlugIn
{
Menu Menu(object context);
}
class PlugInImp : PlugIn
{
Menu PlugIn.Menu(object context)
{
ContextMenu mnu = new ContextMenu();
mnu.MenuItems.Add("My Menu Item", new
EventHandler(OnMyMnuClick));
return mnu;
}
private void OnMyMnuClick(object sender, EventArgs e)
{
// do click stuff
}
}
public static class HostFramework
{
public static void RegisterPlugIn(PlugIn pl)
{
Menu mnu = pl.Menu(null);
HookUpMenu(mnu);
}
private static void HookUpMenu(Menu mnu)
{
// ...
}
}
class Program
{
static void Main(string[] args)
{
// in the real world, this happens inside of a
// plugin init code
HostFramework.RegisterPlugIn(new PlugInImp());
}
}
}
HTH,
Andy
--
To email me directly, please remove the *NO*SPAM* parts below:
*NO*SPAM*xmen40@*NO*SPAM*gmx.net
Ok, on the same page....cool, thank you. I PM'd you, prior, so disregard.
dh
"Andreas Mueller" <me@privacy.net> wrote in message
news:42*************@individual.net... Doug Handler wrote:
Andreas,
Thanks for the info...I hate to impose, but can you provide me a quick example so i know exactly what you mean. Right now i'm trying to use CreateDelegate (via Reflection) and I'm not being very successful <sigh>
d "Andreas Mueller" <me@privacy.net> wrote in message news:42*************@individual.net...
Doug Handler wrote:
Hi,
I've developed a plug-in application that basically is constructed of 2 pieces 1). the "main framework" 2). channels. Using Reflection in the Main Framework, i dynamically load Channels. This works fine and great. My problem is w/ menus. Each Channel returns a Popup Menu (based on an interface requirement) that gets placed in the Main Framework's main menubar. Again, works fine. However, what i'm unsure of is the eventhandler for those specific menu choices. Since the Main Framework only Hosts the Channel and adds the menu choices to the Main menu bar, when a user clicks on one of those specific menu items, the Framework does NOT know what to do with it only the individual Channel will.
Question: If I'm using the wrong approach on this question, please correct me - how do I dynamically (via Reflection) pass that event firing back to the Channel? I can't have any hardcoded values in the Framework because I don't know what each Channel will require. Any sort of example code would be great if possible or a URL to something.
Thanks in advance, Doug
I have a similar application. What I do is when I create the context menus inside my plugins I hook up the events right away to handlers inside of my plugin. So there is actually no overhead in my hosting framework.
HTH, Andy -- To email me directly, please remove the *NO*SPAM* parts below: *NO*SPAM*xmen40@*NO*SPAM*gmx.net Here is a extremely simplified version of what I do:
using System; using System.Windows.Forms;
namespace ConsoleApplication13 { public interface PlugIn { Menu Menu(object context); }
class PlugInImp : PlugIn { Menu PlugIn.Menu(object context) { ContextMenu mnu = new ContextMenu(); mnu.MenuItems.Add("My Menu Item", new EventHandler(OnMyMnuClick));
return mnu; } private void OnMyMnuClick(object sender, EventArgs e) { // do click stuff } }
public static class HostFramework { public static void RegisterPlugIn(PlugIn pl) { Menu mnu = pl.Menu(null); HookUpMenu(mnu); } private static void HookUpMenu(Menu mnu) { // ... } } class Program { static void Main(string[] args) { // in the real world, this happens inside of a // plugin init code HostFramework.RegisterPlugIn(new PlugInImp()); } } }
HTH, Andy -- To email me directly, please remove the *NO*SPAM* parts below: *NO*SPAM*xmen40@*NO*SPAM*gmx.net This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: BK |
last post by:
Hi,
I have a class which has a lot of events (>100). For some reasons, I have to
go through all invocation lists to do something. What I'm wondering is that,
is there any way to use reflection...
|
by: Tim Werth |
last post by:
I am trying to use reflection to add an event handler for the RowUpdated
event of the OracleDataAdapter object (ODP.NET), but the same thing can be
said for SqlDataAdapter if you only use...
|
by: timothy |
last post by:
Hi,
I have created a Delegate with EventArgs and I am trying to use reflection
to pick the correct EventArg. I have a combo box loaded with strings where
each represents an event arg for this...
|
by: Ben Fidge |
last post by:
Hi
Is it possible, using Reflection, to determine at runtime the method(s) that
are provided as handler for a given controls events?
Also, once discovered, is it possible to manually invoke...
|
by: Pieter Breed |
last post by:
Hi All,
I am trying to use the attribute/reflection system to as much
potential as I can think of, but I've run into a snag. I would
appreciate it if someone would point me in the right...
|
by: Luis Arvayo |
last post by:
Hi,
In c#, I need to dynamically create types at runtime that will consist of
the following:
- inherits from a given interface
- will have a constructor with an int argument
|
by: mswlogo |
last post by:
I looked high and low for code to do this and finally found some VB
code that did it right.
This is a C# flavor of it.
public event EventHandler<EventArgsMyEventToBeFired;
public void...
|
by: Ron |
last post by:
I have a situation where I have an object name as a string, and a method as
a string. I need to construct a click handler with those two bits of
information. This is what I came up with so far......
|
by: Klaudiusz Bryja |
last post by:
Hi,
This is for NetCF 2.0.
I need to create event handling code which using reflection. I have
some parameters in XML which describe how event should be handled. I
have code to create...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
| |