.Net 3.0 customaction

Discussions about DocuVieware integration in GdPicture.NET.
Post Reply
wedmondson
Posts: 10
Joined: Tue Aug 04, 2020 12:04 am

.Net 3.0 customaction

Post by wedmondson » Sun Sep 20, 2020 3:33 pm

How do you make use of custom actions in .Net 3.0?

The only code snippet I can find is this:

Code: Select all

        [HttpPost("customaction")]
        public string CustomAction([FromBody]object jsonString)
        {
            return DocuViewareControllerActionsHandler.customaction(jsonString);
        }
It is not clear to me what "DocuViewareControllerActionsHandler.customaction(jsonString)" does. Is there a way to wire up custom code to DocuViewareControllerActionsHandler? Or do I need to parse the json into an object and build my own custom logic off of it. I have looked at some of the other examples such as "MVC Razor" and "Web Forms" but they don't seem to map onto this example very well.

Documentation for custom action does not really explain how you are supposed to use this method.

wedmondson
Posts: 10
Joined: Tue Aug 04, 2020 12:04 am

Re: .Net 3.0 customaction

Post by wedmondson » Mon Sep 21, 2020 2:26 pm

Answering my own question:

The answer still comes from the other examples. I just wasn't mentally connecting the .Net Core documentation with the Razor documentation.

Step One: create a static handler

Code: Select all

public static class Globals
You could name this class anything. It does not have to be "Globals"

Step Two: add a handler method

Code: Select all

 public static void CustomActionDispatcher(object sender, CustomActionEventArgs e)
        {
            switch (e.actionName)
Step Three: subscribe to the custom action event

Code: Select all

        public Startup(IConfiguration configuration, IWebHostEnvironment env)
        {
            ...
            DocuViewareEventsHandler.CustomAction += ImageProcessingGlobals.CustomActionDispatcher;
        }

Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests