public static void Main(String[] args) { if (args.Length > 1) { String error = LanguageUtil.GetCurrentLanguageString("InputError", "Program", LanguageUtil.GetReallyShortCulture(CultureInfo.CurrentCulture.Name)); ProgramException exception = new ProgramException(error); throw exception; } Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.ThreadException += Main_ThreadExceptionEventHandler; Application.Run(new Form1(args)); }
private void This_StartupNextInstance(object sender, StartupNextInstanceEventArgs e) { String[] args = new String[e.CommandLine.Count]; for (int i = 0; i < e.CommandLine.Count; i++) { args[i] = e.CommandLine[i]; } Form1 form = MainForm as Form1; if (form == null) { String error = "Error during DtPad instance read." + Environment.NewLine + "Unable to execute the selected operation."; ProgramException exception = new ProgramException(error); WindowManager.ShowErrorProgramBox(null, error, exception); return; } form.OpenFiles(args); }