private DataGridViewGenericRow(string headerName, string rowName, ReadWriteAccess readWriteAcess, bool isHeader, bool isMultiLine, PropertyKey propertyKey, Metadata metadata, FileEntryAttribute fileEntryAttribute, MetadataPriorityKey metadataPriorityKey, LocationCoordinate locationCoordinate) { this.HeaderName = headerName ?? throw new ArgumentNullException(nameof(rowName)); this.RowName = rowName == null ? "" : rowName; this.ReadWriteAccess = readWriteAcess; this.IsHeader = isHeader; this.IsEqual = false; this.IsFavourite = false; this.IsMultiLine = isMultiLine; this.PropertyKey = propertyKey; this.Metadata = metadata; this.FileEntryAttribute = fileEntryAttribute; this.MetadataPriorityKey = metadataPriorityKey; this.LocationCoordinate = locationCoordinate; }
public DataGridViewGenericRow(string headerName, string rowName, MetadataPriorityKey metadataPriorityKey) : this(headerName, rowName, ReadWriteAccess.AllowCellReadAndWrite, false, false, null, null, null, metadataPriorityKey, null) { }
public static void PopulateFile(DataGridView dataGridView, FileEntryAttribute fileEntryAttribute, ShowWhatColumns showWhatColumns) { //----------------------------------------------------------------- //Chech if need to stop if (GlobalData.IsApplicationClosing) { return; } if (!DataGridViewHandler.GetIsAgregated(dataGridView)) { return; //Not default columns or rows added } if (DataGridViewHandler.GetIsPopulatingFile(dataGridView)) { return; //In progress doing so } //Check if file is in DataGridView, and needs updated if (!DataGridViewHandler.DoesColumnFilenameExist(dataGridView, fileEntryAttribute.FileFullPath)) { return; } //When file found, Tell it's populating file, avoid two process updates DataGridViewHandler.SetIsPopulatingFile(dataGridView, true); //----------------------------------------------------------------- exiftoolReader.MetadataReadPrioity.ReadOnlyOnce(); Image thumbnail = DatabaseAndCacheThumbnail.ReadThumbnailFromCacheOnly(fileEntryAttribute); int columnIndex = DataGridViewHandler.AddColumnOrUpdateNew( dataGridView, fileEntryAttribute, thumbnail, null, ReadWriteAccess.ForceCellToReadOnly, showWhatColumns, new DataGridViewGenericCellStatus(MetadataBrokerType.Empty, SwitchStates.Disabled, true), out FileEntryVersionCompare fileEntryVersionCompareReason); if (FileEntryVersionHandler.NeedUpdate(fileEntryVersionCompareReason)) { //Clear old content, in case of new values are updated or deleted for (int rowIndex = 0; rowIndex < DataGridViewHandler.GetRowCountWithoutEditRow(dataGridView); rowIndex++) { DataGridViewHandler.SetCellValue(dataGridView, columnIndex, rowIndex, null, false); } List <ExiftoolData> exifToolDataList = DatabaseExiftoolData.Read(fileEntryAttribute); string lastRegion = ""; foreach (ExiftoolData exiftoolData in exifToolDataList) { if (lastRegion != exiftoolData.Region) { DataGridViewHandler.AddRow(dataGridView, columnIndex, new DataGridViewGenericRow(exiftoolData.Region), null, new DataGridViewGenericCellStatus(MetadataBrokerType.Empty, SwitchStates.Disabled, true), false); lastRegion = exiftoolData.Region; } MetadataPriorityKey metadataPriorityKey = new MetadataPriorityKey(exiftoolData.Region, exiftoolData.Command); MetadataPriorityGroup metadataPriorityGroup = null; bool priorityKeyExisit = exiftoolReader.MetadataReadPrioity.MetadataPrioityDictionary.ContainsKey(metadataPriorityKey); if (priorityKeyExisit) { metadataPriorityGroup = new MetadataPriorityGroup(metadataPriorityKey, exiftoolReader.MetadataReadPrioity.MetadataPrioityDictionary[metadataPriorityKey]); if (metadataPriorityGroup.MetadataPriorityValues.Composite == CompositeTags.NotDefined) { priorityKeyExisit = false; } } int rowIndex = DataGridViewHandler.AddRow(dataGridView, columnIndex, new DataGridViewGenericRow(exiftoolData.Region, exiftoolData.Command, true, metadataPriorityKey), exiftoolData.Parameter, new DataGridViewGenericCellStatus(MetadataBrokerType.Empty, SwitchStates.Disabled, true), true); if (priorityKeyExisit) { DataGridViewHandler.SetRowToolTipText(dataGridView, rowIndex, metadataPriorityGroup.ToString()); } else { DataGridViewHandler.SetRowToolTipText(dataGridView, rowIndex, ""); } } DataGridViewHandler.SetColumnPopulatedFlag(dataGridView, columnIndex, true); } //----------------------------------------------------------------- DataGridViewHandler.SetIsPopulatingFile(dataGridView, false); //----------------------------------------------------------------- }