public void Call_Die() { _Status = PluginStatus.Stopped; DoCallback(new PluginEventArgs(PluginEventMessageType.Message, "Calling die, stopping process, sending UNLOAD... from: " + _pluginName)); PluginEventAction actionCommand = new PluginEventAction(); actionCommand.ActionToTake = PluginActionType.Unload; DoCallback(new PluginEventArgs(PluginEventMessageType.Action, null, actionCommand)); // make a generic "reboot / update service" event handler ?! }
// OnTimer event, process start raised, sleep to simulate doing some work, then process end raised public void OnCounterElapsed(Object sender, EventArgs e) { _Status = PluginStatus.Processing; DoCallback(new PluginEventArgs(PluginEventMessageType.Message, "Counter elapsed from: " + _pluginName)); if (_terminateRequestReceived) { DoCallback(new PluginEventArgs(PluginEventMessageType.Message, "Counter elapsed, terminate received, stopping process... from: " + _pluginName)); } // TEST FOR DIE... DoCallback(new PluginEventArgs(PluginEventMessageType.Message, "*** Sending UPDATE SERVICE WITH INSTALLER COMMAND ***")); PluginEventAction actionCommand = new PluginEventAction(); actionCommand.ActionToTake = PluginActionType.TerminateAndUnloadPlugins; // TEST !!!! ... this should ONLY be used to signal the HOST/CONTROLLER to flag a DIE.... DoCallback(new PluginEventArgs(PluginEventMessageType.Action, null, actionCommand)); DoCallback(new PluginEventArgs(PluginEventMessageType.Message, "*** Sending UPDATE SERVICE WITH INSTALLER COMMAND - COMPLETE ***")); Call_Die(); // end test }
public PluginEventArgs(PluginEventMessageType messageType = PluginEventMessageType.Message, string resultMessage = "",PluginEventAction eventAction = (new PluginEventAction()), bool resultValue = true) { // default empty values allows us to send back default event response this.MessageType = messageType; // define message type that is bring sent this.ResultMessage = resultMessage; // used to send any string messages this.ResultValue = resultValue; this.EventAction = eventAction; // if the event type = "Action" then this carries the action to take this.executingDomain = AppDomain.CurrentDomain.FriendlyName; this.pluginName = System.Reflection.Assembly.GetExecutingAssembly().GetName().Name; //this.pluginID = ((IPlugin)System.Reflection.Assembly.GetExecutingAssembly()).PluginID(); }
public void ProcessEnded() { _Status = PluginStatus.Running; if (_terminateRequestReceived) // plugin has been asked to notify on process so it can be terminated, therefore send "unload" message { if (counter != null) { counter.Stop(); } PluginEventAction actionCommand = new PluginEventAction(); actionCommand.ActionToTake = PluginActionType.Unload; } }