static int Main(string[] args) { _CheckTimer = new Timer((e) => { CheckAndPrint(); }); _CheckTimer.Change(TimeSpan.FromSeconds(2), TimeSpan.FromSeconds(5)); using (var app = new QGuiApplication(args)) { _App = app; AppModel.UIDispatch += (a) => _App.Dispatch(a); QQmlApplicationEngine.ActivateMVVMBehavior(); using (var engine = new QQmlApplicationEngine()) { QQmlApplicationEngine.RegisterType <AppModel>("app", 1, 1); var assemblyDir = Path.GetDirectoryName(new Uri(Assembly.GetExecutingAssembly().Location).AbsolutePath); var mainQmlPath = Path.Combine(assemblyDir, "UI", "QML", "main.qml"); engine.Load(mainQmlPath); int result = app.Exec(); _App = null; return(result); } } }
static int Main() { #if DEBUG Helpers.LoadDebugVariables(); #endif Task.Factory.StartNew(() => { while (true) { Thread.Sleep(10); GC.Collect(GC.MaxGeneration); } // ReSharper disable FunctionNeverReturns }); // ReSharper restore FunctionNeverReturns using (var r = new StringVector(0)) { using (var app = new QGuiApplication(r)) { using (var engine = new QQmlApplicationEngine()) { QQmlApplicationEngine.RegisterType <TestQmlImport>("test", 1, 1); engine.loadFile("main.qml"); return(app.exec()); } } } }
public void GlobalSetup() { if (!_initialized) { QQmlApplicationEngine.RegisterType <QmlType>("tests"); _initialized = true; } }
protected void RegisterType <T>() { if (_registeredTypes.Contains(typeof(T))) { return; } _registeredTypes.Add(typeof(T)); QQmlApplicationEngine.RegisterType <T>("tests"); }
protected AbstractBaseQmlTests() { _coreApplication = new QGuiApplication(new [] { "-platform", "offscreen" }); qmlApplicationEngine = new QQmlApplicationEngine(); TypeCreator = new MockTypeCreator(); Net.TypeCreator.Current = TypeCreator; TypeCreator.SetInstance(typeof(TestContext), new TestContext(_coreApplication)); if (!_testContextRegistered) { QQmlApplicationEngine.RegisterType <TestContext>("testContext"); _testContextRegistered = true; } }
static int Main(string[] args) { using (var app = new QGuiApplication(args)) { using (var engine = new QQmlApplicationEngine()) { engine.AddImportPath(Path.Combine(Directory.GetCurrentDirectory(), "Qml")); QQmlApplicationEngine.RegisterType <TestQmlImport>("test"); engine.Load("main.qml"); return(app.Exec()); } } }
static int Main(string[] args) { var path = System.Environment.GetEnvironmentVariable("PATH"); path += ";" + @"D:\Git\Github\pauldotknopf\net-core-qml\src\native\build-QtNetCoreQml-Desktop_Qt_5_9_1_MSVC2017_64bit-Debug\debug"; System.Environment.SetEnvironmentVariable("PATH", path); Task.Factory.StartNew(() => { while (true) { Thread.Sleep(1000); GC.Collect(GC.MaxGeneration); } }); using (var r = new StringVector(0)) { using (var app = new QGuiApplication(r)) { using (var engine = new QQmlApplicationEngine()) { QQmlApplicationEngine.RegisterType <TestQmlImport>("test", 1, 1); var method = NetTypeInfoManager.GetTypeInfo <TestQmlImport>().GetMethod(0); Console.WriteLine(method.GetMethodName()); NetTestHelper.RunMethod(engine, @" import QtQuick 2.0 import test 1.1 TestQmlImport { } ", method, null, null); //engine.loadFile("main.qml"); //return app.exec(); } } } return(0); }
static int Main(string[] args) { QQuickStyle.SetStyle("Material"); using (var application = new QGuiApplication(args)) { using (var qmlEngine = new QQmlApplicationEngine()) { QQmlApplicationEngine.RegisterType <SignalsModel>("Features"); QQmlApplicationEngine.RegisterType <NotifySignalsModel>("Features"); QQmlApplicationEngine.RegisterType <AsyncAwaitModel>("Features"); QQmlApplicationEngine.RegisterType <NetObjectsModel>("Features"); QQmlApplicationEngine.RegisterType <DynamicModel>("Features"); qmlEngine.Load("Main.qml"); return(application.Exec()); } } }
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(); })); }