private void timer_Elapsed(object sender, ElapsedEventArgs e) { lock (this) { CreateRandomText createRandomText = new CreateRandomText(); // If we're to clean the file we only want to do it on the first timer tick if (FirstCall) { createRandomText.Create(this.textBoxFileName.Text, this.checkBoxEmptyFileOnStart.Checked); FirstCall = false; } else { createRandomText.Create(this.textBoxFileName.Text, false); } } }
private void timer_Elapsed(object sender, ElapsedEventArgs e) { lock (this) { CreateRandomText createRandomText = new CreateRandomText(); // If we're to clean the file we only want to do it on the first timer tick if (FirstCall) { createRandomText.Create(this.textBoxFileName.Text, this.checkBoxEmptyFileOnStart.Checked); FirstCall = false; } else { createRandomText.Create(this.textBoxFileName.Text, false); } } }