本文整理汇总了C#中Program.Show方法的典型用法代码示例。如果您正苦于以下问题:C# Program.Show方法的具体用法?C# Program.Show怎么用?C# Program.Show使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Program
的用法示例。
在下文中一共展示了Program.Show方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Main
static void Main(string[] args)
{
Destination = Properties.Settings.Default.DestinationFolder;
AutoRename = Properties.Settings.Default.AutoRename;
try
{
// Show GUI
if (args.Length.Equals(0))
{
Program program = new Program();
program.InitializeComponent();
program.Show();
Application.Run(program);
}
// Handle file
else if (args.Length.Equals(1))
{
if (Destination.Equals("") || Destination == null || !Directory.Exists(Destination))
{
// Problem with destination, starting gui..
Program program = new Program();
program.InitializeComponent();
program.Show();
MessageBox.Show(program, "Please fix Destination folder, then try again");
Application.Run(program);
}
else
{
string filename = Path.GetFileName(args[0]);
string finalDestination = Path.Combine(Destination, filename);
if (File.Exists(finalDestination))
{
if (AutoRename)
{
// Rename source/file.ext to source/file1231.ext
string temppath = Path.GetFileNameWithoutExtension(finalDestination);
string tempext = Path.GetExtension(finalDestination);
finalDestination = temppath + new Random().Next(0, 9999) + tempext;
}
else
{
// Error.. file exists
MessageBox.Show("Error: Destination file already exists: " + finalDestination + "\n\nTip: Turn on automatic renaming of files");
return;
}
}
System.Console.WriteLine("Source: {0}\n" +
"Destination: {1}", args[0], Destination);
File.Move(args[0], finalDestination);
}
}
}
catch (Exception ex)
{
MessageBox.Show("I think I'm going to puke!1111\n\n\n ARRGGHHHH \n\n" + ex.ToString(), "NZBRunner error :(");
}
}