Skip to content
This repository was archived by the owner on Feb 7, 2023. It is now read-only.

Commit ef94177

Browse files
Examples using ShellBrowser.Core 6.2.1.280 and ShellBrowser.WPF 1.2.0.280 nuget packages.
1 parent f7913ef commit ef94177

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+3817
-0
lines changed

Common/CheckedItem.cs

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
using System;
2+
using System.ComponentModel;
3+
using System.Windows.Input;
4+
5+
namespace Jam.Shell
6+
{
7+
public class CheckedItem<T> : INotifyPropertyChanged
8+
{
9+
public event PropertyChangedEventHandler PropertyChanged;
10+
11+
private bool m_IsChecked;
12+
private T m_Item;
13+
14+
private ICommand m_Command; //Command that can be attached to a menuitem.
15+
private Action<T, bool> m_CheckStateChanged; //function that is executed when the checkstate of an item changes.
16+
17+
public CheckedItem(T item, ICommand pCommand, bool isChecked = false)
18+
{
19+
this.m_Item = item;
20+
this.m_IsChecked = isChecked;
21+
this.m_Command = pCommand;
22+
}
23+
24+
public CheckedItem(T pItem, Action<T, bool> pCheckStateChanged, bool pIsChecked = false)
25+
{
26+
m_Item = pItem;
27+
m_CheckStateChanged = pCheckStateChanged;
28+
m_IsChecked = pIsChecked;
29+
30+
}
31+
32+
33+
public T Item
34+
{
35+
get
36+
{
37+
return m_Item;
38+
}
39+
set
40+
{
41+
m_Item = value;
42+
if (PropertyChanged != null) PropertyChanged(this, new PropertyChangedEventArgs("Item"));
43+
}
44+
}
45+
46+
public bool IsChecked
47+
{
48+
get
49+
{
50+
return m_IsChecked;
51+
}
52+
set
53+
{
54+
m_IsChecked = value;
55+
if (PropertyChanged != null) PropertyChanged(this, new PropertyChangedEventArgs("IsChecked"));
56+
if (m_CheckStateChanged != null)
57+
{
58+
m_CheckStateChanged(Item, m_IsChecked);
59+
}
60+
}
61+
}
62+
63+
public ICommand Command
64+
{
65+
get
66+
{
67+
return m_Command;
68+
}
69+
set
70+
{
71+
m_Command = value;
72+
}
73+
}
74+
75+
public override string ToString()
76+
{
77+
return m_Item.ToString();
78+
}
79+
}
80+
}

Common/RelayCommand.cs

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
using System;
2+
using System.Windows.Input;
3+
4+
namespace Jam.Shell
5+
{
6+
public class RelayCommand : ICommand
7+
{
8+
private Action<object> m_Execute;
9+
private Func<object, bool> m_CanExecute;
10+
11+
public RelayCommand(Action<object> execute, Func<object, bool> canExecute = null)
12+
{
13+
m_Execute = execute;
14+
m_CanExecute = canExecute;
15+
}
16+
17+
public event EventHandler CanExecuteChanged
18+
{
19+
add
20+
{
21+
CommandManager.RequerySuggested += value;
22+
}
23+
remove
24+
{
25+
CommandManager.RequerySuggested -= value;
26+
}
27+
}
28+
29+
public bool CanExecute(object parameter)
30+
{
31+
return m_CanExecute == null || m_CanExecute(parameter);
32+
}
33+
34+
public void Execute(object parameter)
35+
{
36+
m_Execute(parameter);
37+
}
38+
}
39+
}
25.6 KB
Binary file not shown.

ExplorerBrowser/App.config

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<configuration>
3+
<startup>
4+
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0,Profile=Client"/>
5+
</startup>
6+
</configuration>

ExplorerBrowser/App.xaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<Application x:Class="ExplorerBrowserSample.App"
2+
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
3+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
4+
xmlns:local="clr-namespace:ExplorerBrowserSample"
5+
StartupUri="MainWindow.xaml">
6+
<Application.Resources>
7+
8+
</Application.Resources>
9+
</Application>

ExplorerBrowser/App.xaml.cs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Configuration;
4+
using System.Data;
5+
using System.Linq;
6+
using System.Threading.Tasks;
7+
using System.Windows;
8+
9+
namespace ExplorerBrowserSample
10+
{
11+
/// <summary>
12+
/// Interaction logic for App.xaml
13+
/// </summary>
14+
public partial class App : Application
15+
{
16+
}
17+
}
Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
4+
<PropertyGroup>
5+
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
6+
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
7+
<ProjectGuid>{47698A3F-D4E0-453B-BA46-A71A2F60092A}</ProjectGuid>
8+
<OutputType>WinExe</OutputType>
9+
<RootNamespace>ExplorerBrowserSample</RootNamespace>
10+
<AssemblyName>ExplorerBrowserSample</AssemblyName>
11+
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
12+
<FileAlignment>512</FileAlignment>
13+
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
14+
<WarningLevel>4</WarningLevel>
15+
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
16+
<TargetFrameworkProfile>Client</TargetFrameworkProfile>
17+
</PropertyGroup>
18+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
19+
<PlatformTarget>AnyCPU</PlatformTarget>
20+
<DebugSymbols>true</DebugSymbols>
21+
<DebugType>full</DebugType>
22+
<Optimize>false</Optimize>
23+
<OutputPath>bin\Debug\</OutputPath>
24+
<DefineConstants>DEBUG;TRACE</DefineConstants>
25+
<ErrorReport>prompt</ErrorReport>
26+
<WarningLevel>4</WarningLevel>
27+
</PropertyGroup>
28+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
29+
<PlatformTarget>AnyCPU</PlatformTarget>
30+
<DebugType>pdbonly</DebugType>
31+
<Optimize>true</Optimize>
32+
<OutputPath>bin\Release\</OutputPath>
33+
<DefineConstants>TRACE</DefineConstants>
34+
<ErrorReport>prompt</ErrorReport>
35+
<WarningLevel>4</WarningLevel>
36+
</PropertyGroup>
37+
<PropertyGroup>
38+
<ApplicationIcon>..\Common\ShellBrowserComponents-Icon.ico</ApplicationIcon>
39+
</PropertyGroup>
40+
<PropertyGroup>
41+
<ApplicationManifest>app.manifest</ApplicationManifest>
42+
</PropertyGroup>
43+
<ItemGroup>
44+
<Reference Include="System" />
45+
<Reference Include="System.Data" />
46+
<Reference Include="System.Drawing" />
47+
<Reference Include="System.Windows.Forms" />
48+
<Reference Include="System.Xml" />
49+
<Reference Include="Microsoft.CSharp" />
50+
<Reference Include="System.Core" />
51+
<Reference Include="System.Xml.Linq" />
52+
<Reference Include="System.Data.DataSetExtensions" />
53+
<Reference Include="System.Xaml">
54+
<RequiredTargetFramework>4.0</RequiredTargetFramework>
55+
</Reference>
56+
<Reference Include="WindowsBase" />
57+
<Reference Include="PresentationCore" />
58+
<Reference Include="PresentationFramework" />
59+
<Reference Include="WindowsFormsIntegration" />
60+
</ItemGroup>
61+
<ItemGroup>
62+
<ApplicationDefinition Include="App.xaml">
63+
<Generator>MSBuild:Compile</Generator>
64+
<SubType>Designer</SubType>
65+
</ApplicationDefinition>
66+
<Compile Include="..\Common\RelayCommand.cs" />
67+
<Page Include="MainWindow.xaml">
68+
<Generator>MSBuild:Compile</Generator>
69+
<SubType>Designer</SubType>
70+
</Page>
71+
<Compile Include="App.xaml.cs">
72+
<DependentUpon>App.xaml</DependentUpon>
73+
<SubType>Code</SubType>
74+
</Compile>
75+
<Compile Include="..\Common\CheckedItem.cs" />
76+
<Compile Include="MainWindow.xaml.cs">
77+
<DependentUpon>MainWindow.xaml</DependentUpon>
78+
<SubType>Code</SubType>
79+
</Compile>
80+
</ItemGroup>
81+
<ItemGroup>
82+
<Compile Include="Properties\AssemblyInfo.cs">
83+
<SubType>Code</SubType>
84+
</Compile>
85+
<Compile Include="Properties\Resources.Designer.cs">
86+
<AutoGen>True</AutoGen>
87+
<DesignTime>True</DesignTime>
88+
<DependentUpon>Resources.resx</DependentUpon>
89+
</Compile>
90+
<Compile Include="Properties\Settings.Designer.cs">
91+
<AutoGen>True</AutoGen>
92+
<DependentUpon>Settings.settings</DependentUpon>
93+
<DesignTimeSharedInput>True</DesignTimeSharedInput>
94+
</Compile>
95+
<EmbeddedResource Include="Properties\Resources.resx">
96+
<Generator>ResXFileCodeGenerator</Generator>
97+
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
98+
</EmbeddedResource>
99+
<None Include="app.manifest" />
100+
<None Include="Properties\Settings.settings">
101+
<Generator>SettingsSingleFileGenerator</Generator>
102+
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
103+
</None>
104+
</ItemGroup>
105+
<ItemGroup>
106+
<None Include="App.config" />
107+
</ItemGroup>
108+
<Import Project="..\ProjectReferences.props" />
109+
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
110+
</Project>

ExplorerBrowser/MainWindow.xaml

Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
<Window
2+
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
3+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
4+
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
5+
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
6+
xmlns:local="clr-namespace:ExplorerBrowserSample"
7+
xmlns:sys="clr-namespace:System;assembly=mscorlib"
8+
xmlns:shlbr="http://schemas.jam-software.com/shellbrowser/wpf/"
9+
x:Class="ExplorerBrowserSample.MainWindow"
10+
mc:Ignorable="d"
11+
Title="ExplorerBrowser sample" Height="600" Width="1000">
12+
13+
<DockPanel>
14+
<Menu DockPanel.Dock ="Top" IsMainMenu="True">
15+
<MenuItem Header="Folder">
16+
<MenuItem Header="Windows" Tag="{x:Static shlbr:ShellFolder.Windows}" Click="ChooseFolderMenuItem_Click"/>
17+
<MenuItem Header="This PC" Tag="{x:Static shlbr:ShellFolder.Drives}" Click="ChooseFolderMenuItem_Click"/>
18+
<MenuItem Header="Desktop" Tag="{x:Static shlbr:ShellFolder.Desktop}" Click="ChooseFolderMenuItem_Click"/>
19+
<MenuItem Header="AllTasks" Tag="{x:Static shlbr:ShellFolder.AllTasks}" Click="ChooseFolderMenuItem_Click"/>
20+
<MenuItem Header="Choose..." Click="ChooseFolderMenuItem_Click"/>
21+
</MenuItem>
22+
<MenuItem Header="Panes" ItemsSource="{Binding VisiblePanes}">
23+
<MenuItem.ItemContainerStyle>
24+
<Style TargetType="MenuItem">
25+
<Setter Property="IsCheckable" Value="True"/>
26+
<Setter Property="Header" Value="{Binding Item}" />
27+
<Setter Property="IsChecked" Value="{Binding IsChecked, Mode=TwoWay}" />
28+
<Setter Property="Command" Value="{Binding Command}"/>
29+
<Setter Property="CommandParameter" Value="{Binding}"/>
30+
</Style>
31+
</MenuItem.ItemContainerStyle>
32+
</MenuItem>
33+
34+
<MenuItem Header="View" ItemsSource="{Binding ViewMode}">
35+
<MenuItem.ItemContainerStyle>
36+
<Style TargetType="MenuItem">
37+
<Setter Property="IsCheckable" Value="True"/>
38+
<Setter Property="Header" Value="{Binding Item}" />
39+
<Setter Property="IsChecked" Value="{Binding IsChecked, Mode=TwoWay}" />
40+
<Setter Property="Command" Value="{Binding Command}"/>
41+
<Setter Property="CommandParameter" Value="{Binding}"/>
42+
</Style>
43+
</MenuItem.ItemContainerStyle>
44+
</MenuItem>
45+
46+
<MenuItem Header="Columns" ItemsSource="{Binding Columns}">
47+
<MenuItem.ItemContainerStyle>
48+
<Style TargetType="MenuItem">
49+
<Setter Property="IsCheckable" Value="True"/>
50+
<Setter Property="Header" Value="{Binding Path=Item.Caption}" />
51+
<Setter Property="IsChecked" Value="{Binding IsChecked, Mode=TwoWay}" />
52+
<Setter Property="Command" Value="{Binding Command}"/>
53+
<Setter Property="CommandParameter" Value="{Binding}"/>
54+
</Style>
55+
</MenuItem.ItemContainerStyle>
56+
</MenuItem>
57+
<MenuItem Header="Column header" ItemsSource="{Binding ShowColumnHeader}">
58+
<MenuItem.ItemContainerStyle>
59+
<Style TargetType="MenuItem">
60+
<Setter Property="IsCheckable" Value="True"/>
61+
<Setter Property="Header" Value="{Binding Item}" />
62+
<Setter Property="IsChecked" Value="{Binding IsChecked, Mode=TwoWay}" />
63+
<Setter Property="Command" Value="{Binding Command}"/>
64+
<Setter Property="CommandParameter" Value="{Binding}"/>
65+
</Style>
66+
</MenuItem.ItemContainerStyle>
67+
</MenuItem>
68+
<MenuItem Header="Filter">
69+
<MenuItem Name="FilterFiles" Header="Files" Click="FilterFiles_Click" IsCheckable="True" IsChecked="True"/>
70+
<MenuItem Name="FilterFolders" Header="Folders" Click="FilterFolders_Click" IsCheckable="True" IsChecked="True"/>
71+
<MenuItem Name="FilterHidden" Header="Hidden" Click="FilterHidden_Click" IsCheckable="True" IsChecked="True"/>
72+
<MenuItem Name="FilterFileSystem" Header="Filesystem only" Click="FilterFileSystem_Click" IsCheckable="True"/>
73+
<MenuItem Name="FilterTextFiles" Header="Textfiles only" Click="FilterTextFiles_Click" IsCheckable="True"/>
74+
</MenuItem>
75+
<MenuItem Header="Check mode" ItemsSource="{Binding CheckMode}">
76+
<MenuItem.ItemContainerStyle>
77+
<Style TargetType="MenuItem">
78+
<Setter Property="IsCheckable" Value="True"/>
79+
<Setter Property="Header" Value="{Binding Item}" />
80+
<Setter Property="IsChecked" Value="{Binding IsChecked, Mode=TwoWay}" />
81+
<Setter Property="Command" Value="{Binding Command}"/>
82+
<Setter Property="CommandParameter" Value="{Binding}"/>
83+
</Style>
84+
</MenuItem.ItemContainerStyle>
85+
</MenuItem>
86+
<MenuItem Header="Selection">
87+
<MenuItem Name="SelectItem" Header="Select first item" Click="SelectItem_Click"/>
88+
<MenuItem Name="DeselectAll" Header="Deselect all" Click="DeselectAll_Click"/>
89+
<MenuItem Name="SelectedItems" Header="Get selected items" Click="SelectedItems_Click"/>
90+
<MenuItem Name="SingleSelection" Header="Single selection" Click="SingleSelection_Click" IsCheckable="True"/>
91+
</MenuItem>
92+
<MenuItem Header="Items">
93+
<MenuItem Name="GetItems" Header="Get items" Click="Items_Click"/>
94+
</MenuItem>
95+
</Menu>
96+
<shlbr:ShellAddressBar x:Name="shellAddressBar" DockPanel.Dock ="Top" SelectedItemIdList="{Binding FolderIdList, Mode=TwoWay}"/>
97+
<shlbr:ExplorerBrowser x:Name="explorerBrowser1" Location="{Binding FolderIdList, Mode=TwoWay}" NavigationComplete="explorerBrowser1_NavigationComplete" ViewChanged="explorerBrowser1_ViewChanged" View="Icon"/>
98+
</DockPanel>
99+
</Window>

0 commit comments

Comments
 (0)