Answer the question
In order to leave comments, you need to log in
How to run WPF application from console?
Good afternoon.
What is available:
// Наш класс WPF приложения.
MainWindow WPF = new MainWindow();
Thread WPFTh = new Thread(new ThreadStart(WPF.MainWindows));
WPFTh.Start(); // Запускаем поток
MainWindow WPF = new MainWindow();
Thread WPFTh = new Thread(new ThreadStart(WPF.Show));
WPFTh.Start();
Answer the question
In order to leave comments, you need to log in
using System;
class Program
{
[STAThread]
static void Main(string[] args)
{
Console.WriteLine("Starting WpfApplication1.exe...");
var domain = AppDomain.CreateDomain("WpfApplication1Domain");
try
{
domain.ExecuteAssembly("WpfApplication1.exe");
}
catch(Exception ex)
{
Console.WriteLine(ex.ToString());
}
finally
{
AppDomain.Unload(domain);
}
Console.WriteLine("WpfApplication1.exe exited, exiting now.");
}
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question