Adding custom views

<< Click to Display Table of Contents >>

Navigation:  Web UI & API > Extending UI & API >

Adding custom views

Adding custom UI views involves adding controllers to a Controllers folder and the matching Views (in cshtml format) to the project views folder as shown:

 

clip0014

 

For simplicity, we strongly recommend that the standard MVC naming conventions are followed so that the framework will automatically find the correct files.

 

It is also possible to include custom static files, css or JS.  These can be placed in a wwwroot folder within the project.  IMPORTANT:  "standard" subfolders such as "css" or "js" cannot be used within the wwwroot folder as these are reserved for use by the DDK.  Instead, place content in folders such as "customcss" or "customjs"

 

The Build Action for all static & view files should be set to Embedded Resource so that the files are embedded into the driver binary:

 

clip0015

 

The framework will automatically discover and serve all views it discovers within the project.  By default, however, they will not be integrated into the UI menu navigation system.  In order to integrate the views, details should be passed via the BNCSFramework.Init method:

 

           additionalViews = new string[] {"Settings", "Information"  };

           customHomePage = "Home";

 

           BncsFramework.Init(

               new string[] { "127.0.0.1" },

               mainInstance: STR.Instance,

               enableSwagger: true,

               manufacturerTag: "Allen & Heath",

               productTag: "d-Live",

               driverName : "DLive Director",

               instanceTag: STR.Instance,

               // enableBNCS: false,

               enableBNCS: true,

               bindPortHttp: 5002,

               bindPortHttps: 5003,

               externalAssembly: typeof(Program).Assembly,

               customHomePage: customHomePage,

               additionalViews: additionalViews

               );

 

There are three relevant settings demonstrated by this code snippet.

 

External Assembly

•The assembly containing the additional UI components: static files and scripts.

•Example: typeof(Program).Assembly

 

Page/View Injection Process

•Views and Controllers: The MVC Views and Controllers defined in the external project assembly.

•Additional Views: Names of the views specified in the additionalViews parameter of the BncsFramework.Init() method. They are an array of strings.

 

Custom HomePage

•If a custom homepage is present, it should be supplied as the customHomePage parameter.