Got exception in file picker c# and XAML if choose nothing? -


this question has answer here:

i have problem app made choose button select file pc got exception if didn't choose files hope can enter image description here

edit: code try/catch blocks

openpicker.filetypefilter.add(".wmv"); openpicker.filetypefilter.add(".mp4");  openpicker.filetypefilter.add(".wma");  openpicker.filetypefilter.add(".mp3");  storagefile file = await openpicker.picksinglefileasync();  var stream = (dynamic)null;  try {        stream = await file.openasync(windows.storage.fileaccessmode.read); } catch (exception ex) {      frame.navigate(typeof(music)); // optional choose page   } 

    var stream;     storagefile file;     try{         file = await openpicker.picksinglefileasync();         stream = await file.openasync(windows.storage.fileacessmode.read);     }catch(exception ex){         //log or     }     //the rest of code 

Comments

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -