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

Popular posts from this blog

elasticsearch - what is the equivalent data type for geo_point in hibernate search? -

firebase - How to wait value in Ionic 2 -

Jenkins: find build number for git commit -