private void FillFiles(string[] filePaths, string folderName) { this.label1.Text = folderName; var counter = 1; for (int i = 0; i < _bindingSource.Count; i++) { if (((Row)_bindingSource[i]).Path == null) { _bindingSource.RemoveAt(i); } } foreach (var filePath in filePaths) { ProcessingLabel.Text = counter + " sur " + filePaths.Length; ProcessingLabel.Refresh(); var date = Metadata.GetDate(filePath); var newDate = Metadata.ExtractNewDate(filePath); _bindingSource.Add(new Row { Path = filePath, CurrentDate = date, ExpectedDate = newDate }); counter++; } this.dataGridView.DataSource = _bindingSource; this.status.Text = "Ready"; this.status.ForeColor = Color.Black; }
private void FillFiles(string[] filePaths, string folderName) { this.label1.Text = folderName; var counter = 1; foreach (var filePath in filePaths) { ProcessingLabel.Text = counter + " sur " + filePaths.Count(); ProcessingLabel.Refresh(); string fileName = filePath; string prefix = folderName.Split('-').First() + "-"; string file = fileName.Split('\\').Last(); string path = fileName.Replace(file, ""); string extension = "." + file.Split('.').Last(); string zeroToAdd = ""; if (filePaths.Count() > 100) { if (counter < 10) { zeroToAdd = "00"; } else if (counter < 100) { zeroToAdd = "0"; } else { zeroToAdd = ""; } } else if (filePaths.Count() >= 10) { zeroToAdd = counter < 10 ? "0" : ""; } else if (filePaths.Count() < 11) { zeroToAdd = "0"; } file = prefix + zeroToAdd + counter; this.dataGridView.Rows.Add(fileName, path + file + extension); counter++; } }
private void ChangeDateTimeButtonClick(object sender, EventArgs e) { this.status.Text = "Ongoing"; this.status.ForeColor = Color.Gray; var counter = 1; foreach (var g in from DataGridViewRow g in this.dataGridView.Rows where g.Cells[0].Value != null && g.Cells[1].Value != null select g) { ProcessingLabel.Text = counter + " sur " + (this.dataGridView.RowCount - 1); ProcessingLabel.Refresh(); Metadata.ChangeDateTime((string)g.Cells[0].Value, (DateTime)g.Cells[2].Value); counter++; } this.status.Text = "DONE"; this.status.ForeColor = Color.ForestGreen; this.ReloadDates(); }
private void RenameButtonClick(object sender, EventArgs e) { // First use basic file names to avoid conflicts var count = 0; foreach (var g in from DataGridViewRow g in this.dataGridView.Rows where g.Cells[0].Value != null && g.Cells[1].Value != null select g) { var fileName = (string)g.Cells[0].Value; File.Move(fileName, fileName + "__" + count); count++; } // Then update to the final name count = 0; foreach (var g in from DataGridViewRow g in this.dataGridView.Rows where g.Cells[0].Value != null && g.Cells[1].Value != null select g) { ProcessingLabel.Text = count + 1 + " sur " + (this.dataGridView.Rows.Count - 1); ProcessingLabel.Refresh(); File.Move((string)g.Cells[0].Value + "__" + count, (string)g.Cells[1].Value); count++; } }
void ReleaseDesignerOutlets() { if (AcqTaxField != null) { AcqTaxField.Dispose(); AcqTaxField = null; } if (AcqTaxLabel != null) { AcqTaxLabel.Dispose(); AcqTaxLabel = null; } if (AddressComboBox != null) { AddressComboBox.Dispose(); AddressComboBox = null; } if (BorrowerComboBox != null) { BorrowerComboBox.Dispose(); BorrowerComboBox = null; } if (BorrowerLabel != null) { BorrowerLabel.Dispose(); BorrowerLabel = null; } if (ClosingDateLabel != null) { ClosingDateLabel.Dispose(); ClosingDateLabel = null; } if (ClosingDatePicker != null) { ClosingDatePicker.Dispose(); ClosingDatePicker = null; } if (ConcessionField != null) { ConcessionField.Dispose(); ConcessionField = null; } if (ConcessionLabel != null) { ConcessionLabel.Dispose(); ConcessionLabel = null; } if (HOIField != null) { HOIField.Dispose(); HOIField = null; } if (HOILabel != null) { HOILabel.Dispose(); HOILabel = null; } if (InitialDrawField != null) { InitialDrawField.Dispose(); InitialDrawField = null; } if (InitialDrawLabel != null) { InitialDrawLabel.Dispose(); InitialDrawLabel = null; } if (LenderComboBox != null) { LenderComboBox.Dispose(); LenderComboBox = null; } if (LenderLabel != null) { LenderLabel.Dispose(); LenderLabel = null; } if (PriceField != null) { PriceField.Dispose(); PriceField = null; } if (PriceLabel != null) { PriceLabel.Dispose(); PriceLabel = null; } if (ProcessingField != null) { ProcessingField.Dispose(); ProcessingField = null; } if (ProcessingLabel != null) { ProcessingLabel.Dispose(); ProcessingLabel = null; } if (PropertyTaxField != null) { PropertyTaxField.Dispose(); PropertyTaxField = null; } if (PropertyTaxLabel != null) { PropertyTaxLabel.Dispose(); PropertyTaxLabel = null; } if (RecordingField != null) { RecordingField.Dispose(); RecordingField = null; } if (RecordingLabel != null) { RecordingLabel.Dispose(); RecordingLabel = null; } if (SummaryMessageField != null) { SummaryMessageField.Dispose(); SummaryMessageField = null; } if (TitlePolicyField != null) { TitlePolicyField.Dispose(); TitlePolicyField = null; } if (TitlePolicyLabel != null) { TitlePolicyLabel.Dispose(); TitlePolicyLabel = null; } if (TotalCostLabel != null) { TotalCostLabel.Dispose(); TotalCostLabel = null; } if (UpdateAcquisitionButton != null) { UpdateAcquisitionButton.Dispose(); UpdateAcquisitionButton = null; } if (PointsLabel != null) { PointsLabel.Dispose(); PointsLabel = null; } if (UpdatedPointsLabel != null) { UpdatedPointsLabel.Dispose(); UpdatedPointsLabel = null; } }