private void dgBuildList_DragDrop( object sender, DragEventArgs e ) { FileInfo fileInfo = _navigator.GetSelectedFile(); if (fileInfo != null) { var tsi = new TranslationSourceInfo( fileInfo.Name ); if (Ok2AddFileToBuildList( fileInfo )) { _sourceFiles.Add( tsi ); _bindingSource.ResetBindings( false ); SetButtonStates(); } } }
/** * Called when a file has been added to the Navigator. * We look to see if is a Translator source file and * is source code file. If it is we will automatically * add it to the build list. */ private void NavigatorOnFileAdded( FileInfo fi ) { try { if (IsFileInSourceFolder( fi )) { var property = cmbSourceTypes.SelectedValue as string; if (property == null) throw new Exception( "No Selected Source Item" ); var sourceFileExtensions = ATMLContext.GetProperty( property ) as string; if (sourceFileExtensions == null) throw new Exception( string.Format( "Failed to find property [{0}]", property ) ); if (sourceFileExtensions.Contains( fi.Extension )) { if (!HasFileInBuildList( fi )) { var si = new TranslationSourceInfo( fi.Name ); _sourceFiles.Add( si ); //SaveProjectInfo(); SetButtonStates(); _bindingSource.ResetBindings( false ); } } } } catch (Exception err) { LogManager.SourceError( ATMLTranslator.SOURCE, err ); } }
private void btnAddSource_Click( object sender, EventArgs e ) { var ofd = new OpenFileDialog(); if (DialogResult.OK == ofd.ShowDialog()) { foreach (string fileName in ofd.FileNames) { var fi = new FileInfo( fileName ); if (fi.Exists) { var tsi = new TranslationSourceInfo( fi.Name ); if (Ok2AddFileToBuildList( fi )) { _sourceFiles.Add( tsi ); _bindingSource.ResetBindings( false ); SetButtonStates(); } } } } }