/*static int Main(string[] args) * { * using (var app = new QGuiApplication(args)) * { * using (var engine = new QQmlApplicationEngine()) * { * // TODO: Register your .NET types. * // Qml.RegisterType<NetObject>("test"); * * engine.Load("Main.qml"); * * return app.Exec(); * } * } * }*/ static int Main(string[] args) { RuntimeManager.DiscoverOrDownloadSuitableQtRuntime(); using (var app = new QGuiApplication(args)) { using (var engine = new QQmlApplicationEngine()) { // TODO: Register your .NET types to be used in Qml Qml.Net.Qml.RegisterType <QmlType>("TestApp", 1, 1); // in QML file: import TestApp 1.1 Qml.Net.Qml.RegisterType <YourNetObject>("YourApp", 2, 1); // in QML file: import YourApp 2.1 var netObject = new YourNetObject(); // You can attach signal handlers from both .NET and QML: netObject.AttachToSignal("signalName", new Action <string, int>((param1, param2) => { Console.WriteLine("Signal raised from .NET! {0} {1}", param1, param2); })); engine.Load("Main.qml"); // You can raise signals from .NET: netObject.ActivateSignal("signalName", "param", 3); return(app.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()); } } }
public static void Setup() { Console.WriteLine("Checking and downloading QT runtime if not installed..."); RuntimeManager.DiscoverOrDownloadSuitableQtRuntime(); Console.WriteLine("QT runtime is OK."); }
private static int Main(string[] args) { RuntimeManager.DiscoverOrDownloadSuitableQtRuntime(); Qt.PutEnv("QT_QUICK_CONTROLS_CONF", System.IO.Directory.GetCurrentDirectory() + "/qml/qtquickcontrols2.conf"); QmlNetConfig.ShouldEnsureUIThread = false; // remove this line when fixed in qml.net: temporary workaround for https://github.com/qmlnet/qmlnet/issues/112 using QGuiApplication app = new QGuiApplication(args); using QQmlApplicationEngine engine = new QQmlApplicationEngine(); // Register our new type to be used in Qml QmlBridge.RegisterTypes(); engine.Load(System.IO.Path.Combine(System.AppDomain.CurrentDomain.BaseDirectory, "qml", "main.qml")); return(app.Exec()); }
static int Main(string[] args) { RuntimeManager.DiscoverOrDownloadSuitableQtRuntime(); QQuickStyle.SetStyle("Material"); using (var application = new QGuiApplication(args)) { using (var qmlEngine = new QQmlApplicationEngine()) { Qml.Net.Qml.RegisterType <TrayModel>("app"); qmlEngine.Load("TrayIcon.qml"); return(application.Exec()); } } }
static int Main(string[] args) { RuntimeManager.DiscoverOrDownloadSuitableQtRuntime(); using (var app = new QGuiApplication(args)) { using (var engine = new QQmlApplicationEngine()) { Qml.Net.Qml.RegisterType <EditorModel>("Editor"); engine.Load("main.qml"); return(app.Exec()); } } }
static int Main(string[] args) { RuntimeManager.DiscoverOrDownloadSuitableQtRuntime(); using (var application = new QGuiApplication(args)) { using (var qmlEngine = new QQmlApplicationEngine()) { qmlEngine.Load("photoshopGUI.qml"); return(application.Exec()); } } }
private static int Main(string[] args) { GetResponse(); RuntimeManager.DiscoverOrDownloadSuitableQtRuntime(); QQuickStyle.SetStyle("Material"); using (var application = new QGuiApplication()) { using (var qmlEngine = new QQmlApplicationEngine()) { qmlEngine.Load("Main.qml"); return(application.Exec()); } } }
public static BootstrapperBuilder DetectQtRuntime(this BootstrapperBuilder builder) { builder.ResolveQtRuntime = () => { var loader = new QtRuntimeLoader(); if (loader.HasBuiltInRuntime) { loader.Load(); } else { RuntimeManager.DiscoverOrDownloadSuitableQtRuntime(); } }; return(builder); }
static int Main(string[] args) { RuntimeManager.DiscoverOrDownloadSuitableQtRuntime(); QQuickStyle.SetStyle("Material"); using (var application = new QGuiApplication(args)) { using (var engine = new QQmlApplicationEngine()) { // Register our new type to be used in Qml //Qml.Net.Qml.RegisterType<QmlType>("test", 1, 1); engine.Load("QML/Main.qml"); return(application.Exec()); } } }
static int Main(string[] args) { var coll = new ServiceCollection().AddHttpClient(); RuntimeManager.DiscoverOrDownloadSuitableQtRuntime(); using (var app = new QGuiApplication()) { Console.WriteLine("entered 1st using"); using (var engine = new QQmlApplicationEngine()) { Console.WriteLine("entered 2nd using"); Qml.Net.Qml.RegisterType <QmlType>("test", 1, 1); engine.Load("qml/main.qml"); return(app.Exec()); } } }
static int Main(string[] args) { RuntimeManager.DiscoverOrDownloadSuitableQtRuntime(); QQuickStyle.SetStyle("Material"); using (var application = new QGuiApplication(args)) { using (var qmlEngine = new QQmlApplicationEngine()) { Qml.Net.Qml.RegisterType <MainController>("Controllers"); Qml.Net.Qml.RegisterType <SimpleList>("Lists"); qmlEngine.Load("Main.qml"); return(application.Exec()); } } }
static int Main(string[] args) { RuntimeManager.DiscoverOrDownloadSuitableQtRuntime(); Init(); //QQuickStyle.SetStyle("Material"); using (var application = new QGuiApplication(args)) { using (var qmlEngine = new QQmlApplicationEngine()) { Qml.Net.Qml.RegisterType <LibraryList>("MIXManga.NET.VS"); qmlEngine.Load("Main.qml"); return(application.Exec()); } } }
static int Main(string[] args) { RuntimeManager.DiscoverOrDownloadSuitableQtRuntime(); // QQuickStyle.SetStyle("Material"); using (var app = new QGuiApplication(args)) { using (var engine = new QQmlApplicationEngine()) { // TODO: Register your .NET types. // Qml.RegisterType<NetObject>("test"); engine.Load("Main.qml"); return(app.Exec()); } } }
public static int Run() { RuntimeManager.DiscoverOrDownloadSuitableQtRuntime(); QQuickStyle.SetStyle("Material"); QCoreApplication.SetAttribute(ApplicationAttribute.EnableHighDpiScaling, true); using var app = new QGuiApplication(); using var engine = new QQmlApplicationEngine(); Qml.Net.Qml.RegisterType <SettingsModel>("Aris.Moe.OverlayTranslate.Gui.Qt5", 1, 1); Qml.Net.Qml.RegisterType <ControlsModel>("Aris.Moe.OverlayTranslate.Gui.Qt5", 1, 1); engine.Load("Main.qml"); return(app.Exec()); }
static int Main(string[] args) { RuntimeManager.DiscoverOrDownloadSuitableQtRuntime(); foreach (DictionaryEntry item in Environment.GetEnvironmentVariables()) { Console.WriteLine($"{ item.Key }:{ item.Value }"); } using (var application = new QGuiApplication(args)) { using (var qmlEngine = new QQmlApplicationEngine()) { #if DEBUG qmlEngine.Load("qml/main.qml"); #else qmlEngine.Load($"{Path.GetDirectoryName(System.Reflection.Assembly.GetEntryAssembly().Location)}/qml/main.qml"); #endif return(application.Exec()); } } }
public static async Task Main(string[] args) { // Dependency injection. var serviceCollection = new ServiceCollection(); var connectionStringBuilder = new SqliteConnectionStringBuilder { DataSource = "todoApp.db" }; var connectionString = connectionStringBuilder.ToString(); serviceCollection.ConfigureServices(); serviceCollection.ConfigureDatabase(connectionString); var serviceProvider = serviceCollection.BuildServiceProvider(); // Seed database. Do NOT dispose dbContext, that would destroy our only dbContext singleton instance. var dbContext = serviceProvider.GetRequiredService <TodoAppDbContext>(); await dbContext.EnsureSeedData(); RuntimeManager.DiscoverOrDownloadSuitableQtRuntime(); QQuickStyle.SetStyle("Material"); using (var application = new QGuiApplication(args)) { using (var qmlEngine = new QQmlApplicationEngine()) { Qml.Net.Qml.RegisterType <TodoItemsController>("TodoApp"); TypeCreator.Current = TypeCreator.FromDelegate((type) => serviceProvider.GetRequiredService(type)); qmlEngine.Load("Main.qml"); application.Exec(); } } }
static int Main(string[] args) { RuntimeManager.DiscoverOrDownloadSuitableQtRuntime(); QQuickStyle.SetStyle("Material"); using (var application = new QGuiApplication(args)) { using (var qmlEngine = new QQmlApplicationEngine()) { Qml.Net.Qml.RegisterType <SignalsModel>("Features"); Qml.Net.Qml.RegisterType <NotifySignalsModel>("Features"); Qml.Net.Qml.RegisterType <AsyncAwaitModel>("Features"); Qml.Net.Qml.RegisterType <NetObjectsModel>("Features"); Qml.Net.Qml.RegisterType <DynamicModel>("Features"); Qml.Net.Qml.RegisterType <CalculatorModel>("Features"); Qml.Net.Qml.RegisterType <CollectionsModel>("Features"); qmlEngine.Load("Main.qml"); return(application.Exec()); } } }
public ManagedQmlHosting() { RuntimeManager.DiscoverOrDownloadSuitableQtRuntime(); QQuickStyle.SetStyle("Universal"); }
public UnmanagedQmlHosting() { RuntimeManager.DiscoverOrDownloadSuitableQtRuntime(); }
static void Main(string[] args) { const string configFilePath = "config.json"; ConfigFile configFile = ConfigFile.Read(configFilePath); if (configFile == null) { configFile = new ConfigFile { SerialPortName = null, BaudRate = 9600 }; configFile.Save(configFilePath); } SerialServer serialServer = null; while (serialServer == null) { string[] ports = SerialPort.GetPortNames(); if (ports.Length < 1) { serialServer = new SerialServer(DummyPort.Instance); //Console.WriteLine("No Ports found, retrying in 1s"); //Thread.Sleep(1000); continue; } string portName = null; if (!string.IsNullOrEmpty(configFile.SerialPortName)) { if (ports.Contains(configFile.SerialPortName)) { portName = configFile.SerialPortName; } else { Console.WriteLine($"Port {configFile.SerialPortName} not available, retrying in 1s"); Thread.Sleep(1000); continue; } } else { portName = ports[0]; } if (portName != null) { Console.WriteLine("Connecting to " + portName); int baudRate = configFile.BaudRate < 1 ? 9600 : configFile.BaudRate; ISerialPort port = new SerialPortWrapper(portName, baudRate); //ReadTimeOut //WriteTimeOut serialServer = new SerialServer(port); } } CommunicationServer communicationServer = new CommunicationServer(serialServer); MachineState state = new MachineState(communicationServer); communicationServer.RunAsync(); state.Reset(); RuntimeManager.DiscoverOrDownloadSuitableQtRuntime(); using (var application = new QGuiApplication(args)) { MainViewModel.App = application; QQmlApplicationEngine.ActivateMVVMBehavior(); using (var qmlEngine = new QQmlApplicationEngine()) { Qml.Net.Qml.RegisterType <MainViewModel>("LoopMachineOsc"); qmlEngine.Load("Main.qml"); var result = application.Exec(); } } communicationServer.Stop(); }