mirror of
https://github.com/qmlnet/qmlnet.git
synced 2026-05-15 22:02:31 -06:00
40 lines
1.1 KiB
C#
40 lines
1.1 KiB
C#
using System;
|
|
using Qml.Net;
|
|
|
|
namespace NetHost
|
|
{
|
|
class Program
|
|
{
|
|
public class TestObject
|
|
{
|
|
public void TestMethod()
|
|
{
|
|
Console.WriteLine("test method");
|
|
}
|
|
}
|
|
|
|
static int Main(string[] _)
|
|
{
|
|
// The "_" contains some private arguements to help
|
|
// bootstrap things. It is intended to be passed
|
|
// immediately into Host.Run(...).
|
|
|
|
// Phase 5
|
|
// Unwrap the magic.
|
|
return Host.Run(_, (args, app, engine, runCallback) =>
|
|
{
|
|
// "args" contains the any user defined arguements passed from
|
|
// CoreHost::run(..) in C++.
|
|
|
|
// Phase 6
|
|
// Register any .NET types that will be used.
|
|
QQmlApplicationEngine.RegisterType<TestObject>("test");
|
|
|
|
// Phase 7
|
|
// This callback passes control back to C++ to perform
|
|
// any file registrations and run the event loop.
|
|
return runCallback();
|
|
});
|
|
}
|
|
}
|
|
}
|