SilverFactorial.LoggedTextBox.LoggedTextBox C# (CSharp) Method

LoggedTextBox() public method

public LoggedTextBox ( TextBox textBox ) : System
textBox System.Windows.Controls.TextBox
return System
        public LoggedTextBox(TextBox textBox)
        {
            string outputDir = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + @"\BenchmarkApplication\";
            var df = new DirectoryInfo(outputDir);
            if (! df.Exists)
            {
                df = Directory.CreateDirectory(df.FullName);
            }

            string fileName = string.Format(df.FullName + "BenchmarkApplication{0}.log", DateTime.Now.ToFileTime());
            var logFile = new FileStream(fileName, FileMode.Append, FileAccess.Write, FileShare.None);
            this.streamWriter = new StreamWriter(logFile);
            this.textBox = textBox;

            this.appendText = delegate(string text)
            {
                textBox.AppendText(text);
                textBox.ScrollToEnd();
                textBox.Focus();
            };
        }