//When we are done loading images, add callbacks, prepare the UI, set up the image set, and show the image.
        private void LoadComplete(bool isLoadInitializedFromImages)
        {
            // Make sure that all the string data in the datatable has white space trimmed from its beginning and end
            // This is needed as the custom filter doesn't work well in testing comparisons if there is leading or trailing white space in it
            // Newer versions of TImelapse will trim the data as it is entered, but older versions did not, so this is to make it backwards-compatable.
            // The WhiteSpaceExists column in the ImageSetTable did not exist before this version, so we add it to the table. If it exists, then
            // we know the data has been trimmed and we don't have to do it again as the newer versions take care of trimmingon the fly.
            if (! this.dbData.DoesWhiteSpaceColumnExist () )
            {
                dbData.CreateWhiteSpaceColumn();
                dbData.DataTableTrimDataWhiteSpace();  //  Trim the white space from all the data
                dbData.State_WhiteSpaceTrimmed = true;
            }

            // Create a Custom Filter, which will hold the current custom filter expression (if any) that may be set in the DlgCustomViewFilter
            // TODO: HAVE THIS STORED IN THE IMAGESET DATABASE
            customfilter = new CustomFilter(dbData);

            // Load the Marker table from the database
            this.dbData.InitializeMarkerTableFromDataTable();

            // Set the magnifying glass status from the registry.
            // Note that if it wasn't in the registry, the value returned will be true by default
            this.markableCanvas.IsMagnifyingGlassVisible = this.dbData.State_Magnifyer;

            // Add callbacks to all our controls
            MyAddControlsCallback();

            // Now that we have something to show, enable menus and menu items as needed
            // Note that we do not enable those menu items that would have no effect
            this.MenuItemLoadImages.IsEnabled = false;
            this.MenuItemExportThisImage.IsEnabled = true;
            this.MenuItemExportAsCSVAndPreview.IsEnabled = true;
            this.MenuItemExportAsCSV.IsEnabled = true;
            this.MenuItemRenameDataFile.IsEnabled = true;
            this.MenuItemEdit.IsEnabled = true;
            this.MenuItemDeleteImage.IsEnabled = true;
            this.MenuItemView.IsEnabled = true;
            this.MenuItemFilter.IsEnabled = true;
            this.MenuItemOptions.IsEnabled = true;

            this.MenuItemMagnifier.IsChecked = this.markableCanvas.IsMagnifyingGlassVisible;

            // Also adjust the visibility of the various other UI components.
            this.helpControl.Visibility = System.Windows.Visibility.Collapsed;
            this.DockPanelNavigator.Visibility = System.Windows.Visibility.Visible;
            this.controlsTray.Visibility = System.Windows.Visibility.Visible;
            this.btnCopy.Visibility = System.Windows.Visibility.Visible;

            // Set the image set filter to all images. This should also set the correct count, etc.
            StatusBarUpdate.View(this.statusBar, "all images.");

            // We will be showing the unaltered image, so set that flag as well.
            whichImageState = (int)whichImage.Unaltered;

            //Show the image, Hide the load button, and make the feedback panels visible
            this.sldrImageNavigatorEnableCallback(false);
            this.dbData.ToDataRowFirst();

            this.markableCanvas.Focus(); // We start with this having the focus so it can interpret keyboard shortcuts if needed.

            // Finally, set the current filter and the image index to the same as the ones in the last session,
            // providing that we are working with the same image folder.
            // Doing so also displays the image
            if (this.ImageFolderReopened)
                SetImageFilterAndIndex(this.dbData.State_Row, this.dbData.State_Filter);
            else
                // Default to showing first  image of all images
                SetImageFilterAndIndex(0, (int)Constants.ImageQualityFilters.All);

            if (FileBackup.CreateBackups(this.FolderPath, this.dbData.Filename))
                StatusBarUpdate.Message(this.statusBar, "Backups of files made.");
            else
                StatusBarUpdate.Message(this.statusBar, "No file backups were made.");

            // Finally, tell the user how many images were loaded, etc.
            if (isLoadInitializedFromImages) MenuItemImageCounts_Click(null, null);
        }
 public DlgCustomViewFilter(DBData db_data, CustomFilter custom_filter)
 {
     this.dbData = db_data;
     this.customFilter = custom_filter;
     InitializeComponent();
 }