Add NativeFileDialogs.Net examples

They look much easier to deal with, don't they?
This commit is contained in:
Speykious committed 2022-03-27 19:40:16 +02:00
1 parent 732fcb176e
commit cd5c3d37dc
9 files changed
+191

No files matched your search

@@ -0,0 +1,18 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup Label="Project">
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>disable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup Label="Project References">
<ProjectReference Include="..\..\..\NativeFileDialogs.Net\NativeFileDialogs.Net.csproj" />
</ItemGroup>
<ItemGroup Label="Package References">
<PackageReference Include="NativeFileDialogs.Net.Runtime" Version="0.1.0-alpha" />
</ItemGroup>
</Project>
@@ -0,0 +1,23 @@
// Copyright (c) Speykious
// This file is part of NativeFileDialogs.NET.
// NativeFileDialogs.NET is licensed under the Zlib License. See LICENSE for details.
using System;
using System.Collections.Generic;
using NativeFileDialogs.Net;
NfdStatus result = Nfd.OpenDialog(out string? outPath, new Dictionary<string, string>()
{
{ "Source code", "c,cpp,cc" },
{ "Headers", "h,hpp" },
});
if (result == NfdStatus.Ok && outPath is string path)
{
Console.WriteLine("Success!");
Console.WriteLine(path);
}
else
{
Console.WriteLine("User pressed Cancel.");
}
@@ -0,0 +1,18 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup Label="Project">
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>disable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup Label="Project References">
<ProjectReference Include="..\..\..\NativeFileDialogs.Net\NativeFileDialogs.Net.csproj" />
</ItemGroup>
<ItemGroup Label="Package References">
<PackageReference Include="NativeFileDialogs.Net.Runtime" Version="0.1.0-alpha" />
</ItemGroup>
</Project>
@@ -0,0 +1,24 @@
// Copyright (c) Speykious
// This file is part of NativeFileDialogs.NET.
// NativeFileDialogs.NET is licensed under the Zlib License. See LICENSE for details.
using System;
using System.Collections.Generic;
using NativeFileDialogs.Net;
NfdStatus result = Nfd.OpenDialogMultiple(out string[]? outPaths, new Dictionary<string, string>()
{
{ "Source code", "c,cpp,cc" },
{ "Headers", "h,hpp" },
});
if (result == NfdStatus.Ok && outPaths is string[] paths)
{
Console.WriteLine("Success!");
foreach (string path in paths)
Console.WriteLine($"- {path}");
}
else
{
Console.WriteLine("User pressed Cancel.");
}
@@ -0,0 +1,18 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup Label="Project">
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>disable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup Label="Project References">
<ProjectReference Include="..\..\..\NativeFileDialogs.Net\NativeFileDialogs.Net.csproj" />
</ItemGroup>
<ItemGroup Label="Package References">
<PackageReference Include="NativeFileDialogs.Net.Runtime" Version="0.1.0-alpha" />
</ItemGroup>
</Project>
@@ -0,0 +1,18 @@
// Copyright (c) Speykious
// This file is part of NativeFileDialogs.NET.
// NativeFileDialogs.NET is licensed under the Zlib License. See LICENSE for details.
using System;
using NativeFileDialogs.Net;
NfdStatus result = Nfd.PickFolder(out string? outPath);
if (result == NfdStatus.Ok)
{
Console.WriteLine("Success!");
Console.WriteLine(outPath);
}
else
{
Console.WriteLine("User pressed Cancel.");
}
@@ -0,0 +1,18 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup Label="Project">
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>disable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup Label="Project References">
<ProjectReference Include="..\..\..\NativeFileDialogs.Net\NativeFileDialogs.Net.csproj" />
</ItemGroup>
<ItemGroup Label="Package References">
<PackageReference Include="NativeFileDialogs.Net.Runtime" Version="0.1.0-alpha" />
</ItemGroup>
</Project>
@@ -0,0 +1,23 @@
// Copyright (c) Speykious
// This file is part of NativeFileDialogs.NET.
// NativeFileDialogs.NET is licensed under the Zlib License. See LICENSE for details.
using System;
using System.Collections.Generic;
using NativeFileDialogs.Net;
NfdStatus result = Nfd.SaveDialog(out string? savePath, new Dictionary<string, string>()
{
{ "Source code", "c,cpp,cc" },
{ "Headers", "h,hpp" },
}, defaultName: "Untitled.c");
if (result == NfdStatus.Ok)
{
Console.WriteLine("Success!");
Console.WriteLine(savePath);
}
else
{
Console.WriteLine("User pressed Cancel.");
}
+31
View File
@@ -23,6 +23,16 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NativeFileDialogs.AutoGen.E
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NativeFileDialogs.AutoGen.Example.SaveDialog", "Examples\AutoGen\NativeFileDialogs.AutoGen.Example.SaveDialog\NativeFileDialogs.AutoGen.Example.SaveDialog.csproj", "{180E9F64-55C8-40FD-99E0-5E10C7917038}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Net", "Net", "{4324441D-90E0-43C2-9948-27CC33FBB71D}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NativeFileDialogs.Net.Example.OpenDialog", "Examples\Net\NativeFileDialogs.Net.Example.OpenDialog\NativeFileDialogs.Net.Example.OpenDialog.csproj", "{E4DB3E4F-9B67-4D87-BAE4-2670475512C4}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NativeFileDialogs.Net.Example.OpenDialogMultiple", "Examples\Net\NativeFileDialogs.Net.Example.OpenDialogMultiple\NativeFileDialogs.Net.Example.OpenDialogMultiple.csproj", "{20C818D1-E5B1-4729-9874-DB322FB33662}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NativeFileDialogs.Net.Example.PickFolder", "Examples\Net\NativeFileDialogs.Net.Example.PickFolder\NativeFileDialogs.Net.Example.PickFolder.csproj", "{943A1673-49DD-4DC8-BAE1-D74C6D232463}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NativeFileDialogs.Net.Example.SaveDialog", "Examples\Net\NativeFileDialogs.Net.Example.SaveDialog\NativeFileDialogs.Net.Example.SaveDialog.csproj", "{AC9AEA38-59D3-452C-A738-15B88924A221}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -64,6 +74,22 @@ Global
{180E9F64-55C8-40FD-99E0-5E10C7917038}.Debug|Any CPU.Build.0 = Debug|Any CPU
{180E9F64-55C8-40FD-99E0-5E10C7917038}.Release|Any CPU.ActiveCfg = Release|Any CPU
{180E9F64-55C8-40FD-99E0-5E10C7917038}.Release|Any CPU.Build.0 = Release|Any CPU
{E4DB3E4F-9B67-4D87-BAE4-2670475512C4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E4DB3E4F-9B67-4D87-BAE4-2670475512C4}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E4DB3E4F-9B67-4D87-BAE4-2670475512C4}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E4DB3E4F-9B67-4D87-BAE4-2670475512C4}.Release|Any CPU.Build.0 = Release|Any CPU
{20C818D1-E5B1-4729-9874-DB322FB33662}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{20C818D1-E5B1-4729-9874-DB322FB33662}.Debug|Any CPU.Build.0 = Debug|Any CPU
{20C818D1-E5B1-4729-9874-DB322FB33662}.Release|Any CPU.ActiveCfg = Release|Any CPU
{20C818D1-E5B1-4729-9874-DB322FB33662}.Release|Any CPU.Build.0 = Release|Any CPU
{943A1673-49DD-4DC8-BAE1-D74C6D232463}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{943A1673-49DD-4DC8-BAE1-D74C6D232463}.Debug|Any CPU.Build.0 = Debug|Any CPU
{943A1673-49DD-4DC8-BAE1-D74C6D232463}.Release|Any CPU.ActiveCfg = Release|Any CPU
{943A1673-49DD-4DC8-BAE1-D74C6D232463}.Release|Any CPU.Build.0 = Release|Any CPU
{AC9AEA38-59D3-452C-A738-15B88924A221}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{AC9AEA38-59D3-452C-A738-15B88924A221}.Debug|Any CPU.Build.0 = Debug|Any CPU
{AC9AEA38-59D3-452C-A738-15B88924A221}.Release|Any CPU.ActiveCfg = Release|Any CPU
{AC9AEA38-59D3-452C-A738-15B88924A221}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{901C3F34-519E-4AA5-BF80-9E1788848D7C} = {B7B10789-6A38-46A8-9CCC-378B1D405D3D}
@@ -71,5 +97,10 @@ Global
{0DFF9BF7-0715-4559-B86D-8F5A02A11175} = {901C3F34-519E-4AA5-BF80-9E1788848D7C}
{7ED52D4C-EDFC-4C9E-B1D7-4F7E88951FCE} = {901C3F34-519E-4AA5-BF80-9E1788848D7C}
{180E9F64-55C8-40FD-99E0-5E10C7917038} = {901C3F34-519E-4AA5-BF80-9E1788848D7C}
{4324441D-90E0-43C2-9948-27CC33FBB71D} = {B7B10789-6A38-46A8-9CCC-378B1D405D3D}
{E4DB3E4F-9B67-4D87-BAE4-2670475512C4} = {4324441D-90E0-43C2-9948-27CC33FBB71D}
{20C818D1-E5B1-4729-9874-DB322FB33662} = {4324441D-90E0-43C2-9948-27CC33FBB71D}
{943A1673-49DD-4DC8-BAE1-D74C6D232463} = {4324441D-90E0-43C2-9948-27CC33FBB71D}
{AC9AEA38-59D3-452C-A738-15B88924A221} = {4324441D-90E0-43C2-9948-27CC33FBB71D}
EndGlobalSection
EndGlobal