// Unhighlight the data controls affected by the Quickpaste entry private void QuickPasteDataControlsUnHighlight(QuickPasteEntry quickPasteEntry) { this.FilePlayer_Stop(); // In case the FilePlayer is going int row = this.DataHandler.ImageCache.CurrentRow; if (!this.DataHandler.FileDatabase.IsFileRowInRange(row)) { return; // This shouldn't happen, but just in case... } foreach (QuickPasteItem item in quickPasteEntry.Items) { // If the item wasn't used, then it wasn't highlit. if (item.Use == false) { continue; } // Find the data entry control that matches the quickPasteItem's DataLael foreach (KeyValuePair <string, DataEntryControl> pair in this.DataEntryControls.ControlsByDataLabel) { DataEntryControl control = pair.Value; if (control.DataLabel == item.DataLabel) { control.Container.ClearValue(Control.BackgroundProperty); control.HidePreviewControlValue(); break; } } } }
// Highlight the data controls affected by the Quickpaste entry private void QuickPasteDataControlsHighlight(QuickPasteEntry quickPasteEntry) { this.FilePlayer_Stop(); // In case the FilePlayer is going int row = this.DataHandler.ImageCache.CurrentRow; if (!this.DataHandler.FileDatabase.IsFileRowInRange(row)) { return; // This shouldn't happen, but just in case... } foreach (QuickPasteItem item in quickPasteEntry.Items) { if (item.Use == false) { continue; } // Find the data entry control that matches the quickPasteItem's DataLael foreach (KeyValuePair <string, DataEntryControl> pair in this.DataEntryControls.ControlsByDataLabel) { DataEntryControl control = pair.Value; if (control.DataLabel == item.DataLabel) { control.ShowPreviewControlValue(item.Value); } } } }
// Open the quickPaste Editor window private void QuickPasteEntryEdit(QuickPasteEntry quickPasteEntry) { if (quickPasteEntry == null) { return; } // Make sure the quickPasteWindow is not topmost, as it may otherwise occlude part of the QuickPaste Editor if (this.quickPasteWindow.IsLoaded) { this.quickPasteWindow.Topmost = false; } QuickPasteEditor quickPasteEditor = new QuickPasteEditor(quickPasteEntry, this.DataHandler.FileDatabase, this.DataEntryControls) { Owner = this }; if (quickPasteEditor.ShowDialog() == true) { this.QuickPasteRefreshWindowAndXML(); } // Restore the quickPaste window back to its topmost state if (this.quickPasteWindow.IsLoaded) { this.quickPasteWindow.Topmost = true; } }
// Quickpast the given entry into the data control private void QuickPasteEntryPasteIntoDataControls(QuickPasteEntry quickPasteEntry, FlashEnum flash) { this.FilePlayer_Stop(); // In case the FilePlayer is going int row = this.DataHandler.ImageCache.CurrentRow; if (!this.DataHandler.FileDatabase.IsFileRowInRange(row)) { return; // This shouldn't happen, but just in case... } foreach (QuickPasteItem item in quickPasteEntry.Items) { if (item.Use == false) { continue; } // Find the data entry control that matches the quickPasteItem's DataLabel foreach (KeyValuePair <string, DataEntryControl> pair in this.DataEntryControls.ControlsByDataLabel) { DataEntryControl control = pair.Value; if (control.DataLabel == item.DataLabel) { // Changing a counter value does not trigger a ValueChanged event if the values are the same. // which means multiple images may not be updated even if other images have the same value. // To get around this, we set a bogus value and then the real value, which means that the // ValueChanged event will be triggered. Inefficient, but seems to work. if (this.IsDisplayingMultipleImagesInOverview() && control is DataEntryCounter counter) { counter.SetBogusCounterContentAndTooltip(); } control.SetContentAndTooltip(item.Value); if (flash == FlashEnum.FlashPreview) { control.FlashPreviewControlValue(); } else { control.FlashContentControl(); } break; } } } }
// Create a quickpaste entry from the current data controls, // add it to the quickpaste entries, and update the display and the ImageSetTable database as needed private void QuickPasteEntryNew() { string title = "QuickPaste #" + (this.quickPasteEntries.Count + 1).ToString(); QuickPasteEntry quickPasteEntry = QuickPasteOperations.TryGetQuickPasteItemFromDataFields(this.DataHandler.FileDatabase, this.DataHandler.ImageCache.CurrentRow, title); if (quickPasteEntry == null) { return; } // Make sure the quickPasteWindow is not topmost, as it may otherwise occlude part of the QuickPaste Editor if (this.quickPasteWindow.IsLoaded) { this.quickPasteWindow.Topmost = false; } QuickPasteEditor quickPasteEditor = new QuickPasteEditor(quickPasteEntry, this.DataHandler.FileDatabase, this.DataEntryControls) { Owner = this }; if (quickPasteEditor.ShowDialog() == true) { quickPasteEntry = quickPasteEditor.QuickPasteEntry; if (this.quickPasteEntries == null) { // This shouldn't be necessary, but just in case... this.quickPasteEntries = new List <QuickPasteEntry>(); } this.quickPasteEntries.Add(quickPasteEntry); this.QuickPasteRefreshWindowAndXML(); } // Restore the quickPaste window back to its topmost state if (this.quickPasteWindow.IsLoaded) { this.quickPasteWindow.Topmost = true; } }
// Delete the quickPaste Entry from the quickPasteEntries private void QuickPasteEntryDelete(QuickPasteEntry quickPasteEntry) { this.quickPasteEntries = QuickPasteOperations.DeleteQuickPasteEntry(this.quickPasteEntries, quickPasteEntry); this.QuickPasteRefreshWindowAndXML(); }