Skip to content

Commit

Permalink
First Edition
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisPulman committed Mar 12, 2023
1 parent 92ef1b6 commit 22189df
Show file tree
Hide file tree
Showing 1,243 changed files with 27,605 additions and 0 deletions.
537 changes: 537 additions & 0 deletions .editorconfig

Large diffs are not rendered by default.

12 changes: 12 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Please see the documentation for all configuration options:
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates

version: 2
updates:
- package-ecosystem: "nuget" # See documentation for possible values
directory: "/" # Location of package manifests
schedule:
interval: "monthly"
time: "08:00"
timezone: "Europe/London"
open-pull-requests-limit: 20
80 changes: 80 additions & 0 deletions .github/workflows/BuildOnly.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
name: AppBarButton.WPF CI-BuildOnly

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]

jobs:
build-and-release:

runs-on: windows-2022

steps:
- name: Get Current Visual Studio Information
shell: bash
run: |
dotnet tool update -g dotnet-vs
echo "## About RELEASE ##"
vs where release
- name: Update Visual Studio Latest Release
if: inputs.useVisualStudioPreview == true
shell: bash
run: |
echo "## Update RELEASE ##"
vs update release Enterprise
vs modify release Enterprise +mobile +desktop +uwp +web
echo "## About RELEASE Updated ##"
vs where release
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0 # avoid shallow clone so nbgv can do its work.

- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: |
6.0.x
7.0.x
- name: Add MSBuild to PATH
uses: microsoft/setup-msbuild@v1.1.3
with:
vs-prerelease: true

- name: NBGV
id: nbgv
uses: dotnet/nbgv@master
with:
setAllVars: true
- run: echo 'SemVer2=${{ steps.nbgv.outputs.SemVer2 }}'

- name: NuGet Restore
run: dotnet restore AppBarButton.WPF.sln
working-directory: src

- name: Build
run: msbuild /t:build,pack /nowarn:MSB4011 /maxcpucount /p:NoPackageAnalysis=true /verbosity:minimal /p:Configuration=Release AppBarButton.WPF.sln
working-directory: src

- name: Run Unit Tests and Generate Coverage
uses: glennawatson/coverlet-msbuild@v2.1
with:
project-files: 'src/**/*Tests*.csproj'
no-build: true
include-filter: 'AppBarButton.WPF*'
output-format: cobertura
configuration: Release

- name: Upload Code Coverage
uses: codecov/codecov-action@v3

- name: Create NuGet Artifacts
uses: actions/upload-artifact@master
with:
name: nuget
path: '**/*.nupkg'
78 changes: 78 additions & 0 deletions .github/workflows/dotnet.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
name: AppBarButton.WPF CI-Build Release

on:
push:
branches: [ "main" ]

jobs:
build-and-release:

runs-on: windows-2022
outputs:
nbgv: ${{ steps.nbgv.outputs.SemVer2 }}
steps:
- name: Get Current Visual Studio Information
shell: bash
run: |
dotnet tool update -g dotnet-vs
echo "## About RELEASE ##"
vs where release
- name: Update Visual Studio Latest Release
if: inputs.useVisualStudioPreview == true
shell: bash
run: |
echo "## Update RELEASE ##"
vs update release Enterprise
vs modify release Enterprise +mobile +desktop +uwp +web
echo "## About RELEASE Updated ##"
vs where release
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0 # avoid shallow clone so nbgv can do its work.

- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: |
6.0.x
7.0.x
- name: Add MSBuild to PATH
uses: microsoft/setup-msbuild@v1.1.3
with:
vs-prerelease: true

- name: NBGV
id: nbgv
uses: dotnet/nbgv@master
with:
setAllVars: true
- run: echo 'SemVer2=${{ steps.nbgv.outputs.SemVer2 }}'

- name: NuGet Restore
run: dotnet restore AppBarButton.WPF.sln
working-directory: src

- name: Build
run: msbuild /t:build,pack /nowarn:MSB4011 /maxcpucount /p:NoPackageAnalysis=true /verbosity:minimal /p:Configuration=Release AppBarButton.WPF.sln
working-directory: src

- name: Create NuGet Artifacts
uses: actions/upload-artifact@master
with:
name: nuget
path: '**/*.nupkg'

- name: Changelog
uses: glennawatson/ChangeLog@v1
id: changelog

- name: NuGet Push
env:
NUGET_AUTH_TOKEN: ${{ secrets.NUGET_API_KEY }}
SOURCE_URL: https://api.nuget.org/v3/index.json
run: |
dotnet nuget push -s ${{ env.SOURCE_URL }} -k ${{ env.NUGET_AUTH_TOKEN }} **/*.nupkg --skip-duplicate
75 changes: 75 additions & 0 deletions Directory.Build.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
<Project DefaultTargets="Build"
xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<Authors>Chris Pulman</Authors>
<Description>A WPF AppBarButton library</Description>
<Copyright>Copyright © https://github.com/ChrisPulman $([System.DateTime]::Now.ToString(yyyy))</Copyright>
<IsTestProject>$(MSBuildProjectName.Contains('Tests'))</IsTestProject>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<LangVersion>preview</LangVersion>
<Configuration>$(TargetFramework)</Configuration>
<Company>ChrisPulman</Company>
<NoWarn>CS1591;IDE0190;IDE1006</NoWarn>
<Nullable>enable</Nullable>
<PackageIcon>logo.png</PackageIcon>
<Configurations>Debug;Release;PreRelease</Configurations>
<PackageReleaseNotes>Compatability with Net 6 / 7 and net462</PackageReleaseNotes>
<PackageTags>AppBarButton;WPF;UserControl;net;netstandard</PackageTags>
<EnableNETAnalyzers>True</EnableNETAnalyzers>
<AnalysisLevel>latest</AnalysisLevel>

<PackageProjectUrl>https://github.com/ChrisPulman/AppBarButton.WPF</PackageProjectUrl>
<RepositoryUrl>https://github.com/ChrisPulman/AppBarButton.WPF</RepositoryUrl>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<!--https://devblogs.microsoft.com/dotnet/producing-packages-with-source-link/-->
<PublishRepositoryUrl>true</PublishRepositoryUrl>
<EmbedUntrackedSources>true</EmbedUntrackedSources>
<DebugType>embedded</DebugType>
<IncludeSymbols>true</IncludeSymbols>

<!-- Include PDB in the built .nupkg -->
<AllowedOutputExtensionsInPackageBuildOutputFolder>$(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb</AllowedOutputExtensionsInPackageBuildOutputFolder>
<IncludePackageReferencesDuringMarkupCompilation>true</IncludePackageReferencesDuringMarkupCompilation>
</PropertyGroup>

<PropertyGroup Condition="'$(GITHUB_ACTIONS)' == 'true'">
<ContinuousIntegrationBuild>true</ContinuousIntegrationBuild>
</PropertyGroup>

<ItemGroup Condition="'$(IsTestProject)' != 'true'">
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.1" PrivateAssets="All" />
</ItemGroup>

<ItemGroup>
<None Include="$(MSBuildThisFileDirectory)images\logo.png" Pack="true" PackagePath="\"/>
<None Include="$(MSBuildThisFileDirectory)LICENSE" Pack="true" PackagePath="LICENSE" />
<None Include="$(MSBuildThisFileDirectory)README.md" Pack="true" PackagePath="\"/>
</ItemGroup>

<ItemGroup Condition="'$(IsTestProject)' == 'true'">
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.4.1" />
<PackageReference Include="xunit" Version="2.4.2" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.5">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="Moq" Version="4.18.2" />
<PackageReference Include="coverlet.collector" Version="3.2.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
</ItemGroup>

<PropertyGroup Condition="'$(Configuration)'=='Debug'">
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
</PropertyGroup>

<ItemGroup>
<!--<Compile Update="**\*.cs" DependentUpon="I%(Filename).cs" />-->
<PackageReference Include="Nerdbank.GitVersioning" Version="3.5.119" PrivateAssets="all" />
<PackageReference Include="stylecop.analyzers" Version="1.2.0-beta.435" PrivateAssets="all" />
<PackageReference Include="Roslynator.Analyzers" Version="4.2.0" PrivateAssets="All" />
<AdditionalFiles Include="$(MSBuildThisFileDirectory)stylecop.json" Link="stylecop.json" />
</ItemGroup>
</Project>
Binary file added Images/logo.ico
Binary file not shown.
Binary file added Images/logo.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
52 changes: 52 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,54 @@
# AppBarButton.WPF
AppBarButton for WPF

This is a simple implementation of the AppBarButton for WPF.

## Usage

```xaml
<Window x:Class="AppBarButton.WPF.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:AppBarButton.WPF"
xmlns:appbarbtn="https://github.com/ChrisPulman/AppBarButton.WPF"
Title="MainWindow" Height="350" Width="525">
<Grid>
<appbarbtn:AppBarButton Content="adobe_acrobat" Icon="adobe_acrobat" />
</Grid>
</Window>
```

## Icon

The Icon is a enum that is used to find the icon in the `Assets\AppBar` folder. The icon is a 48x48 Canvas file.

You can add your own icons by setting the IconData property with a suitable path of your choice.

## Themes

The theme is a ResourceDictionary that is merged into the main ResourceDictionary. The default theme is `/AppBarButton.WPF;component/Themes/Generic.xaml`.

Create a new ResourceDictionary and merge it into the main ResourceDictionary based on the following:

```xaml
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">

<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="/AppBarButton.WPF;component/Themes/AppBarButton.xaml" />
</ResourceDictionary.MergedDictionaries>

<!-- default accent colors and brushes -->
<Color x:Key="AccentColor">#1ba1e2</Color>
<SolidColorBrush x:Key="Accent" Color="{DynamicResource AccentColor}" />
<SolidColorBrush x:Key="AppBarButtonBorder" Color="#919191" />
<SolidColorBrush x:Key="AppBarButtonBorderHover" Color="#d1d1d1" />
<SolidColorBrush x:Key="AppBarButtonBorderPressed" Color="#d1d1d1" />
<SolidColorBrush x:Key="AppBarButtonBorderDisabled" Color="#515151" />
<SolidColorBrush x:Key="AppBarButtonIconBackgroundPressed" Color="{DynamicResource AccentColor}" />
<SolidColorBrush x:Key="AppBarButtonIconForegroundPressed" Color="#d1d1d1" />
<SolidColorBrush x:Key="AppBarButtonText" Color="#d1d1d1" />
<SolidColorBrush x:Key="AppBarButtonTextHover" Color="#d1d1d1" />
<SolidColorBrush x:Key="AppBarButtonTextPressed" Color="#d1d1d1" />
<SolidColorBrush x:Key="AppBarButtonTextDisabled" Color="#515151" />
</ResourceDictionary>
```
22 changes: 22 additions & 0 deletions Version.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"$schema": "https://raw.githubusercontent.com/dotnet/Nerdbank.GitVersioning/main/src/NerdBank.GitVersioning/version.schema.json",
"version": "0.1",
"publicReleaseRefSpec": [
"^refs/heads/master$",
"^refs/heads/main$"
],
"nugetPackageVersion": {
"semVer": 2,
"precision": "build"
},
"cloudBuild": {
"setVersionVariables": true,
"buildNumber": {
"enabled": false
}
},
"release": {
"versionIncrement": "build",
"firstUnstableTag": "alpha"
}
}
14 changes: 14 additions & 0 deletions src/AppBarButton.WPF.TestApp/App.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<Application
x:Class="AppBarButton.WPF.TestApp.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:AppBarButton.WPF.TestApp"
StartupUri="MainWindow.xaml">
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="/AppBarButton.WPF;component/Themes/Generic.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>
</Application>
12 changes: 12 additions & 0 deletions src/AppBarButton.WPF.TestApp/App.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
// Copyright (c) Chris Pulman. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

namespace AppBarButton.WPF.TestApp
{
/// <summary>
/// Interaction logic for App.xaml.
/// </summary>
public partial class App
{
}
}
15 changes: 15 additions & 0 deletions src/AppBarButton.WPF.TestApp/AppBarButton.WPF.TestApp.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net7.0-windows</TargetFramework>
<Nullable>enable</Nullable>
<UseWPF>true</UseWPF>
<IsPackable>false</IsPackable>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\AppBarButton.WPF\AppBarButton.WPF.csproj" />
</ItemGroup>

</Project>
6 changes: 6 additions & 0 deletions src/AppBarButton.WPF.TestApp/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
// Copyright (c) Chris Pulman. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

using System.Windows;

[assembly: ThemeInfo(ResourceDictionaryLocation.None, ResourceDictionaryLocation.SourceAssembly)]

0 comments on commit 22189df

Please sign in to comment.