private void loadForm() { try { if (isInitialized) { return; } errorData = ErrorDataHandler.Load(); this.lblHeader.Text = string.IsNullOrEmpty(errorData.Header) ? DefaultHeader : errorData.Header; this.tbErrorMessage.Text = !File.Exists(errorData.ErrorFile) ? "File " + errorData.ErrorFile + " not found" : File.ReadAllText(errorData.ErrorFile); } catch (Exception ex) { onException(ex); } }
private void initializeComponent(string header, string errorFile) { this.header = header; this.errorFile = errorFile; try { this.lblHeader.Text = string.IsNullOrEmpty(header) ? DefaultHeader : this.header; this.tbErrorMessage.Text = !File.Exists(this.errorFile) ? "File " + this.errorFile + " not found" : File.ReadAllText(this.errorFile); ErrorDataHandler.Save(new ErrorData(this.lblHeader.Text, this.errorFile)); isInitialized = true; } catch (Exception ex) { onException(ex); } }