打开自PROGRAMM类的窗口? [英] Open a Window since Programm class?
本文介绍了打开自PROGRAMM类的窗口?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个控制台应用程序。所以我需要打开一个名为UserInterface.xaml这是一个窗口窗口
I have a console application. So I need Open a Window called "UserInterface.xaml" this is a Window.
我在我的类节目我有这样的:
I my class Program I have this:
class Program
{
[STAThread]
static void Main(string[] args)
{
var userInterface = new UserInterface();
userInterface .Show();
}
的
UserInterface.xaml被打开,但随后立即关闭时的问题。而我需要它捕获来自用户的一些数据。
The problem is when the UserInterface.xaml is opened but then is closed immediately. And I need it for capture some data from user.
这是我班的UserInterface:
this is my class UserInterface:
public partial class UserInterface: Window
{
public UserInterface()
{
InitializeComponent();
}
........
}
我怎样才能让的UserInterface窗口保持打开
How can I make the UserInterface window stay opened?
推荐答案
尝试如下细化的Main()?
Try to refine your Main() as below:
[STAThread]
static void Main(string[] args)
{
var userInterface = new UserInterface();
System.Windows.Application app = new System.Windows.Application();
app.Run(userInterface);
}
这篇关于打开自PROGRAMM类的窗口?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文