From b7a6b871cfb4827859d15affaa0136f3c07a84c4 Mon Sep 17 00:00:00 2001 From: Andrii Kurdiumov Date: Wed, 8 Dec 2021 20:19:42 +0600 Subject: [PATCH 1/3] Do not use obsolete constructor Closes #153 --- .../DrawTextToControlBackground/CSHARP/Window1.xaml.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dotnet-desktop-guide/samples/snippets/csharp/VS_Snippets_Wpf/DrawTextToControlBackground/CSHARP/Window1.xaml.cs b/dotnet-desktop-guide/samples/snippets/csharp/VS_Snippets_Wpf/DrawTextToControlBackground/CSHARP/Window1.xaml.cs index 70a6158b2c..01f76eec17 100644 --- a/dotnet-desktop-guide/samples/snippets/csharp/VS_Snippets_Wpf/DrawTextToControlBackground/CSHARP/Window1.xaml.cs +++ b/dotnet-desktop-guide/samples/snippets/csharp/VS_Snippets_Wpf/DrawTextToControlBackground/CSHARP/Window1.xaml.cs @@ -42,7 +42,7 @@ private Drawing DrawMyText(string textString) new Typeface("Comic Sans MS Bold"), 48, System.Windows.Media.Brushes.Black // This brush does not matter since we use the geometry of the text. - ); + VisualTreeHelper.GetDpi(this).PixelsPerDip); // Build the geometry object that represents the text. Geometry textGeometry = formattedText.BuildGeometry(new System.Windows.Point(20, 0)); @@ -66,4 +66,4 @@ private void OnButtonClick(object sender, EventArgs e) myCanvas.Background = new DrawingBrush(DrawMyText(myTextBox.Text)); } } -} \ No newline at end of file +} From 8695f7d20278d9addd7a54a7d0b0b381b84e0bfe Mon Sep 17 00:00:00 2001 From: Andrii Kurdiumov Date: Wed, 8 Dec 2021 21:21:28 +0600 Subject: [PATCH 2/3] Fix compilation --- .../DrawTextToControlBackground/CSHARP/Window1.xaml.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dotnet-desktop-guide/samples/snippets/csharp/VS_Snippets_Wpf/DrawTextToControlBackground/CSHARP/Window1.xaml.cs b/dotnet-desktop-guide/samples/snippets/csharp/VS_Snippets_Wpf/DrawTextToControlBackground/CSHARP/Window1.xaml.cs index 01f76eec17..42c6c75ede 100644 --- a/dotnet-desktop-guide/samples/snippets/csharp/VS_Snippets_Wpf/DrawTextToControlBackground/CSHARP/Window1.xaml.cs +++ b/dotnet-desktop-guide/samples/snippets/csharp/VS_Snippets_Wpf/DrawTextToControlBackground/CSHARP/Window1.xaml.cs @@ -41,7 +41,7 @@ private Drawing DrawMyText(string textString) FlowDirection.LeftToRight, new Typeface("Comic Sans MS Bold"), 48, - System.Windows.Media.Brushes.Black // This brush does not matter since we use the geometry of the text. + System.Windows.Media.Brushes.Black, // This brush does not matter since we use the geometry of the text. VisualTreeHelper.GetDpi(this).PixelsPerDip); // Build the geometry object that represents the text. From b783a8430514138dda70897e7992dfab50b66b3a Mon Sep 17 00:00:00 2001 From: Andrii Kurdiumov Date: Wed, 8 Dec 2021 22:16:17 +0600 Subject: [PATCH 3/3] Attempt to try dirty fix for build errors --- .github/workflows/dependencies/Get-MSBuildResults.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/dependencies/Get-MSBuildResults.ps1 b/.github/workflows/dependencies/Get-MSBuildResults.ps1 index 6a96c7f6f2..85711e060a 100644 --- a/.github/workflows/dependencies/Get-MSBuildResults.ps1 +++ b/.github/workflows/dependencies/Get-MSBuildResults.ps1 @@ -135,7 +135,7 @@ foreach ($item in $workingSet) { $configFile = [System.IO.Path]::Combine([System.IO.Path]::GetDirectoryName($projectFile), "snippets.5000.json") # Create the default build command - "dotnet build `"$projectFile`"" | Out-File ".\run.bat" + "dotnet build `"$projectFile`" /p:UseWPF=True" | Out-File ".\run.bat" # Check for config file if ([System.IO.File]::Exists($configFile) -eq $true) {