Skip to content

Commit

Permalink
Merge pull request #3702 from RussKie/Add_WindowsForms_TaskDialog_demo
Browse files Browse the repository at this point in the history
Add Windows Forms TaskDialog API sample
  • Loading branch information
adegeo committed Jul 7, 2020
2 parents 5928d2f + c38457d commit d5edbc9
Show file tree
Hide file tree
Showing 9 changed files with 1,164 additions and 0 deletions.
534 changes: 534 additions & 0 deletions windowsforms/TaskDialogDemo/cs/Form1.cs

Large diffs are not rendered by default.

22 changes: 22 additions & 0 deletions windowsforms/TaskDialogDemo/cs/Program.cs
@@ -0,0 +1,22 @@
using System;
using System.Windows.Forms;

namespace TaskDialogDemo
{
static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.SetHighDpiMode(HighDpiMode.SystemAware);
// Note: Calling Application.EnableVisualStyles() is required for the task
// dialog to work.
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Form1());
}
}
}
43 changes: 43 additions & 0 deletions windowsforms/TaskDialogDemo/cs/README.md
@@ -0,0 +1,43 @@
---
languages:
- csharp
products:
- dotnet
- windows
page_type: sample
name: "Windows Forms Sample: Task Dialog (C#)"
urlFragment: "winforms-taskdialog-cs"
description: ".NET 5.0 Windows Forms application that demonstrates how to use Task Dialog"
---

# Task Dialog Demo

This sample is a .NET 5.0 Windows Forms application that demonstrates how to use [`Task Dialog`](https://docs.microsoft.com/en-us/windows/win32/controls/task-dialogs-overview).

![Screenshot](../images/screenshot.jpg)

Credits: this sample was authored by @kpreisser, the author of [`Task Dialog` for Windows Forms](https://github.com/dotnet/winforms/pull/1133).

## Sample prerequisites

This sample is written in C# and targets .NET 5.0 running on Windows. It requires the [.NET 5.0 SDK](https://dotnet.microsoft.com/download/dotnet/5.0).

## Building the sample

To download and run the sample, follow these steps:

01. Download and unzip the sample.

01. In Visual Studio 2019 or later:

01. On the menu bar, choose **File** > **Open** > **Project/Solution**.

01. Navigate to the folder that holds the unzipped sample code, and open the project (*.csproj*) file.

01. Choose the F5 key, or Ctrl+F5 keys, to run the project.

01. From the command line:

01. Navigate to the folder that holds the unzipped sample code.

01. At the command line, type `dotnet run`.
10 changes: 10 additions & 0 deletions windowsforms/TaskDialogDemo/cs/TaskDialogDemo.csproj
@@ -0,0 +1,10 @@
<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net5.0</TargetFramework>
<Nullable>enable</Nullable>
<UseWindowsForms>true</UseWindowsForms>
</PropertyGroup>

</Project>
Binary file added windowsforms/TaskDialogDemo/images/screenshot.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit d5edbc9

Please sign in to comment.