Beispiel #1
0
        private DateTimePicker CreateDateTimePicker(ControlRow control)
        {
            DateTimePicker dateTimePicker = new DateTimePicker()
            {
                ToolTip     = control.Tooltip,
                Width       = control.Width,
                CultureInfo = System.Globalization.CultureInfo.CreateSpecificCulture("en-US")
            };

            DataEntryHandler.Configure(dateTimePicker, Constant.ControlDefault.DateTimeValue.DateTime);
            dateTimePicker.GotFocus  += this.Control_GotFocus;
            dateTimePicker.LostFocus += this.Control_LostFocus;
            return(dateTimePicker);
        }
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            // Set up a progress handler that will update the progress bar
            this.InitalizeProgressHandler(this.BusyCancelIndicator);

            // Set up the initial UI and values
            // Get the image filename and image and display them
            this.FileName.Content   = this.ImageToCorrect.File;
            this.FileName.ToolTip   = this.ImageToCorrect.File;
            this.SampleImage.Source = this.ImageToCorrect.LoadBitmap(this.fileDatabase.FolderPath, out bool isCorruptOrMissing);

            // Configure datetime picker to the initial date on the images plus callbacks
            this.initialDate          = this.ImageToCorrect.DateTimeIncorporatingOffset;
            this.OriginalDate.Content = DateTimeHandler.ToStringDisplayDateTime(this.initialDate);
            DataEntryHandler.Configure(this.DateTimePicker, this.initialDate.DateTime);
            this.DateTimePicker.ValueChanged += this.DateTimePicker_ValueChanged;
        }
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            // Set up a progress handler that will update the progress bar
            this.InitalizeProgressHandler(this.BusyCancelIndicator);

            // Set up the initial UI and values
            this.latestImageDateTime   = DateTimeOffset.MinValue;
            this.earliestImageDateTime = DateTimeOffset.MaxValue;

            // Search the images for the two images with the earliest and latest data/time date
            ImageRow latestImageRow   = null;
            ImageRow earliestImageRow = null;

            foreach (ImageRow image in this.fileDatabase.FileTable)
            {
                DateTimeOffset currentImageDateTime = image.DateTimeIncorporatingOffset;

                // If the current image's date is later, then it is a candidate latest image
                if (currentImageDateTime >= this.latestImageDateTime)
                {
                    latestImageRow           = image;
                    this.latestImageDateTime = currentImageDateTime;
                }

                // If the current image's date is earlier, then it is a candidate earliest image
                if (currentImageDateTime <= this.earliestImageDateTime)
                {
                    earliestImageRow           = image;
                    this.earliestImageDateTime = currentImageDateTime;
                }
            }

            // At this point, we should have succeeded getting the oldest and newest data/time

            // Configure the earliest date (in datetime picker) and its image
            this.earliestImageName.Content = earliestImageRow.File;
            this.earliestImageDate.Content = DateTimeHandler.ToStringDisplayDateTime(this.earliestImageDateTime);
            this.imageEarliest.Source      = earliestImageRow.LoadBitmap(this.fileDatabase.FolderPath, out bool isCorruptOrMissing);

            // Configure the latest date (in datetime picker) and its image
            this.latestImageName.Content = latestImageRow.File;
            DataEntryHandler.Configure(this.dateTimePickerLatestDateTime, this.latestImageDateTime.DateTime);
            this.dateTimePickerLatestDateTime.ValueChanged += this.DateTimePicker_ValueChanged;
            this.imageLatest.Source = latestImageRow.LoadBitmap(this.fileDatabase.FolderPath, out isCorruptOrMissing);
        }