private void ExportItemGridView_CellValueChanged(object sender, DataGridViewCellEventArgs e) { if (e.RowIndex < 0 || e.ColumnIndex < 0) { return; } var row = ExportItemGridView.Rows[e.RowIndex]; ExportItem item = row.Tag as ExportItem; if (e.ColumnIndex == ColumnExportCheckbox.Index) { if (item != null) { item.Selected = row.Cells[0].Value == null ? Default_ExportItemSelected : (bool)row.Cells[0].Value; } } if (e.ColumnIndex == ColumnKeepPositionCheckbox.Index) { if (item != null) { item.KeepPosition = row.Cells[e.ColumnIndex].Value == null ? Default_KeepPosition : (bool)row.Cells[e.ColumnIndex].Value; } } if (e.ColumnIndex == ColumnFilePath.Index) { string str = row.Cells[e.ColumnIndex].Value as string; if (item == null) { item = AddExportItem(row, str); } else { item.SetExportFilePath(str); } SetRowData(row, item); } if (e.ColumnIndex == ColumnTexturesFolder.Index) { string str = row.Cells[e.ColumnIndex].Value as string; if (item == null) { item = AddExportItem(row, str); } else { item.SetExportTexturesFolderPath(str); } SetRowData(row, item); } }
private ExportItem AddExportItem(DataGridViewRow row, string exportPath) { ExportItem item = new ExportItem(exportItemList.OutputFileExtension); item.SetExportFilePath(GetUniqueExportPath(exportPath)); item.SetExportTexturesFolderPath(item.ExportTexturesesFolderPath); item.Selected = row.Cells[0].Value == null ? Default_ExportItemSelected : (bool)row.Cells[0].Value; exportItemList.Add(item); return(item); }
//! Add a new export item. Returns null if the given handle already exists in the export item list. private ExportItem TryAddExportItem(DataGridViewRow row, uint nodeHandle, string exportPath = null) { foreach (ExportItem existingItem in exportItemList) { if (existingItem.NodeHandle == nodeHandle) { return(null); } } ExportItem item = new ExportItem(exportItemList.OutputFileExtension, nodeHandle); item.SetExportFilePath(GetUniqueExportPath(exportPath != null ? exportPath : item.ExportFilePathRelative)); item.SetExportTexturesFolderPath(item.ExportTexturesesFolderPath); item.Selected = row.Cells[0].Value == null ? Default_ExportItemSelected : (bool)row.Cells[0].Value; exportItemList.Add(item); return(item); }