Framework / Resources / Application Resources
In This Topic

    Application Resources

    In This Topic

    Application resources in NOV applications are files that reside in NOV the application's "Resources" subfolder. The NOV application then can load files from the resources folder and process them according to the application's logic. For example, a diagram application can load the family tree shapes library from the Resources folder and then show family tree diagrams to the user. The sections below give recommendation for setting the resources folder based on the platform:

     Windows - WinForms and WPF

    For a Windows (WinForms or WPF) application the resources folder can be:

    • C:\Program Files\MyApp\Resources

    When debugging your application, the "Resources" folder should be in the output folder of your application, for example:

    • D:\Projects\MyApp\bin\Debug\Resources

    To change the location of the application's resources folder, you can use the following code:

    Change application's Resources folder
    Copy Code
    NApplication.ResourcesFolder = NFileSystem.Current.GetFolder(@"D:\MyAppResources");
    

    For example, if you want to use family tree shapes in your application, you should place the family tree shapes library in the following folder (shape libraries are included in the NOV installation in "Resources\ShapeLibraries"):

    • {YouAppFolder}\Resources\ShapeLibraries\Family Tree\Family Tree Shapes.nlb
     Mac

    In a macOS .NET application project, you should create a root level folder "Resources" and then place all resources in it or its subfolders with build action "BundleResource". You can either copy the files in the "Resources" folder or link to them. Thus when you build your Mac application, the resources will be included in the Mac application bundle and will be available to your application for reading.

    For example, if you want to use family tree shapes in your application, you should place the family tree shapes library in the following folder as a BundleResource (shape libraries are included in the NOV installation in "Resources\ShapeLibraries"):

    • {YourProject}/Resources/ShapeLibraries/Family Tree/Family Tree Shapes.nlb
     Blazor

    In a Blazor WebAssembly application project you should create a root-level folder "Resources" and then place a ZIP archive in it, which contains all resources you application needs. If your ZIP archive is called "Resources.zip", you can use the following code in "App.razor" to initialize your NOV Blazor application:

    Blazor application resources
    Copy Code
    @inject IJSRuntime JSRuntime
    @inject NavigationManager NavigationManager
    
    @using Nevron.Nov;
    @using Nevron.Nov.WebAssembly;
    @using Nevron.Nov.IO;
    @using Nevron.Nov.Compiler;
    
    <Router AppAssembly="@typeof(Program).Assembly">
        <Found Context="routeData">
            <RouteView RouteData="@routeData" DefaultLayout="@typeof(MainLayout)" />
        </Found>
        <NotFound>
            <LayoutView Layout="@typeof(MainLayout)">
                <p>Sorry, there's nothing at this address.</p>
            </LayoutView>
        </NotFound>
    </Router>
    
    @code {
        protected override void OnInitialized()
        {
            base.OnInitialized();
    
            // Apply license
            NLicense license = new NLicense("...");
            NLicenseManager.Instance.SetLicense(license);
    
            // Initialize NOV
            NNovApplicationInstaller.Install(
                JSRuntime,
                NavigationManager.BaseUri,
                Nevron.Nov.Barcode.NBarcodeModule.Instance,
                Nevron.Nov.Text.NTextModule.Instance,
                Nevron.Nov.Diagram.NDiagramModule.Instance,
                Nevron.Nov.Chart.NChartModule.Instance,
                Nevron.Nov.Schedule.NScheduleModule.Instance,
                Nevron.Nov.Grid.NGridModule.Instance
            );
    
            // Optional: If you intend to use Diagram smart shapes with code-behind (for example, Family Tree Shapes),
            // you should specify the compiler service to use to compile them.
            NApplication.CompilerService = new NRoslynCompilerService();
    
            // Load the resources from an embedded resource
            string resourceName = GetType().Namespace + ".Resources.Resources.zip";
            System.IO.Stream zipStream = GetType().Assembly.GetManifestResourceStream(resourceName);
    
            // Install a resource folder with in-memory resources
            NFileSystem memoryFSS = NFileSystem.CreateMemoryFileSystem();
            memoryFSS.DecompressZip(zipStream, "/Resources/");
            NApplication.ResourcesFolder = new NFolder(memoryFSS, "/Resources/");
        }
    }
    

    For example, if you want to use family tree shapes in your application, you should place the family tree shapes library in the following folder in the ZIP archive (shape libraries are included in the NOV installation in "Resources\ShapeLibraries"):

    • ShapeLibraries\Family Tree\Family Tree Shapes.nlb