void viewmodel_FileSelectionChanged(object sender, FileLoadingEventArgs e)
 {
     switch (e.State)
     {
         case FileLoadingEventArgs.LoadingState.PreLoad:
             InputBox.Visibility = System.Windows.Visibility.Visible;
             break;
         case FileLoadingEventArgs.LoadingState.Loaded:
             InputBox.Visibility = System.Windows.Visibility.Collapsed;
             NPCDataGrid.Items.Refresh();
             break;
         case FileLoadingEventArgs.LoadingState.Error:
             MessageBox.Show("Could not load file " + e.FileName + ":" + e.Error);
             break;
     }
 }
 private void OnFileLoaded(string file, FileLoadingEventArgs.LoadingState state,string message=null)
 {
     var e = FileSelectionChanged;
     if (e != null)
     {
         e(this, new FileLoadingEventArgs(file, state) { Error = message });
         LoadFileCommand.RaiseCanExecuteChanged();
     }
 }