Click here to Skip to main content
15,899,025 members
Home / Discussions / C#
   

C#

 
GeneralRe: Visual C# 2008 Express Edition Pin
Pete O'Hanlon11-Feb-08 8:30
mvePete O'Hanlon11-Feb-08 8:30 
GeneralRe: Visual C# 2008 Express Edition Pin
Ed.Poore11-Feb-08 8:47
Ed.Poore11-Feb-08 8:47 
GeneralRe: Visual C# 2008 Express Edition Pin
Pete O'Hanlon11-Feb-08 10:28
mvePete O'Hanlon11-Feb-08 10:28 
GeneralRe: Visual C# 2008 Express Edition Pin
Ray Hayes11-Feb-08 4:24
Ray Hayes11-Feb-08 4:24 
GeneralRe: Visual C# 2008 Express Edition Pin
leppie11-Feb-08 8:14
leppie11-Feb-08 8:14 
GeneralRe: Visual C# 2008 Express Edition Pin
Ray Hayes11-Feb-08 9:09
Ray Hayes11-Feb-08 9:09 
GeneralPlugins Pin
pokabot11-Feb-08 1:18
pokabot11-Feb-08 1:18 
GeneralRe: Plugins Pin
Pete O'Hanlon11-Feb-08 2:23
mvePete O'Hanlon11-Feb-08 2:23 
You don't give a plugin access to the data and methods of the hosting application. Your host communicates with the plugin (which is the opposite way around). Typically, your application will provide some interfaces which your plugin may or may not implement. For instance:
public interface IDataWrapper
{
  object State{ get ; set ; }
  bool HasProcessed{ get; }
}

public interface IPlugin
{
  void Start();
}

public class MyPlugin : IPlugin, IDataWrapper
{
  private object _state;
  private bool _isSuccessful = false;
  public object State 
  {
    get { return _state; }
    set { _state = value; }
  }
  public bool HasProcessed
  {
    get { return _isSuccessful; }
  }
  // Do some processing with this...
  public void Start()
  {
    // Do something....
  }
}


Then, in your application you would load the plugin and do something like:
IPlugin plugin = LoadPlugin(...);
IDataWrapper wrapped = plugin as IDataWrapper;
if (wrapped != null)
{
  wrapped.State = ...;
}

plugin.Start();

if (wrapped != null)
{
  if (wrapped.HasProcessed)
  {
    ...
  }
}



Deja View - the feeling that you've seen this post before.

My blog | My articles



GeneralRe: Plugins Pin
Ed.Poore11-Feb-08 3:17
Ed.Poore11-Feb-08 3:17 
GeneralRe: Plugins Pin
pokabot11-Feb-08 4:26
pokabot11-Feb-08 4:26 
GeneralRe: Plugins Pin
Ed.Poore11-Feb-08 5:07
Ed.Poore11-Feb-08 5:07 
GeneralRe: Plugins Pin
Pete O'Hanlon11-Feb-08 8:33
mvePete O'Hanlon11-Feb-08 8:33 
Generalunloading the form from memory Pin
praveen pandey11-Feb-08 1:18
praveen pandey11-Feb-08 1:18 
GeneralRe: unloading the form from memory Pin
DaveyM6911-Feb-08 1:42
professionalDaveyM6911-Feb-08 1:42 
GeneralRe: unloading the form from memory Pin
praveen pandey11-Feb-08 2:11
praveen pandey11-Feb-08 2:11 
GeneralRe: unloading the form from memory Pin
DaveyM6911-Feb-08 3:10
professionalDaveyM6911-Feb-08 3:10 
QuestionBrowsing for ODBC Data Source Names (DSN) Pin
Programm3r11-Feb-08 0:57
Programm3r11-Feb-08 0:57 
AnswerRe: Browsing for ODBC Data Source Names (DSN) Pin
Programm3r11-Feb-08 1:49
Programm3r11-Feb-08 1:49 
Generalcopy files from one dir to another directory Pin
gottimukkala11-Feb-08 0:50
gottimukkala11-Feb-08 0:50 
GeneralRe: copy files from one dir to another directory Pin
Xmen Real 11-Feb-08 1:00
professional Xmen Real 11-Feb-08 1:00 
GeneralRe: copy files from one dir to another directory Pin
gottimukkala11-Feb-08 2:01
gottimukkala11-Feb-08 2:01 
GeneralRe: copy files from one dir to another directory Pin
Xmen Real 11-Feb-08 5:27
professional Xmen Real 11-Feb-08 5:27 
QuestionHow to calculate form loading time Pin
sindhutiwari11-Feb-08 0:26
sindhutiwari11-Feb-08 0:26 
GeneralRe: How to calculate form loading time Pin
Giorgi Dalakishvili11-Feb-08 0:31
mentorGiorgi Dalakishvili11-Feb-08 0:31 
GeneralRe: How to calculate form loading time Pin
sindhutiwari11-Feb-08 0:34
sindhutiwari11-Feb-08 0:34 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.