private static void Main() { Control.CheckForIllegalCrossThreadCalls = false; //Application.EnableVisualStyles(); //Application.SetCompatibleTextRenderingDefault(false); #if !DEBUG try { #endif // Parse Arguments Arguments = DefaultArguments; PositionalArguments = CommandLineFlags.ParseArguments(Arguments, Environment.GetCommandLineArgs().Skip(1).ToArray()); if (string.IsNullOrEmpty(Arguments.ZoneDirectory)) { MessageBox.Show(String.Join(Environment.NewLine, CommandLineFlags.GenerateCommandLineHelp(Arguments)), "Syntax"); } var backup = new BackgroundWorker(); backup.DoWork += delegate { while (true) { Thread.Sleep(1000 * 60 * 3); if (ZONE != null) { ZONE.SaveZone(true); } } }; backup.RunWorkerAsync(); Application.Run((FORM = new MainForm())); #if !DEBUG } catch (Exception e) { CrashDialog.Show(e); } #endif }
public static void LoadZone(string path) { if (BUSY) { return; } BUSY = true; var w = new BackgroundWorker(); w.DoWork += delegate { try { InternalLoadZone(path); BUSY = false; } catch (Exception ex) { CrashDialog.Show(ex); } }; w.RunWorkerAsync(); }