make StyleCop happy

This commit is contained in:
Christopher Willis-Ford 2022-04-04 12:42:23 -07:00
parent c9a8f704ee
commit 6d3b17127d
11 changed files with 121 additions and 57 deletions

View file

@ -11,6 +11,12 @@ trim_trailing_whitespace = true
charset = utf-8-bom
end_of_line = crlf
csharp_using_directive_placement = inside_namespace
dotnet_style_qualification_for_event = true
dotnet_style_qualification_for_field = true
dotnet_style_qualification_for_method = true
dotnet_style_qualification_for_property = true
[*.{html,md}]
indent_style = space

View file

@ -1,7 +1,7 @@
<Application xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:local="clr-namespace:scratch_link"
x:Class="scratch_link.App">
xmlns:local="clr-namespace:ScratchLink"
x:Class="ScratchLink.App">
<Application.Resources>
<ResourceDictionary>

View file

@ -1,11 +1,22 @@
namespace scratch_link;
// <copyright file="App.xaml.cs" company="Scratch Foundation">
// Copyright (c) Scratch Foundation. All rights reserved.
// </copyright>
namespace ScratchLink;
/// <summary>
/// The <see cref="App"/> class contains the cross-platform entry point for the application.
/// </summary>
public partial class App : Application
{
public App()
{
InitializeComponent();
/// <summary>
/// Initializes a new instance of the <see cref="App"/> class.
/// This is the cross-platform entry point.
/// </summary>
public App()
{
this.InitializeComponent();
MainPage = new MainPage();
}
this.MainPage = new MainPage();
}
}

View file

@ -1,6 +1,6 @@
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="scratch_link.MainPage"
x:Class="ScratchLink.MainPage"
BackgroundColor="{DynamicResource SecondaryColor}">
<ScrollView>

View file

@ -1,20 +1,29 @@
namespace scratch_link;
// <copyright file="MainPage.xaml.cs" company="Scratch Foundation">
// Copyright (c) Scratch Foundation. All rights reserved.
// </copyright>
namespace ScratchLink;
/// <summary>
/// This class holds the main UI for the application.
/// </summary>
public partial class MainPage : ContentPage
{
int count = 0;
private int count = 0;
public MainPage()
{
InitializeComponent();
}
/// <summary>
/// Initializes a new instance of the <see cref="MainPage"/> class.
/// </summary>
public MainPage()
{
this.InitializeComponent();
}
private void OnCounterClicked(object sender, EventArgs e)
{
count++;
CounterLabel.Text = $"Current count: {count}";
private void OnCounterClicked(object sender, EventArgs e)
{
this.count++;
this.CounterLabel.Text = $"Current count: {this.count}";
SemanticScreenReader.Announce(CounterLabel.Text);
}
SemanticScreenReader.Announce(this.CounterLabel.Text);
}
}

View file

@ -1,17 +1,28 @@
namespace scratch_link;
// <copyright file="MauiProgram.cs" company="Scratch Foundation">
// Copyright (c) Scratch Foundation. All rights reserved.
// </copyright>
namespace ScratchLink;
/// <summary>
/// This class hosts the cross-platform entry point.
/// </summary>
public static class MauiProgram
{
public static MauiApp CreateMauiApp()
{
var builder = MauiApp.CreateBuilder();
builder
.UseMauiApp<App>()
.ConfigureFonts(fonts =>
{
fonts.AddFont("OpenSans-Regular.ttf", "OpenSansRegular");
});
/// <summary>
/// Build and return a MauiApp instance to host our app.
/// </summary>
/// <returns>A new instance of <see cref="MauiApp"/> configured for our app.</returns>
public static MauiApp CreateMauiApp()
{
var builder = MauiApp.CreateBuilder();
builder
.UseMauiApp<App>()
.ConfigureFonts(fonts =>
{
fonts.AddFont("OpenSans-Regular.ttf", "OpenSansRegular");
});
return builder.Build();
}
return builder.Build();
}
}

View file

@ -1,9 +1,21 @@
using Foundation;
// <copyright file="AppDelegate.cs" company="Scratch Foundation">
// Copyright (c) Scratch Foundation. All rights reserved.
// </copyright>
namespace scratch_link;
namespace ScratchLink;
using Foundation;
/// <summary>
/// The AppDelegate connects UIApplication to MauiApp on MacCatalyst.
/// </summary>
[Register("AppDelegate")]
public class AppDelegate : MauiUIApplicationDelegate
{
protected override MauiApp CreateMauiApp() => MauiProgram.CreateMauiApp();
/// <summary>
/// Build and return a MauiApp instance to host our app on MacCatalyst.
/// MacCatalyst-specific configuration can go here.
/// </summary>
/// <returns>A new instance of <see cref="MauiApp"/> configured for our app.</returns>
protected override MauiApp CreateMauiApp() => MauiProgram.CreateMauiApp();
}

View file

@ -1,15 +1,22 @@
using ObjCRuntime;
// <copyright file="Program.cs" company="Scratch Foundation">
// Copyright (c) Scratch Foundation. All rights reserved.
// </copyright>
namespace ScratchLink;
using ObjCRuntime;
using UIKit;
namespace scratch_link;
/// <summary>
/// This class is the main entry point for MacCatalyst.
/// </summary>
public class Program
{
// This is the main entry point of the application.
static void Main(string[] args)
{
// if you want to use a different Application Delegate class from "AppDelegate"
// you can specify it here.
UIApplication.Main(args, null, typeof(AppDelegate));
}
// This method is the main entry point of the application for MacCatalyst.
private static void Main(string[] args)
{
// if you want to use a different Application Delegate class from "AppDelegate"
// you can specify it here.
UIApplication.Main(args, null, typeof(AppDelegate));
}
}

View file

@ -1,8 +1,8 @@
<maui:MauiWinUIApplication
x:Class="scratch_link.WinUI.App"
x:Class="ScratchLink.WinUI.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:maui="using:Microsoft.Maui"
xmlns:local="using:scratch_link.WinUI">
xmlns:local="using:ScratchLink.WinUI">
</maui:MauiWinUIApplication>

View file

@ -1,9 +1,10 @@
using Microsoft.UI.Xaml;
// <copyright file="App.xaml.cs" company="Scratch Foundation">
// Copyright (c) Scratch Foundation. All rights reserved.
// </copyright>
// To learn more about WinUI, the WinUI project structure,
// and more about our project templates, see: http://aka.ms/winui-project-info.
namespace scratch_link.WinUI;
namespace ScratchLink.WinUI;
/// <summary>
/// Provides application-specific behavior to supplement the default Application class.
@ -11,14 +12,18 @@ namespace scratch_link.WinUI;
public partial class App : MauiWinUIApplication
{
/// <summary>
/// Initializes the singleton application object. This is the first line of authored code
/// executed, and as such is the logical equivalent of main() or WinMain().
/// Initializes a new instance of the <see cref="App"/> class, the singleton application object. This is the
/// line of authored code executed, and as such is the logical equivalent of main() or WinMain().
/// </summary>
public App()
{
this.InitializeComponent();
}
/// <summary>
/// Build and return a MauiApp instance to host our app on Windows.
/// MacCatalyst-specific configuration can go here.
/// </summary>
/// <returns>A new instance of <see cref="MauiApp"/> configured for our app.</returns>
protected override MauiApp CreateMauiApp() => MauiProgram.CreateMauiApp();
}

View file

@ -4,7 +4,7 @@
<TargetFrameworks>net6.0-maccatalyst</TargetFrameworks>
<TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('windows')) and '$(MSBuildRuntimeType)' == 'Full'">$(TargetFrameworks);net6.0-windows10.0.19041</TargetFrameworks>
<OutputType>Exe</OutputType>
<RootNamespace>scratch_link</RootNamespace>
<RootNamespace>ScratchLink</RootNamespace>
<UseMaui>true</UseMaui>
<SingleProject>true</SingleProject>
<ImplicitUsings>enable</ImplicitUsings>
@ -55,12 +55,15 @@
<RuntimeIdentifier>win10-x64</RuntimeIdentifier>
</PropertyGroup>
<ItemGroup>
<ItemGroup Label="StyleCop">
<PackageReference Include="StyleCop.Analyzers" Version="1.1.118">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<AdditionalFiles Include="$(SolutionDir)stylecop.json" />
</ItemGroup>
<PropertyGroup Label="StyleCop">
<GenerateDocumentationFile>true</GenerateDocumentationFile>
</PropertyGroup>
</Project>