本文整理汇总了C#中MainWindow.Destroy方法的典型用法代码示例。如果您正苦于以下问题:C# MainWindow.Destroy方法的具体用法?C# MainWindow.Destroy怎么用?C# MainWindow.Destroy使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MainWindow
的用法示例。
在下文中一共展示了MainWindow.Destroy方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Main
public static void Main(string[] args)
{
Application.Init();
var win = new MainWindow();
if (OpenSubtitlesClient.CheckForConnection())
{
win.PopulateLanguages();
win.Show();
}
else
{
win.ShowError("Can't connect to Opensubtitles.org\nPlease check your internet connection");
win.Destroy();
Application.Quit();
return;
}
Application.Run();
}
示例2: Main
public static void Main(string[] args)
{
Application.Init();
MainWindow win = new MainWindow();
// Detect if there is a Build directory in the local folder. If not,
// prompt to create a new module.
if (!Directory.Exists("Build"))
{
var confirm = new MessageDialog(
win,
DialogFlags.Modal,
MessageType.Question,
ButtonsType.YesNo,
false,
"The current directory is not a Protobuild module. Would " +
"you like to turn this directory into a module?");
var result = (ResponseType)confirm.Run();
if (result == ResponseType.No)
{
// We can't run the module manager if the current directory
// isn't actually a module!
confirm.Destroy();
win.Destroy();
return;
}
confirm.Destroy();
var create = new CreateProjectDialog(win, "Module", true);
create.Modal = true;
if ((ResponseType)create.Run() != ResponseType.Ok)
{
create.Destroy();
win.Destroy();
return;
}
string error;
if (!win.CreateProject(create.ProjectName, "Module", out error, true))
{
var errorDialog = new MessageDialog(
win,
DialogFlags.Modal,
MessageType.Error,
ButtonsType.Ok,
"Unable to create module: " + error);
errorDialog.Run();
errorDialog.Destroy();
create.Destroy();
win.Destroy();
return;
}
Directory.CreateDirectory("Build");
ResourceExtractor.ExtractAll(Path.Combine(
Environment.CurrentDirectory,
"Build"), create.ProjectName);
create.Destroy();
}
// Load the module.
win.Module = ModuleInfo.Load(Path.Combine("Build", "Module.xml"));
win.InitializeToolbar();
win.Update();
win.Show();
Application.Run();
}