Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 8 additions & 10 deletions .github/workflows/live-protection.yml
Original file line number Diff line number Diff line change
@@ -1,27 +1,25 @@
name: Base branch checker
on: [pull_request]

permissions:
contents: read

jobs:
comment:
live_protection_job:
name: Check base branch
runs-on: ubuntu-latest

steps:
- name: Harden Runner
uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1
uses: step-security/harden-runner@cb605e52c26070c328afc4562f0b4ada7618a84e # v2.10.4
with:
egress-policy: audit

- uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea
env:
SHOULD_COMMENT: ${{ github.base_ref == 'refs/heads/live' && !(github.head_ref == 'refs/heads/main') }}
LIVE_BASE: ${{ github.base_ref == 'live' && github.head_ref != 'main' }}
with:
script: |
if (process.env.SHOULD_COMMENT == 'true') {
github.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: 'It looks like this pull request may have been opened on the `live` branch by mistake. In general, PRs should target the `main` branch.'
})
if (process.env.LIVE_BASE == 'true') {
core.setFailed('PR targets live branch')
}
1 change: 0 additions & 1 deletion snippets/csharp/System.Windows/Rect/Overview/MyApp.xaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

<Application xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:my="clr-namespace:SDKSample"
Expand Down
16 changes: 10 additions & 6 deletions snippets/csharp/System.Windows/Rect/Overview/MyApp.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
using System;
using System.Windows;
using System.Windows.Navigation;
using System.Windows.Controls;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.IO;

namespace SDKSample
{
public partial class MyApp : Application
{
[STAThread]
public static void Main()
{
MyApp app = new MyApp();
app.InitializeComponent();
app.Run();
}

public MyApp()
{
Expand All @@ -30,9 +33,10 @@ private void CurrentDomain_UnhandledException(object sender, UnhandledExceptionE
StreamWriter wr = new StreamWriter("error.txt");
wr.Write(args.ExceptionObject.ToString());
wr.Close();
}catch( Exception e)
}
catch(Exception)
{
throw e;
throw;
}
MessageBox.Show("Unhandled exception: " + args.ExceptionObject.ToString());
}
Expand Down
2 changes: 0 additions & 2 deletions snippets/csharp/System.Windows/Rect/Overview/MyApp1.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,4 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
x:Class="Microsoft.Samples.RectExamples.MyApp"
Startup="myAppStartup">


</Application>
11 changes: 3 additions & 8 deletions snippets/csharp/System.Windows/Rect/Overview/MyApp1.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
using System;
using SDKSample;
using System;
using System.Windows;
using System.Data;
using System.Xml;
using System.Configuration;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Navigation;

namespace Microsoft.Samples.RectExamples
{
Expand Down Expand Up @@ -33,4 +28,4 @@ private void CurrentDomain_UnhandledException(object sender, UnhandledExceptionE
MessageBox.Show("Unhandled exception: " + args.ExceptionObject.ToString());
}
}
}
}
3 changes: 1 addition & 2 deletions snippets/csharp/System.Windows/Rect/Overview/RectExample.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
// <SnippetRectExampleWholePage>
using System;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Media;
Expand All @@ -23,7 +22,7 @@ public RectExample()
// 150 wide. The left side of the rectangle is 10 pixels from the left of the
// Canvas and the top side of the rectangle is 100 pixels from the top of the Canvas.
// Note: You could alternatively use the Rect Constructor to create this:
// Rect my Rect1 = new Rect(10,100,150,100");
// Rect myRect1 = new Rect(10, 100, 150, 100);
Rect myRect1 = new Rect();
myRect1.X = 10;
myRect1.Y = 100;
Expand Down
4 changes: 0 additions & 4 deletions snippets/csharp/System.Windows/Rect/Overview/RectExample1.cs
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
using System;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.Windows.Data;
using System.Windows.Media;
using System.Windows.Media.Animation;

namespace Microsoft.Samples.RectExamples
{
Expand Down
4 changes: 2 additions & 2 deletions snippets/csharp/System.Windows/Rect/Overview/Snippets.csproj
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFrameworks>net6.0-windows</TargetFrameworks>
<OutputType>WinExe</OutputType>
<TargetFramework>net6.0-windows</TargetFramework>
<UseWPF>true</UseWPF>
</PropertyGroup>

Expand Down