Table of Contents

Getting Started with HiAPI

This guide will help you get started with HiAPI development.

Installation

  1. Create a dotnet project.

  2. Setting the nuget server and account.

    The HiAPI installation is typical Nuget Package installation. You can apply global or local nuget setting.

    Here apply the local solution for startup. Create a file and name it to nuget.config in the same folder of your dotnet project file. the content of the file is as the following:

    <?xml version="1.0" encoding="utf-8"?>
    <configuration>
      <packageSources>
        <add key="HiAPI" value="https://superhightech-gitea.webredirect.org/api/packages/HiAPI/nuget/index.json" />
        <add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />
      </packageSources>
      <packageSourceCredentials>
        <HiAPI>
          <add key="Username" value="xxxxxx" />
          <add key="ClearTextPassword" value="xxxxxx" />
        </HiAPI>
      </packageSourceCredentials>
    </configuration> 
    
  3. In the dotnet project file, add the package reference.

    <ItemGroup>
      <PackageReference Include="HiNc" Version="1.4.*" />
      <!--optional-->
      <PackageReference Include="Hi.Wpf" Version="*" /> 
    </ItemGroup>
    
  4. In the program file, setting the HiNC application initialization and finalization.

    using Hi.Disp;
    using Hi.HiNcKits;
    using Hi.Licenses;
    using Hi.MongoUtils;
    using System;
    
    namespace Sample
    {
        /// <summary>
        /// A sample class demonstrating initialization and usage of the HiAPI framework.
        /// Shows the basic setup of display engine, MongoDB server, licensing, and other core functionality.
        /// </summary>
        /// <remarks>
        /// This example serves as an entry point for those getting started with HiAPI.
        /// It demonstrates proper initialization and teardown of key components.
        /// ### Source Code
        /// [!code-csharp[SampleCode](~/../Hi.Sample/HelloHiAPI.cs)]
        /// </remarks>
        public static class HelloHiAPI
        {
            static int Main(string[] args)
            {
                Console.WriteLine("HiAPI starting.");
                SingleUserApp.AppBegin();
    
                Console.WriteLine("Hello World! HiAPI.");
    
                SingleUserApp.AppEnd();
                Console.WriteLine("HiAPI exited.");
    
                return 0;
            }
        }
    }
    

Sample Code to Start a MachiningProject

See the following sample code to start a HiAPI application.