Esempio n. 1
0
        // When the CopyPreviousValues button is clicked, or when a space is entered while it is focused,
        // copy the data values from the previous control to the current one
        private void CopyPreviousValues_Click()
        {
            if (this.TryCopyPreviousValuesPasteValues() == false)
            {
                return;
            }

            bool isMouseOver = this.CopyPreviousValuesButton.IsMouseOver;

            foreach (KeyValuePair <string, DataEntryControl> pair in this.DataEntryControls.ControlsByDataLabel)
            {
                DataEntryControl control = pair.Value;
                if (control.Copyable)
                {
                    if (isMouseOver)
                    {
                        control.FlashPreviewControlValue();
                    }
                    else
                    {
                        control.FlashContentControl();
                    }
                }
            }
        }
Esempio n. 2
0
        // 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;
                    }
                }
            }
        }