Skip to content

Commit

Permalink
New .NET Core Sample project added.
Browse files Browse the repository at this point in the history
  • Loading branch information
evaristocuesta committed Nov 9, 2020
1 parent 83a9927 commit 925c7b8
Show file tree
Hide file tree
Showing 9 changed files with 138 additions and 1 deletion.
7 changes: 7 additions & 0 deletions FolderBrowserEx.sln
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NetFrameworkSample", "Sampl
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MVVMBase", "Samples\MVVMBase\MVVMBase.csproj", "{5412C5E7-9EE7-46B6-BA5D-D486F5A3D220}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NetCoreSample", "Samples\NetCoreSample\NetCoreSample.csproj", "{213DD845-38A7-43D5-9C26-48798DBAC52B}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand All @@ -29,13 +31,18 @@ Global
{5412C5E7-9EE7-46B6-BA5D-D486F5A3D220}.Debug|Any CPU.Build.0 = Debug|Any CPU
{5412C5E7-9EE7-46B6-BA5D-D486F5A3D220}.Release|Any CPU.ActiveCfg = Release|Any CPU
{5412C5E7-9EE7-46B6-BA5D-D486F5A3D220}.Release|Any CPU.Build.0 = Release|Any CPU
{213DD845-38A7-43D5-9C26-48798DBAC52B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{213DD845-38A7-43D5-9C26-48798DBAC52B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{213DD845-38A7-43D5-9C26-48798DBAC52B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{213DD845-38A7-43D5-9C26-48798DBAC52B}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{F722360B-B9B7-4032-AAC9-6F48C2DFD7B5} = {9F6CCACF-0F70-4A65-A691-EF3DBA504C66}
{5412C5E7-9EE7-46B6-BA5D-D486F5A3D220} = {9F6CCACF-0F70-4A65-A691-EF3DBA504C66}
{213DD845-38A7-43D5-9C26-48798DBAC52B} = {9F6CCACF-0F70-4A65-A691-EF3DBA504C66}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {5E30DE11-0284-497F-B151-6F08D3A0F46E}
Expand Down
9 changes: 9 additions & 0 deletions Samples/NetCoreSample/App.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<Application x:Class="NetCoreSample.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:NetCoreSample"
StartupUri="MainWindow.xaml">
<Application.Resources>

</Application.Resources>
</Application>
17 changes: 17 additions & 0 deletions Samples/NetCoreSample/App.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Threading.Tasks;
using System.Windows;

namespace NetCoreSample
{
/// <summary>
/// Interaction logic for App.xaml
/// </summary>
public partial class App : Application
{
}
}
10 changes: 10 additions & 0 deletions Samples/NetCoreSample/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
using System.Windows;

[assembly: ThemeInfo(
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
//(used if a resource is not found in the page,
// or application resource dictionaries)
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
//(used if a resource is not found in the page,
// app, or any theme specific resource dictionaries)
)]
21 changes: 21 additions & 0 deletions Samples/NetCoreSample/MainWindow.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<Window x:Class="NetCoreSample.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:NetCoreSample"
mc:Ignorable="d"
Title="FolderBrowserEx Sample with .NET Core" Height="450" Width="800">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="100" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Button Content="Show Folder Browser"
Command="{Binding ShowFolderBrowserCommand}"
Margin="10" />
<TextBox Text="{Binding Result}"
Grid.Row="1"
Margin="10" />
</Grid>
</Window>
17 changes: 17 additions & 0 deletions Samples/NetCoreSample/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
using FolderBrowserEx;
using System.Windows;

namespace NetCoreSample
{
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
DataContext = new MainWindowViewModel(new FolderBrowserDialog());
}
}
}
42 changes: 42 additions & 0 deletions Samples/NetCoreSample/MainWindowViewModel.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
using FolderBrowserEx;
using MVVMBase;
using System.Windows.Forms;
using System.Windows.Input;

namespace NetCoreSample
{
public class MainWindowViewModel : ViewModelBase
{
private readonly IFolderBrowserDialog _folderBrowserDialog;
private string _result;

public MainWindowViewModel(IFolderBrowserDialog folderBrowserDialog)
{
_folderBrowserDialog = folderBrowserDialog;
ShowFolderBrowserCommand = new Command(ShowFolderBrowserCommandExecute, ShowFolderBrowserCommandCanExecute);
}

public ICommand ShowFolderBrowserCommand { get; private set; }

public string Result
{
get { return _result; }
set { _result = value; OnPropertyChanged(); }
}

private bool ShowFolderBrowserCommandCanExecute()
{
return true;
}

private void ShowFolderBrowserCommandExecute()
{
_folderBrowserDialog.Title = "Select a folder";
_folderBrowserDialog.InitialFolder = @"C:\";
if (_folderBrowserDialog.ShowDialog() == DialogResult.OK)
{
Result += $"{_folderBrowserDialog.SelectedFolder}\n";
}
}
}
}
14 changes: 14 additions & 0 deletions Samples/NetCoreSample/NetCoreSample.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">

<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
<UseWPF>true</UseWPF>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\..\FolderBrowserEx\FolderBrowserEx.csproj" />
<ProjectReference Include="..\MVVMBase\MVVMBase.csproj" />
</ItemGroup>

</Project>
2 changes: 1 addition & 1 deletion Samples/NetFrameworkSample/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Button Content="Show Folder Browser"
Command="{Binding ShowFolderBrowserCommand}"
Command="{Binding ShowFolderBrowserCommand}"
Margin="10"/>
<TextBox Text="{Binding Result}"
Grid.Row="1"
Expand Down

0 comments on commit 925c7b8

Please sign in to comment.