private void TargetPlatformAndResultFormatPropertyChanged()

in src/ApiPort/ApiPort.VisualStudio.Common/ViewModels/OptionsViewModel.cs [285:310]


        private void TargetPlatformAndResultFormatPropertyChanged(object sender, PropertyChangedEventArgs e)
        {
            switch (e.PropertyName)
            {
                // PropertyName is "" or null when the entire object has been updated
                case null:
                case "":
                case nameof(TargetPlatformVersion.IsSelected):
                case nameof(Targets):
                case nameof(Formats):
                    var containsExcel = Formats.Any(x => x.IsSelected && string.Equals(x.MimeType, ExcelMimeType, StringComparison.OrdinalIgnoreCase));

                    if (_currentVersions.Count(x => x.IsSelected) > ApiPortClient.MaxNumberOfTargets && containsExcel)
                    {
                        HasError = true;
                        ErrorMessage = string.Format(CultureInfo.CurrentCulture, LocalizedStrings.TooManyTargetsMessage, ApiPortClient.MaxNumberOfTargets);
                    }
                    else
                    {
                        HasError = false;
                        ErrorMessage = string.Empty;
                    }

                    break;
            }
        }