Nevron Open Vision Documentation
Hosting NOV in WPF
The hosting of NOV in your application is by default performed by NOV project templates. If you are using project templates you can skip this documentation topic.

1. Create a new WPF project in Visual Studio

This step is not mandatory, because you can integrate NOV in an already existing WinForm project. It is performed just for the purpose of making a complete installation scenario.

2. Reference the NOV Assemblies

Ensure that your application references the following NOV dlls:

3. Initialize the NOV Application

The WPF project template does not create a custom application entry point, so you need to do that by yourself. Follow these steps:

1. Create a new Program.cs file in your project and copy-paste the following content:

Installing NOV for WPF
Copy Code
using System;
using Nevron.Nov;
using Nevron.Nov.Windows;
namespace WpfApplication1
{
    static class Program
    {
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        [STAThread]
        static void Main()
        {
            // create the application
            App app = new App();

            // Apply license for redistribution here. You can skip this code when evaluating NOV.
            NLicenseManager.Instance.SetLicense(new NLicense("LICENSE KEY"));


            NModule[] modules = new NModule[] {
                  // TODO: Create modules here
            };
            // install Nevron Open Vision for WPF
            NNovApplicationInstaller.Install(modules);
            // run the application main window
            app.Run(new MainWindow());
        }
    }
}
See Hosting NOV in your Application for more information about modules.

2. Open the solution explorer and right click on the project to show the project properties. Select the Application tab and choose the WpfApplication1.Program in the Startup object combo box.

4. Say Hello World from NOV

Open the MainWindow.xaml.cs file and replace its content with the following code:

Say Hello World from NOV
Copy Code
using System.Windows;
using Nevron.Nov.UI;
using Nevron.Nov.Windows;
namespace WpfApplication1
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
    {
        public MainWindow()
        {
            InitializeComponent();
            // Add a NOV widget inside the form
            NLabel sayHelloWorld = new NLabel("Hello World from Nevron Open Vision");
            Content = new NNovWidgetHost<NLabel>(sayHelloWorld);
        }
    }
}

Run the application - it should display a simple form with a "Hello World from Nevron Open Vision" label inside.

This is as much as is required to host some NOV content in WPF. From now on you can forget everything you know about WPF, since you will not need it when developing with NOV.

The sample just makes a simple label, as content of the NNovWidgetHost WPF Control, but this control actually contain any NOV widget. See the UI Overview topic for an overview of the User Interface that comes along with NOV.

Send Feedback