ActionManager and Context
Proton.Miscellaneous.Framework.Extension.ActionManager
Follow the below steps in order to create and fire an event by performing DoAction, Event Creation, Event Registration for a Custom Application or between Custom Applications.
- Create a Custom Application in .Net Framework 4.6 and build it in x86 Release mode.
- Add Proton.Miscellaneous.Framework.Extension DLL reference in the project.
- AddObject: Adds IActionRespondable object to the collection of ActionManager.
Proton.Miscellaneous.Framework.Extension.ActionManager.AddObject(IActionRespondable)
Code Snippet:
Proton.Miscellaneous.Framework.Extension.ActionManager.AddObject(this); - RemoveObject: Removes IActionRespondable object from collection of ActionManager.
Code Snippet:
bool RemoveObject(IActionRespondable respondableObject) - Contains: Checks if provided IActionRespondable object is present in ActionManager collection.
Code Snippet:
Proton.Miscellaneous.Framework.Extension.ActionManager.Contains(“TestCustomization”) - DoAction: This function performs an Action on IActionRespondable object with specific parameters. Here IActionRespondable object is added through AddObject and DoAction first parameter childName is IActionRespondable object Name.
Proton.Miscellaneous.Framework.Extension.ActionManager.DoAction(string child Name, string action, prams string[] parade- tars)
Code Snippet:
Proton.Miscellaneous.Framework.Extension.ActionManager.DoAction("AddUserPane" , "SetResultSet" , null); - EventExists: This function is used to return a result if a particular event is already registered.
bool EventExists(EventExists (string eventName) - Create Event: This creates an Event and adds it to ActionManager collection
Proton.Miscellaneous.Framework.Extension.ActionManager.CreateEvent(IActionRespondable owner, string eventName);
Code Snippet:Proton.Miscellaneous.Framework.Extension.ActionManager.CreateEvent(this, “CustomEvent”);
- Register Event: This registers the event. Register Event action name is DoAction action.
Creation of the event is the first step and registration of all the Custom Applications is done prior to firing of the event.
Proton.Miscellaneous.Framework.Extension.ActionManager.RegisterForEvent string eventName, IActionRespondable responder, string actionName);
Code Snippet:
Proton.Miscellaneous.Framework.Extension.ActionManager.RegisterForEvent("CustomEvent", this, "MethodToPerform");
- Fire Event: This fires the event i.e. DoAction.
Proton.Miscellaneous.Framework.Extension.ActionManager.FireEvent(IActionRespondable owner, string eventName, params string[] parameters);
Code Snippet:
Proton.Miscellaneous.Framework.Extension.ActionManager.FireEvent(this, “CustomEvent”, “”);
Proton.Miscellaneous.Framework.Extension.Context
Follow the below steps for getting and setting a context between two Custom Applications.
- Create a Custom Application in .Net Framework 4.6 and build it in x86 Release mode.
- Add Proton.Miscellaneous.Framework.Extension DLL reference in the project.
- Declare Context.
Proton.Miscellaneous.Framework.Extension.Context context; - Create the Instance.
context = Proton.Miscellaneous.Framework.Extension.Context.Instance; - Set the context.
context["Key"] = "Value"; - Get the context.
string c = context["Key"].ToString();