diff --git a/art/Social.png b/art/Social.png new file mode 100644 index 0000000..5e76b24 Binary files /dev/null and b/art/Social.png differ diff --git a/src/.editorconfig b/src/.editorconfig index 4a22be4..9991ca5 100644 --- a/src/.editorconfig +++ b/src/.editorconfig @@ -1,34 +1,70 @@ [*.cs] -# VSTHRD200: Use "Async" suffix for async methods -dotnet_diagnostic.VSTHRD200.severity = none +######################## +# Dotnet Naming styles # +######################## + +# Define the pascal_case_style +dotnet_naming_style.pascal_case.required_prefix = +dotnet_naming_style.pascal_case.required_suffix = +dotnet_naming_style.pascal_case.word_separator = +dotnet_naming_style.pascal_case.capitalization = pascal_case -[*.cs] -#### Naming styles #### +# Define the underscore_camel_case_style +dotnet_naming_style.underscore_camel_case.capitalization = camel_case +dotnet_naming_style.underscore_camel_case.required_prefix = _ -# Naming rules +######################### +# Symbol specifications # +######################### + +dotnet_naming_symbols.public_or_protected_field.applicable_kinds = field +dotnet_naming_symbols.public_or_protected_field.applicable_accessibilities = public, protected +dotnet_naming_symbols.public_or_protected_field.required_modifiers = + +dotnet_naming_symbols.interface.applicable_kinds = interface +dotnet_naming_symbols.interface.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected +dotnet_naming_symbols.interface.required_modifiers = + +dotnet_naming_symbols.types.applicable_kinds = class, struct, interface, enum +dotnet_naming_symbols.types.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected +dotnet_naming_symbols.types.required_modifiers = + +dotnet_naming_symbols.private_field.applicable_kinds = field +dotnet_naming_symbols.private_field.applicable_accessibilities = private + +################ +# Naming rules # +################ + +# Private fields are camelCase and start with _ +dotnet_naming_rule.private_field_should_use_underscore_camel_case.severity = suggestion +dotnet_naming_rule.private_field_should_use_underscore_camel_case.symbols = private_field +dotnet_naming_rule.private_field_should_use_underscore_camel_case.style = underscore_camel_case dotnet_naming_rule.public_or_protected_field_should_be_pascal_case.severity = suggestion dotnet_naming_rule.public_or_protected_field_should_be_pascal_case.symbols = public_or_protected_field dotnet_naming_rule.public_or_protected_field_should_be_pascal_case.style = pascal_case -# Symbol specifications +dotnet_naming_rule.interface_should_be_begins_with_i.severity = suggestion +dotnet_naming_rule.interface_should_be_begins_with_i.symbols = interface +dotnet_naming_rule.interface_should_be_begins_with_i.style = begins_with_i -dotnet_naming_symbols.public_or_protected_field.applicable_kinds = field -dotnet_naming_symbols.public_or_protected_field.applicable_accessibilities = public, protected -dotnet_naming_symbols.public_or_protected_field.required_modifiers = +dotnet_naming_rule.types_should_be_pascal_case.severity = suggestion +dotnet_naming_rule.types_should_be_pascal_case.symbols = types +dotnet_naming_rule.types_should_be_pascal_case.style = pascal_case -# Naming styles +#################### +# C# Naming styles # +#################### -dotnet_naming_style.pascal_case.required_prefix = -dotnet_naming_style.pascal_case.required_suffix = -dotnet_naming_style.pascal_case.word_separator = -dotnet_naming_style.pascal_case.capitalization = pascal_case csharp_indent_labels = one_less_than_current csharp_space_around_binary_operators = before_and_after csharp_using_directive_placement = outside_namespace:suggestion csharp_prefer_simple_using_statement = true:suggestion csharp_prefer_braces = true:warning +csharp_prefer_simple_default_expression = true:suggestion + csharp_style_namespace_declarations = block_scoped:silent csharp_style_prefer_method_group_conversion = true:silent csharp_style_prefer_top_level_statements = true:silent @@ -43,7 +79,6 @@ csharp_style_expression_bodied_lambdas = true:silent csharp_style_expression_bodied_local_functions = false:silent csharp_style_throw_expression = true:suggestion csharp_style_prefer_null_check_over_type_check = true:suggestion -csharp_prefer_simple_default_expression = true:suggestion csharp_style_prefer_local_over_anonymous_function = true:suggestion csharp_style_prefer_index_operator = true:suggestion csharp_style_prefer_range_operator = true:suggestion @@ -55,53 +90,49 @@ csharp_style_deconstructed_variable_declaration = true:suggestion csharp_style_unused_value_assignment_preference = discard_variable:suggestion csharp_style_unused_value_expression_statement_preference = discard_variable:silent -[*.{cs,vb}] -#### Naming styles #### - -# Naming rules - -dotnet_naming_rule.interface_should_be_begins_with_i.severity = suggestion -dotnet_naming_rule.interface_should_be_begins_with_i.symbols = interface -dotnet_naming_rule.interface_should_be_begins_with_i.style = begins_with_i - -dotnet_naming_rule.types_should_be_pascal_case.severity = suggestion -dotnet_naming_rule.types_should_be_pascal_case.symbols = types -dotnet_naming_rule.types_should_be_pascal_case.style = pascal_case - -dotnet_naming_rule.non_field_members_should_be_pascal_case.severity = suggestion -dotnet_naming_rule.non_field_members_should_be_pascal_case.symbols = non_field_members -dotnet_naming_rule.non_field_members_should_be_pascal_case.style = pascal_case - -# Symbol specifications - -dotnet_naming_symbols.interface.applicable_kinds = interface -dotnet_naming_symbols.interface.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected -dotnet_naming_symbols.interface.required_modifiers = - -dotnet_naming_symbols.types.applicable_kinds = class, struct, interface, enum -dotnet_naming_symbols.types.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected -dotnet_naming_symbols.types.required_modifiers = - -dotnet_naming_symbols.non_field_members.applicable_kinds = property, event, method -dotnet_naming_symbols.non_field_members.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected -dotnet_naming_symbols.non_field_members.required_modifiers = - -# Naming styles +dotnet_style_operator_placement_when_wrapping = beginning_of_line +dotnet_style_coalesce_expression = true:suggestion +dotnet_style_null_propagation = true:suggestion +dotnet_style_prefer_is_null_check_over_reference_equality_method = true:suggestion +dotnet_style_prefer_auto_properties = true:silent +dotnet_style_object_initializer = true:suggestion +dotnet_style_collection_initializer = true:suggestion +dotnet_style_prefer_simplified_boolean_expressions = true:suggestion +dotnet_style_prefer_conditional_expression_over_assignment = true:silent +dotnet_style_prefer_conditional_expression_over_return = true:silent +dotnet_style_explicit_tuple_names = true:suggestion +dotnet_style_prefer_inferred_tuple_names = true:suggestion +dotnet_style_prefer_inferred_anonymous_type_member_names = true:suggestion +dotnet_style_prefer_compound_assignment = true:suggestion +dotnet_style_prefer_simplified_interpolation = true:suggestion +dotnet_style_namespace_match_folder = true:suggestion +dotnet_style_coalesce_expression = true:suggestion +dotnet_style_null_propagation = true:suggestion +dotnet_style_prefer_is_null_check_over_reference_equality_method = true:suggestion +dotnet_style_prefer_auto_properties = true:silent +dotnet_style_object_initializer = true:suggestion +dotnet_style_collection_initializer = true:suggestion +dotnet_style_prefer_simplified_boolean_expressions = true:suggestion +dotnet_style_prefer_conditional_expression_over_assignment = true:silent +dotnet_style_prefer_conditional_expression_over_return = true:silent +dotnet_style_explicit_tuple_names = true:suggestion +dotnet_style_prefer_inferred_tuple_names = true:suggestion +dotnet_style_prefer_inferred_anonymous_type_member_names = true:suggestion +dotnet_style_prefer_compound_assignment = true:suggestion +dotnet_style_prefer_simplified_interpolation = true:suggestion +dotnet_style_namespace_match_folder = true:suggestion -dotnet_naming_style.begins_with_i.required_prefix = I -dotnet_naming_style.begins_with_i.required_suffix = -dotnet_naming_style.begins_with_i.word_separator = -dotnet_naming_style.begins_with_i.capitalization = pascal_case +tab_width = 4 +indent_size = 4 +end_of_line = crlf -dotnet_naming_style.pascal_case.required_prefix = -dotnet_naming_style.pascal_case.required_suffix = -dotnet_naming_style.pascal_case.word_separator = -dotnet_naming_style.pascal_case.capitalization = pascal_case +#################### +# Diagnostic rules # +#################### -dotnet_naming_style.pascal_case.required_prefix = -dotnet_naming_style.pascal_case.required_suffix = -dotnet_naming_style.pascal_case.word_separator = -dotnet_naming_style.pascal_case.capitalization = pascal_case +# VSTHRD200: Use "Async" suffix for async methods +dotnet_diagnostic.VSTHRD200.severity = none +[*.{cs,vb}] dotnet_style_operator_placement_when_wrapping = beginning_of_line tab_width = 4 indent_size = 4 @@ -120,4 +151,4 @@ dotnet_style_prefer_inferred_tuple_names = true:suggestion dotnet_style_prefer_inferred_anonymous_type_member_names = true:suggestion dotnet_style_prefer_compound_assignment = true:suggestion dotnet_style_prefer_simplified_interpolation = true:suggestion -dotnet_style_namespace_match_folder = true:suggestion +dotnet_style_namespace_match_folder = true:suggestion \ No newline at end of file diff --git a/src/NuGetMonitor.csproj b/src/NuGetMonitor.csproj index ac71045..4ccac11 100644 --- a/src/NuGetMonitor.csproj +++ b/src/NuGetMonitor.csproj @@ -69,7 +69,7 @@ - 17.0.503 + 17.0.507 runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/src/Services/InfoBarService.cs b/src/Services/InfoBarService.cs index 9b21c2a..7f4613e 100644 --- a/src/Services/InfoBarService.cs +++ b/src/Services/InfoBarService.cs @@ -11,6 +11,8 @@ namespace NuGetMonitor.Services { public class InfoBarService { + private static InfoBar _infoBar { get; set; } + public static async Task ShowInfoBar(IEnumerable packageReferences) { var outdatedCount = packageReferences.Count(packageRefence => packageRefence.IsOutdated); @@ -29,12 +31,15 @@ public static async Task ShowInfoBar(IEnumerable packageRefere KnownMonikers.NuGet, isCloseButtonVisible: true); - var infoBar = await VS.InfoBar.CreateAsync(ToolWindowGuids80.SolutionExplorer, model); - infoBar.ActionItemClicked += InfoBar_ActionItemClicked; + _infoBar = await VS.InfoBar.CreateAsync(ToolWindowGuids80.SolutionExplorer, model); + _infoBar.ActionItemClicked += InfoBar_ActionItemClicked; - await infoBar.TryShowInfoBarUIAsync(); + await _infoBar.TryShowInfoBarUIAsync(); } + public static void CloseInfoBar() + => _infoBar.Close(); + private static void InfoBar_ActionItemClicked(object sender, InfoBarActionItemEventArgs e) { ThreadHelper.ThrowIfNotOnUIThread(); diff --git a/src/Services/MonitorService.cs b/src/Services/MonitorService.cs index f43b033..295327a 100644 --- a/src/Services/MonitorService.cs +++ b/src/Services/MonitorService.cs @@ -9,12 +9,14 @@ public static class MonitorService public static void RegisterEventHandler() { VS.Events.SolutionEvents.OnAfterOpenSolution += SolutionEvents_OnAfterOpenSolution; + VS.Events.SolutionEvents.OnAfterCloseSolution += SolutionEvents_OnAfterCloseSolution; } + private static void SolutionEvents_OnAfterCloseSolution() + => InfoBarService.CloseInfoBar(); + private static void SolutionEvents_OnAfterOpenSolution(Solution solution) - { - CheckForUpdates().FireAndForget(); - } + => CheckForUpdates().FireAndForget(); public static async Task CheckForUpdates() {