public void Save()
{
if (!Dispatcher.CheckAccess())
{
Dispatcher.Invoke(new Action(this.Save));
return;
}
try
{
var sfd = new SaveFileDialog { Filter = "Octgn Game Log (*.txt) | *.txt" };
if (sfd.ShowDialog().GetValueOrDefault(false))
{
var tr = new TextRange(output.Document.ContentStart, output.Document.ContentEnd);
using (var stream = sfd.OpenFile())
{
tr.Save(stream, DataFormats.Text);
stream.Flush();
}
}
}
catch (Exception e)
{
Log.Warn("Save log error", e);
}
}