c# - Outputing log file to WPF listbox -
i want display log file listbox
on wpf application
. have modified this sample application that. have question regarding displaying of contents of file.
void displayfilesystemwatcherinfo(system.io.watcherchangetypes watcherchangetypes, string name, string oldname = null) { dispatcher.begininvoke(new action(() => { addlistline(string.format("{0} -> {1} - {2}", watcherchangetypes.tostring(), name, datetime.now)); })); }
it prints when file has changed. rather have contents of log file
displayed on screen. how do that?
what have right way monitor changes in file , add these changes listbox.
if want read file , add content listbox, this question has been asked before. here's code sample it:
listboxobject.datasource = file.readalllines("pathtoyourfilehere");
wiki
Comments
Post a Comment