public static void Load(Form towhineat) { retry: Main = new ConfigurationData1(); try { using (var data = File.OpenRead(DataFile)) Main = Load(data); } catch (FileNotFoundException) { Main = new ConfigurationData1(); } catch (Exception e) { var result = MessageBox.Show (towhineat , "There was a problem loading your configuration:\n" + e.Message , "Load Error" , MessageBoxButtons.AbortRetryIgnore , MessageBoxIcon.Error ); switch (result) { case DialogResult.Retry: goto retry; case DialogResult.Abort: Application.Exit(); break; case DialogResult.Ignore: break; default: throw new ApplicationException("Should never happen!"); } } }
public static void Load( Form towhineat ) { Directory.CreateDirectory(Folder); retry: Main = new ConfigurationData1(); try { using ( var data = File.OpenRead(DataFile) ) Main = Load(data); } catch ( FileNotFoundException ) { // Ignore: probably our first run } catch ( Exception e ) { var result = MessageBox.Show ( towhineat , "There was a problem loading your configuration:\n" + e.Message , "Load Error" , MessageBoxButtons.AbortRetryIgnore , MessageBoxIcon.Error ); switch ( result ) { case DialogResult.Retry: goto retry; case DialogResult.Abort: Application.Exit(); break; case DialogResult.Ignore: break; default: throw new ApplicationException("Should never happen!"); } } }