Skip to content

Commit

Permalink
Initial version
Browse files Browse the repository at this point in the history
  • Loading branch information
ThomasArdal committed May 24, 2024
1 parent 6fbfd8b commit 1b702e6
Show file tree
Hide file tree
Showing 24 changed files with 746 additions and 0 deletions.
1 change: 1 addition & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
custom: ['https://elmah.io/', 'https://elmah.io/pricing/']
59 changes: 59 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: build

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

jobs:
build:

runs-on: windows-latest

steps:
- uses: actions/checkout@v4

- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: |
6.0.x
7.0.x
8.0.x
- name: Restore
run: nuget restore Elmah.Io.WinUI.sln

- name: Check for vulnerable packages
run: |
set -e # This will cause the script to exit on the first error
OUTPUT=$(dotnet list package --vulnerable)
echo "$OUTPUT"
if echo "$OUTPUT" | grep -q 'no vulnerable packages'; then
echo "No vulnerable packages found"
else
if echo "$OUTPUT" | grep -q 'vulnerable'; then
echo "Vulnerable packages found"
exit 1
fi
fi
- name: Build
run: msbuild Elmah.Io.WinUI.sln /t:Build /p:Configuration=Release /p:Version=5.1.${{ github.run_number }}-pre

- name: Test
run: dotnet test --no-build --configuration Release --verbosity normal

- name: Pack
run: dotnet pack --configuration Release src/Elmah.Io.WinUI/Elmah.Io.WinUI.csproj /p:Version=5.1.${{ github.run_number }}-pre

- name: Install dotnet-validate
run: dotnet tool install --global dotnet-validate --version 0.0.1-preview.304

- name: Validate
run: dotnet-validate package local src/Elmah.Io.WinUI/bin/Release/Elmah.Io.WinUI.5.1.${{ github.run_number }}-pre.nupkg

- name: Push to nuget.org
run: dotnet nuget push src/Elmah.Io.WinUI/bin/Release/Elmah.Io.WinUI.5.1.${{ github.run_number }}-pre.nupkg --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json
if: ${{ github.event_name == 'push' }}
98 changes: 98 additions & 0 deletions Elmah.Io.WinUI.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.10.34916.146
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{EE52BC71-E006-4D4F-8353-C4A4BBDBF255}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "samples", "samples", "{9A2AC3AB-5D26-4BDE-BD9C-F6E01A8600DE}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{37464AD4-C968-41A3-A19E-BD34AA22F175}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Elmah.Io.WinUI", "src\Elmah.Io.WinUI\Elmah.Io.WinUI.csproj", "{BAA888FB-705A-4A56-BBE8-6664326C73E2}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Elmah.Io.WinUI.Sample", "samples\Elmah.Io.WinUI.Sample\Elmah.Io.WinUI.Sample.csproj", "{E8575D6E-3447-4317-8105-0D97EFFA3945}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Elmah.Io.WinUI.Test", "test\Elmah.Io.WinUI.Test\Elmah.Io.WinUI.Test.csproj", "{AC9D6790-774D-4447-9B55-EF3DBAF9E1AD}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Debug|ARM64 = Debug|ARM64
Debug|x64 = Debug|x64
Debug|x86 = Debug|x86
Release|Any CPU = Release|Any CPU
Release|ARM64 = Release|ARM64
Release|x64 = Release|x64
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{BAA888FB-705A-4A56-BBE8-6664326C73E2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{BAA888FB-705A-4A56-BBE8-6664326C73E2}.Debug|Any CPU.Build.0 = Debug|Any CPU
{BAA888FB-705A-4A56-BBE8-6664326C73E2}.Debug|ARM64.ActiveCfg = Debug|ARM64
{BAA888FB-705A-4A56-BBE8-6664326C73E2}.Debug|ARM64.Build.0 = Debug|ARM64
{BAA888FB-705A-4A56-BBE8-6664326C73E2}.Debug|x64.ActiveCfg = Debug|x64
{BAA888FB-705A-4A56-BBE8-6664326C73E2}.Debug|x64.Build.0 = Debug|x64
{BAA888FB-705A-4A56-BBE8-6664326C73E2}.Debug|x86.ActiveCfg = Debug|Any CPU
{BAA888FB-705A-4A56-BBE8-6664326C73E2}.Debug|x86.Build.0 = Debug|Any CPU
{BAA888FB-705A-4A56-BBE8-6664326C73E2}.Release|Any CPU.ActiveCfg = Release|Any CPU
{BAA888FB-705A-4A56-BBE8-6664326C73E2}.Release|Any CPU.Build.0 = Release|Any CPU
{BAA888FB-705A-4A56-BBE8-6664326C73E2}.Release|ARM64.ActiveCfg = Release|Any CPU
{BAA888FB-705A-4A56-BBE8-6664326C73E2}.Release|ARM64.Build.0 = Release|Any CPU
{BAA888FB-705A-4A56-BBE8-6664326C73E2}.Release|x64.ActiveCfg = Release|Any CPU
{BAA888FB-705A-4A56-BBE8-6664326C73E2}.Release|x64.Build.0 = Release|Any CPU
{BAA888FB-705A-4A56-BBE8-6664326C73E2}.Release|x86.ActiveCfg = Release|Any CPU
{BAA888FB-705A-4A56-BBE8-6664326C73E2}.Release|x86.Build.0 = Release|Any CPU
{E8575D6E-3447-4317-8105-0D97EFFA3945}.Debug|Any CPU.ActiveCfg = Debug|x64
{E8575D6E-3447-4317-8105-0D97EFFA3945}.Debug|Any CPU.Build.0 = Debug|x64
{E8575D6E-3447-4317-8105-0D97EFFA3945}.Debug|Any CPU.Deploy.0 = Debug|x64
{E8575D6E-3447-4317-8105-0D97EFFA3945}.Debug|ARM64.ActiveCfg = Debug|ARM64
{E8575D6E-3447-4317-8105-0D97EFFA3945}.Debug|ARM64.Build.0 = Debug|ARM64
{E8575D6E-3447-4317-8105-0D97EFFA3945}.Debug|ARM64.Deploy.0 = Debug|ARM64
{E8575D6E-3447-4317-8105-0D97EFFA3945}.Debug|x64.ActiveCfg = Debug|x64
{E8575D6E-3447-4317-8105-0D97EFFA3945}.Debug|x64.Build.0 = Debug|x64
{E8575D6E-3447-4317-8105-0D97EFFA3945}.Debug|x64.Deploy.0 = Debug|x64
{E8575D6E-3447-4317-8105-0D97EFFA3945}.Debug|x86.ActiveCfg = Debug|x86
{E8575D6E-3447-4317-8105-0D97EFFA3945}.Debug|x86.Build.0 = Debug|x86
{E8575D6E-3447-4317-8105-0D97EFFA3945}.Debug|x86.Deploy.0 = Debug|x86
{E8575D6E-3447-4317-8105-0D97EFFA3945}.Release|Any CPU.ActiveCfg = Release|x64
{E8575D6E-3447-4317-8105-0D97EFFA3945}.Release|Any CPU.Build.0 = Release|x64
{E8575D6E-3447-4317-8105-0D97EFFA3945}.Release|Any CPU.Deploy.0 = Release|x64
{E8575D6E-3447-4317-8105-0D97EFFA3945}.Release|ARM64.ActiveCfg = Release|ARM64
{E8575D6E-3447-4317-8105-0D97EFFA3945}.Release|ARM64.Build.0 = Release|ARM64
{E8575D6E-3447-4317-8105-0D97EFFA3945}.Release|ARM64.Deploy.0 = Release|ARM64
{E8575D6E-3447-4317-8105-0D97EFFA3945}.Release|x64.ActiveCfg = Release|x64
{E8575D6E-3447-4317-8105-0D97EFFA3945}.Release|x64.Build.0 = Release|x64
{E8575D6E-3447-4317-8105-0D97EFFA3945}.Release|x64.Deploy.0 = Release|x64
{E8575D6E-3447-4317-8105-0D97EFFA3945}.Release|x86.ActiveCfg = Release|x86
{E8575D6E-3447-4317-8105-0D97EFFA3945}.Release|x86.Build.0 = Release|x86
{E8575D6E-3447-4317-8105-0D97EFFA3945}.Release|x86.Deploy.0 = Release|x86
{AC9D6790-774D-4447-9B55-EF3DBAF9E1AD}.Debug|Any CPU.ActiveCfg = Debug|x64
{AC9D6790-774D-4447-9B55-EF3DBAF9E1AD}.Debug|Any CPU.Build.0 = Debug|x64
{AC9D6790-774D-4447-9B55-EF3DBAF9E1AD}.Debug|ARM64.ActiveCfg = Debug|ARM64
{AC9D6790-774D-4447-9B55-EF3DBAF9E1AD}.Debug|ARM64.Build.0 = Debug|ARM64
{AC9D6790-774D-4447-9B55-EF3DBAF9E1AD}.Debug|x64.ActiveCfg = Debug|x64
{AC9D6790-774D-4447-9B55-EF3DBAF9E1AD}.Debug|x64.Build.0 = Debug|x64
{AC9D6790-774D-4447-9B55-EF3DBAF9E1AD}.Debug|x86.ActiveCfg = Debug|x86
{AC9D6790-774D-4447-9B55-EF3DBAF9E1AD}.Debug|x86.Build.0 = Debug|x86
{AC9D6790-774D-4447-9B55-EF3DBAF9E1AD}.Release|Any CPU.ActiveCfg = Release|x64
{AC9D6790-774D-4447-9B55-EF3DBAF9E1AD}.Release|Any CPU.Build.0 = Release|x64
{AC9D6790-774D-4447-9B55-EF3DBAF9E1AD}.Release|ARM64.ActiveCfg = Release|ARM64
{AC9D6790-774D-4447-9B55-EF3DBAF9E1AD}.Release|ARM64.Build.0 = Release|ARM64
{AC9D6790-774D-4447-9B55-EF3DBAF9E1AD}.Release|x64.ActiveCfg = Release|x64
{AC9D6790-774D-4447-9B55-EF3DBAF9E1AD}.Release|x64.Build.0 = Release|x64
{AC9D6790-774D-4447-9B55-EF3DBAF9E1AD}.Release|x86.ActiveCfg = Release|x86
{AC9D6790-774D-4447-9B55-EF3DBAF9E1AD}.Release|x86.Build.0 = Release|x86
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{BAA888FB-705A-4A56-BBE8-6664326C73E2} = {EE52BC71-E006-4D4F-8353-C4A4BBDBF255}
{E8575D6E-3447-4317-8105-0D97EFFA3945} = {9A2AC3AB-5D26-4BDE-BD9C-F6E01A8600DE}
{AC9D6790-774D-4447-9B55-EF3DBAF9E1AD} = {37464AD4-C968-41A3-A19E-BD34AA22F175}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {74377C86-B599-4978-9556-F5332234CCC4}
EndGlobalSection
EndGlobal
16 changes: 16 additions & 0 deletions samples/Elmah.Io.WinUI.Sample/App.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<Application
x:Class="Elmah.Io.WinUI.Sample.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:Elmah.Io.WinUI.Sample">
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<XamlControlsResources xmlns="using:Microsoft.UI.Xaml.Controls" />
<!-- Other merged dictionaries here -->
</ResourceDictionary.MergedDictionaries>
<!-- Other app resources here -->
</ResourceDictionary>
</Application.Resources>
</Application>
52 changes: 52 additions & 0 deletions samples/Elmah.Io.WinUI.Sample/App.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
using Microsoft.UI.Xaml;
using Microsoft.UI.Xaml.Controls;
using Microsoft.UI.Xaml.Controls.Primitives;
using Microsoft.UI.Xaml.Data;
using Microsoft.UI.Xaml.Input;
using Microsoft.UI.Xaml.Media;
using Microsoft.UI.Xaml.Navigation;
using Microsoft.UI.Xaml.Shapes;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices.WindowsRuntime;
using Windows.ApplicationModel;
using Windows.ApplicationModel.Activation;
using Windows.Foundation;
using Windows.Foundation.Collections;

// To learn more about WinUI, the WinUI project structure,
// and more about our project templates, see: http://aka.ms/winui-project-info.

namespace Elmah.Io.WinUI.Sample
{
/// <summary>
/// Provides application-specific behavior to supplement the default Application class.
/// </summary>
public partial class App : Application
{
/// <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().
/// </summary>
public App()
{
ElmahIoWinUI.Init(new ElmahIoWinUIOptions("API_KEY", new Guid("LOG_ID")));

this.InitializeComponent();
}

/// <summary>
/// Invoked when the application is launched.
/// </summary>
/// <param name="args">Details about the launch request and process.</param>
protected override void OnLaunched(Microsoft.UI.Xaml.LaunchActivatedEventArgs args)
{
m_window = new MainWindow();
m_window.Activate();
}

private Window m_window;
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added samples/Elmah.Io.WinUI.Sample/Assets/StoreLogo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
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 samples/Elmah.Io.WinUI.Sample/Elmah.Io.WinUI.Sample.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net8.0-windows10.0.19041.0</TargetFramework>
<TargetPlatformMinVersion>10.0.17763.0</TargetPlatformMinVersion>
<RootNamespace>Elmah.Io.WinUI.Sample</RootNamespace>
<ApplicationManifest>app.manifest</ApplicationManifest>
<Platforms>x86;x64;ARM64</Platforms>
<RuntimeIdentifiers Condition="$([MSBuild]::GetTargetFrameworkVersion('$(TargetFramework)')) &gt;= 8">win-x86;win-x64;win-arm64</RuntimeIdentifiers>
<RuntimeIdentifiers Condition="$([MSBuild]::GetTargetFrameworkVersion('$(TargetFramework)')) &lt; 8">win10-x86;win10-x64;win10-arm64</RuntimeIdentifiers>
<PublishProfile>win-$(Platform).pubxml</PublishProfile>
<UseWinUI>true</UseWinUI>
<EnableMsixTooling>true</EnableMsixTooling>
</PropertyGroup>

<ItemGroup>
<Content Include="Assets\SplashScreen.scale-200.png" />
<Content Include="Assets\LockScreenLogo.scale-200.png" />
<Content Include="Assets\Square150x150Logo.scale-200.png" />
<Content Include="Assets\Square44x44Logo.scale-200.png" />
<Content Include="Assets\Square44x44Logo.targetsize-24_altform-unplated.png" />
<Content Include="Assets\StoreLogo.png" />
<Content Include="Assets\Wide310x150Logo.scale-200.png" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Windows.SDK.BuildTools" Version="10.0.22621.756" />
<PackageReference Include="Microsoft.WindowsAppSDK" Version="1.5.240428000" />
<Manifest Include="$(ApplicationManifest)" />
</ItemGroup>

<!--
Defining the "Msix" ProjectCapability here allows the Single-project MSIX Packaging
Tools extension to be activated for this project even if the Windows App SDK Nuget
package has not yet been restored.
-->
<ItemGroup Condition="'$(DisableMsixProjectCapabilityAddedByProject)'!='true' and '$(EnableMsixTooling)'=='true'">
<ProjectCapability Include="Msix" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\src\Elmah.Io.WinUI\Elmah.Io.WinUI.csproj" />
</ItemGroup>

<!--
Defining the "HasPackageAndPublishMenuAddedByProject" property here allows the Solution
Explorer "Package and Publish" context menu entry to be enabled for this project even if
the Windows App SDK Nuget package has not yet been restored.
-->
<PropertyGroup Condition="'$(DisableHasPackageAndPublishMenuAddedByProject)'!='true' and '$(EnableMsixTooling)'=='true'">
<HasPackageAndPublishMenu>true</HasPackageAndPublishMenu>
</PropertyGroup>
</Project>
14 changes: 14 additions & 0 deletions samples/Elmah.Io.WinUI.Sample/MainWindow.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<Window
x:Class="Elmah.Io.WinUI.Sample.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:Elmah.Io.WinUI.Sample"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d">

<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Center">
<Button x:Name="myButton" Click="myButton_Click">Click Me</Button>
</StackPanel>
</Window>
41 changes: 41 additions & 0 deletions samples/Elmah.Io.WinUI.Sample/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
using Microsoft.UI.Xaml;
using Microsoft.UI.Xaml.Controls;
using Microsoft.UI.Xaml.Controls.Primitives;
using Microsoft.UI.Xaml.Data;
using Microsoft.UI.Xaml.Input;
using Microsoft.UI.Xaml.Media;
using Microsoft.UI.Xaml.Navigation;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices.WindowsRuntime;
using Windows.Foundation;
using Windows.Foundation.Collections;

// To learn more about WinUI, the WinUI project structure,
// and more about our project templates, see: http://aka.ms/winui-project-info.

namespace Elmah.Io.WinUI.Sample
{
/// <summary>
/// An empty window that can be used on its own or navigated to within a Frame.
/// </summary>
public sealed partial class MainWindow : Window
{
public MainWindow()
{
this.InitializeComponent();
}

private void myButton_Click(object sender, RoutedEventArgs e)
{
// Comment out to add a breadcrumb before the error
//ElmahIoWinUI.AddBreadcrumb(new Client.Breadcrumb(DateTimeOffset.Now, "Information", "Click", "User clicking error button"));

myButton.Content = "Clicked";

throw new ApplicationException("Oh no");
}
}
}
51 changes: 51 additions & 0 deletions samples/Elmah.Io.WinUI.Sample/Package.appxmanifest
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
<?xml version="1.0" encoding="utf-8"?>

<Package
xmlns="http://schemas.microsoft.com/appx/manifest/foundation/windows10"
xmlns:mp="http://schemas.microsoft.com/appx/2014/phone/manifest"
xmlns:uap="http://schemas.microsoft.com/appx/manifest/uap/windows10"
xmlns:rescap="http://schemas.microsoft.com/appx/manifest/foundation/windows10/restrictedcapabilities"
IgnorableNamespaces="uap rescap">

<Identity
Name="1c970367-8ffa-4027-86a7-611a76b3696b"
Publisher="CN=thoma"
Version="1.0.0.0" />

<mp:PhoneIdentity PhoneProductId="1c970367-8ffa-4027-86a7-611a76b3696b" PhonePublisherId="00000000-0000-0000-0000-000000000000"/>

<Properties>
<DisplayName>Elmah.Io.WinUI.Sample</DisplayName>
<PublisherDisplayName>thoma</PublisherDisplayName>
<Logo>Assets\StoreLogo.png</Logo>
</Properties>

<Dependencies>
<TargetDeviceFamily Name="Windows.Universal" MinVersion="10.0.17763.0" MaxVersionTested="10.0.19041.0" />
<TargetDeviceFamily Name="Windows.Desktop" MinVersion="10.0.17763.0" MaxVersionTested="10.0.19041.0" />
</Dependencies>

<Resources>
<Resource Language="x-generate"/>
</Resources>

<Applications>
<Application Id="App"
Executable="$targetnametoken$.exe"
EntryPoint="$targetentrypoint$">
<uap:VisualElements
DisplayName="Elmah.Io.WinUI.Sample"
Description="Elmah.Io.WinUI.Sample"
BackgroundColor="transparent"
Square150x150Logo="Assets\Square150x150Logo.png"
Square44x44Logo="Assets\Square44x44Logo.png">
<uap:DefaultTile Wide310x150Logo="Assets\Wide310x150Logo.png" />
<uap:SplashScreen Image="Assets\SplashScreen.png" />
</uap:VisualElements>
</Application>
</Applications>

<Capabilities>
<rescap:Capability Name="runFullTrust" />
</Capabilities>
</Package>
Loading

0 comments on commit 1b702e6

Please sign in to comment.