static void Main(params string[] args) { try { ApplicationArguments.Initialize(args); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); DataCompareProject project = null; var fileName = ApplicationArguments.Instance[ArgumentType.Open]; if (fileName != null) { project = DataCompareProject.LoadFromFile(fileName); } var mainForm = ServiceAccess.MainForm = new MainForm(project); Application.Run(mainForm); } catch (AddressAlreadyInUseException ex) //TODO { ShowError("Failed to register Http Server.\nYou can change the port in .config file or provide argument: Port=[Port#]\n\n" + ex.Message); } catch (Exception ex) { ShowError(ex.GetBaseException().Message); } }
private void Open(string fileName) { if (IsDirty) { if (!SaveCurrent()) { return; } } try { var project = DataCompareProject.LoadFromFile(fileName); ShowProject(project); } catch (Exception ex) { MessageBox.Show(ex.Message, "Error connecting to database", MessageBoxButtons.OK, MessageBoxIcon.Error); } }