static void Main(string[] args) { using (var application = new QGuiApplication(args)) { using (var engine = new QQmlApplicationEngine()) { var listOfContacts = CreateDemoContactList(); Qml.Net.Qml.RegisterType <ContactList>("QmlNet.Tutorials.ContactList", 1, 0); engine.SetContextProperty("contacts", listOfContacts); engine.Load("Tutorial02.qml"); engine.SetContextProperty("contacts", listOfContacts); application.Exec(); } } }
static int Main(string[] args) { RuntimeManager.DiscoverOrDownloadSuitableQtRuntime(); using (var app = new QGuiApplication(args)) { Qml.Net.Qml.RegisterType <Trans>("TaoQuickNet"); var trans = new Trans(); trans.loadFolder(Config.Config.transPath); using (var engine = new QQmlApplicationEngine()) { Console.WriteLine("importPath " + Config.Config.importPath); Console.WriteLine("imgPath " + Config.Config.imgPath); engine.AddImportPath(Config.Config.importPath); engine.SetContextProperty("imgPath", Config.Config.imgPath); engine.SetContextProperty("qmlPath", Config.Config.qmlPath); engine.SetContextProperty("contentsPath", Config.Config.contentsPath); engine.SetContextProperty("isDebug", true); engine.SetContextProperty("taoQuickImagePath", Config.Config.importPath + "TaoQuick/Images/"); engine.SetContextProperty("trans", trans); engine.Load(Config.Config.qmlPath + "main.qml"); return(app.Exec()); } } }
static int Main(string[] args) { using (var app = new QGuiApplication(args)) { QQmlApplicationEngine.ActivateMVVMBehavior(); if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) { QQuickStyle.SetStyle("Universal"); } else if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux)) { QQuickStyle.SetStyle("Material"); } using (var engine = new QQmlApplicationEngine()) { engine.SetContextProperty("app", new MainViewModel()); engine.Load("Views/main.qml"); return(app.Exec()); } } }