Beispiel #1
0
        private async Task LoadSolutionDifferenceImage(string filePath)
        {
            if (!this.IsControlsEnabled)
            {
                return;
            }

            this.Dispatcher.Invoke(() =>
            {
                this._itemsSource.Clear();

                txtBFilePath.Text = string.Empty;
            });

            if (string.IsNullOrEmpty(filePath))
            {
                return;
            }

            if (!File.Exists(filePath))
            {
                return;
            }

            ToggleControls(null, false, Properties.OutputStrings.LoadingSolutionDifferenceImage);

            try
            {
                this._SolutionDifferenceImage = await SolutionDifferenceImage.LoadAsync(filePath);
            }
            catch (Exception ex)
            {
                DTEHelper.WriteExceptionToOutput(null, ex);

                this._SolutionDifferenceImage = null;
            }

            txtBFilePath.Dispatcher.Invoke(() =>
            {
                if (this._SolutionDifferenceImage != null)
                {
                    txtBFilePath.Text = filePath;
                }
                else
                {
                    txtBFilePath.Text = string.Empty;
                }
            });

            if (this._SolutionDifferenceImage == null)
            {
                ToggleControls(null, true, Properties.OutputStrings.LoadingSolutionDifferenceImageFailed);
                return;
            }

            ToggleControls(null, true, Properties.OutputStrings.LoadingSolutionDifferenceImageCompleted);

            FilteringSolutionDifferenceImageComponents();
        }