when press enter app twice quickly,the second launching crash. have find out reason in logs:
"the process cannot access file '..\filemanifest.xml' because being used process."
i have researched on many sites , answers how prevent app launching twice,not how allow app launching many time. of help.
how can allow app run twice without crash?
add app metod check file in use:
protected virtual bool isfilelocked(fileinfo file) { filestream stream = null; try { stream = file.open(filemode.open, fileaccess.readwrite, fileshare.none); } catch (ioexception) { //the file unavailable because is: //still being written //or being processed thread //or not exist (has been processed) return true; } { if (stream != null) stream.close(); } //file not locked return false; }
and
(int = 0; < 100; i++) { if (isfilelocked(file)) { //add want thread.sleep(1000); } else { //add want return; } }
Comments
Post a Comment