Skip to content

Commit fbdcfe1

Browse files
V7.2
1 parent 516e618 commit fbdcfe1

File tree

11 files changed

+294
-98
lines changed

11 files changed

+294
-98
lines changed

CoreReferences.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<Project ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
33
<ItemGroup>
44
<PackageReference Include="ShellBrowser.Core">
5-
<Version>7.1.0.357</Version>
5+
<Version>7.2.0.381</Version>
66
</PackageReference>
77
</ItemGroup>
88
</Project>

ExplorerBrowser/ExplorerBrowserMainForm.cs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,17 @@ private void ExplorerBrowserMainForm_Load(object sender, EventArgs e)
274274
explorerBrowser1.VisiblePanes -= ExplorerPane.SearchEdit;
275275
searchBoxToolStripMenuItem.Enabled = false;
276276
}
277+
278+
explorerBrowser1.AddressBar.SearchEdit.BeforeSearch += SearchEdit_BeforeSearch;
279+
280+
}
281+
282+
private void SearchEdit_BeforeSearch(object sender, BeforeSearchCancelEventArgs e)
283+
{
284+
//Workaround: A filter doesn't work for search results. To achieve an additional filtering of the search result view, we attach the filter to the search phrase itself.
285+
if (!String.IsNullOrEmpty(explorerBrowser1.ContentFilter.FilePatternFilter)) {
286+
e.SearchPhrase += " AND System.FileName: " + explorerBrowser1.ContentFilter.FilePatternFilter;
287+
}
277288
}
278289

279290
private void detailsToolStripMenuItem1_Click(object sender, EventArgs e)

JamCommander/PreviewForm.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
11
using Jam.Shell;
22
using System;
3+
using System.ComponentModel;
34
using System.Windows.Forms;
45

56
namespace JamCommander
67
{
78
public partial class PreviewForm : Form
89
{
10+
[Browsable(false)]
11+
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
912
public ShellFilePreview FilePreview
1013
{
1114
get { return filePreview; }

JamCommander/ShellListViewPane.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using Jam.Shell;
22
using System;
3+
using System.ComponentModel;
34
using System.Drawing;
45
using System.Windows.Forms;
56

@@ -11,12 +12,16 @@ public partial class ShellListViewPane : UserControl
1112
private EventHandler onFocusChange;
1213
private EventHandler onQuitButtonClick;
1314

15+
[Browsable(false)]
16+
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
1417
public EventHandler OnQuitButtonClick
1518
{
1619
get { return onQuitButtonClick; }
1720
set { onQuitButtonClick = value; }
1821
}
1922

23+
[Browsable(false)]
24+
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
2025
public EventHandler OnFocusChange
2126
{
2227
get { return onFocusChange; }

JamCommander/TreeViewForm.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
11
using Jam.Shell;
22
using System;
3+
using System.ComponentModel;
34
using System.Windows.Forms;
45

56
namespace JamCommander
67
{
78
public partial class TreeViewForm : Form
89
{
10+
[Browsable(false)]
11+
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
912
public ShellTreeView TreeView
1013
{
1114
get { return treeView; }

JamExplorer/FileListForm.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ public FileList FileList
2626
/// A setter to display the total size retrieved from the
2727
/// shellControlConnector selection list.
2828
/// </summary>
29+
[Browsable(false)]
30+
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
2931
public long TotalSize
3032
{
3133
set
@@ -34,7 +36,8 @@ public long TotalSize
3436
String.Format("Total size: {0} kb", value >> 10);
3537
}
3638
}
37-
39+
[Browsable(false)]
40+
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
3841
public string TotalSizeDisabled
3942
{
4043
set

JamExplorer/JamExplorerMainForm.Designer.cs

Lines changed: 80 additions & 31 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

JamExplorer/JamExplorerMainForm.cs

Lines changed: 131 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,147 @@
1+
using Jam.Explorer.Properties;
2+
using Jam.Shell;
3+
using Jam.Shell.Controls;
14
using System;
25
using System.Collections.Generic;
36
using System.ComponentModel;
47
using System.Data;
58
using System.Drawing;
6-
using System.Text;
7-
using System.Windows.Forms;
8-
using Jam.Shell;
9-
using Jam.Shell.Controls;
10-
using Jam.Explorer.Properties;
119
using System.Globalization;
1210
using System.IO;
11+
using System.Linq;
12+
using System.Text;
13+
using System.Windows.Forms;
1314

1415
namespace Jam.Explorer
1516
{
16-
17+
1718
public partial class JamExplorerMainForm : Form
1819
{
1920
public JamExplorerMainForm()
2021
{
2122
InitializeComponent();
2223
setPreviewVisibility(false);
24+
25+
detailsPane1.CustomizeProperties += DetailsPane_DemonstrateCustomization;
26+
}
27+
28+
29+
#region --- DetailsPane Customization Examples ---
30+
31+
/// <summary>
32+
/// This is the central event handler to demonstrate the various ways
33+
/// the DetailsPane can be customized.
34+
/// It acts as a dispatcher, calling specific methods for different file types
35+
/// to keep the examples clear and separated.
36+
/// </summary>
37+
private void DetailsPane_DemonstrateCustomization(object sender, CustomizePropertiesEventArgs e)
38+
{
39+
var path = e.ItemIdList?.GetDisplayName(ItemIdList.DisplayNameFormat.DisplayPath);
40+
if (string.IsNullOrEmpty(path))
41+
return;
42+
43+
e.ShowPropertiesButton = !ItemIdList.IsNullOrInvalid(e.ItemIdList) && e.ItemIdList.IsFolder;
44+
45+
var ext = Path.GetExtension(path).ToLowerInvariant();
46+
47+
switch (ext)
48+
{
49+
// For image files, we want to completely override the default view.
50+
case ".jpg":
51+
case ".jpeg":
52+
case ".png":
53+
case ".bmp":
54+
Example1_OverrideAllProperties(e);
55+
break;
56+
57+
// For audio files, we want to add an extra shell property to the default list.
58+
case ".mp3":
59+
case ".wav":
60+
Example2_ExtendWithShellProperty(e);
61+
break;
62+
63+
// For text files, we want to add our own calculated data.
64+
case ".txt":
65+
Example3_AddCustomCalculatedProperty(e);
66+
break;
67+
68+
// For all other file types, we do nothing and let the DetailsPane
69+
// show its default properties.
70+
default:
71+
break;
72+
}
2373
}
2474

75+
/// <summary>
76+
/// EXAMPLE 1: How to completely replace the default properties with a custom set.
77+
/// This is useful for file types where you want a very specific view.
78+
/// </summary>
79+
private void Example1_OverrideAllProperties(CustomizePropertiesEventArgs e)
80+
{
81+
// 1. Start by clearing the default list provided by the component.
82+
e.ColumnsToDisplay.Clear();
83+
84+
// 2. Add the specific SHCOLUMNIDs you want to display.
85+
e.ColumnsToDisplay.Add(new SHCOLUMNID("System.ItemTypeText"));
86+
e.ColumnsToDisplay.Add(new SHCOLUMNID("System.Image.Dimensions"));
87+
e.ColumnsToDisplay.Add(new SHCOLUMNID("System.Size"));
88+
e.ColumnsToDisplay.Add(new SHCOLUMNID("System.DateModified"));
89+
e.ColumnsToDisplay.Add(new SHCOLUMNID("System.Photo.DateTaken"));
90+
91+
// 3. You can even mix this with your own custom properties.
92+
e.CustomProperties.Add("Review Status", "Approved");
93+
}
94+
95+
/// <summary>
96+
/// EXAMPLE 2: How to add an additional shell property to the default list.
97+
/// This is the most common use case.
98+
/// </summary>
99+
private void Example2_ExtendWithShellProperty(CustomizePropertiesEventArgs e)
100+
{
101+
// The e.ColumnsToDisplay list already contains the defaults.
102+
// Simply add the SHCOLUMNID you need.
103+
e.ColumnsToDisplay.Add(new SHCOLUMNID("System.Media.Bitrate"));
104+
}
105+
106+
/// <summary>
107+
/// EXAMPLE 3: How to add a completely custom property based on your own logic.
108+
/// This is perfect for integrating data from a database, a web service, or calculations.
109+
/// </summary>
110+
private void Example3_AddCustomCalculatedProperty(CustomizePropertiesEventArgs e)
111+
{
112+
try
113+
{
114+
var path = e.ItemIdList.GetDisplayName(ItemIdList.DisplayNameFormat.DisplayPath);
115+
116+
// Your custom logic: calculate the word count.
117+
int wordCount = File.ReadAllText(path).Split(new char[] { ' ', '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries).Length;
118+
119+
// Add the result to the CustomProperties dictionary.
120+
// The key is the caption, the value is the text to display.
121+
e.CustomProperties.Add("Word Count (approx.)", wordCount.ToString());
122+
}
123+
catch (Exception ex)
124+
{
125+
// It's good practice to handle potential errors gracefully.
126+
e.CustomProperties.Add("Word Count", $"Error: {ex.Message}");
127+
}
128+
}
129+
130+
#endregion
131+
132+
25133
private void ToolbarFolderUp_Click(object sender, EventArgs e)
26134
{
27135
shellListView1.GoUp();
28-
136+
29137
}
30138

31139
private void MenuShowPropertiesItem_Click(object sender, EventArgs e)
32140
{
33141
if (shellTreeView1.Focused)
34-
shellTreeView1.InvokeCommandOnSelected(ShellCommand.Properties);
142+
shellTreeView1.InvokeCommandOnSelected(ShellCommand.Properties);
35143
else
36-
shellListView1.InvokeCommandOnSelected(ShellCommand.Properties);
144+
shellListView1.InvokeCommandOnSelected(ShellCommand.Properties);
37145
}
38146

39147
private void MenuRenameItem_Click(object sender, EventArgs e)
@@ -94,7 +202,7 @@ private void enabledToolStripMenuItem_CheckedChanged(object sender, EventArgs e)
94202

95203
private void showSelectedToolStripMenuItem_Click(object sender, EventArgs e)
96204
{
97-
PathSelectionList selectionList =
205+
PathSelectionList selectionList =
98206
shellControlConnector1.SelectionList;
99207

100208
string selection = shellControlConnector1.SelectionList.ToString();
@@ -279,7 +387,7 @@ private void showFilesToolStripMenuItem_CheckedChanged(object sender, EventArgs
279387
private void desktopToolStripMenuItemSpecialFolder_Click(object sender, EventArgs e)
280388
{
281389

282-
ToolStripMenuItem toolStripMenuItem = sender as ToolStripMenuItem;
390+
ToolStripMenuItem toolStripMenuItem = sender as ToolStripMenuItem;
283391

284392
if (toolStripMenuItem != null)
285393
{
@@ -322,7 +430,8 @@ private void shellListView1_BeforeShellCommand(object sender, BeforeShellCommand
322430
if (dialogShown)
323431
return;
324432

325-
if ((e.Verb == ShellCommand.Default) || (e.Verb == ShellCommand.Open)) {
433+
if ((e.Verb == ShellCommand.Default) || (e.Verb == ShellCommand.Open))
434+
{
326435
DialogResult dialogResult =
327436
MessageBox.Show(String.Format("Do you want to open the file selected?{0}" +
328437
"(This message is shown only once as a demonstration of the 'BeforeShellCommand' event)",
@@ -464,7 +573,7 @@ private void ToggleBackground(Control control)
464573
switch (m_currentBackground)
465574
{
466575
case 0:
467-
control.BackgroundImage = Resources.background;
576+
control.BackgroundImage = Jam.Explorer.Properties.Resources.background;
468577
break;
469578
case 1:
470579
case 2:
@@ -541,8 +650,11 @@ private void JamExplorerMainForm_Load(object sender, EventArgs e)
541650

542651
toolStripSplitButtonView.DefaultItem = toolStripSplitButtonView.DropDownItems[0];
543652

653+
//uncomment the following line to not search for file content when the search box is used, only for filenames.
654+
//this.addressBar1.SearchEdit.ContentSearch = false;
655+
544656
//Un-comment for a custom entry in the background context menu.
545-
// shellListView1.BackgroundContextMenu = new MyBackgroundContextMenu();
657+
// shellListView1.BackgroundContextMenu = new MyBackgroundContextMenu();
546658
}
547659

548660
private void OpenControlPanelTask(Jam.Shell.Dialogs.ControlPanelItem pControlPanelItem)
@@ -748,6 +860,11 @@ private void shellListView1_SelectionChanged(object sender, EventArgs e)
748860
toolStripStatusLabel1.Text = shellListView1.SelectedItems.Count.ToString() + " item(s) selected.";
749861

750862
}
863+
864+
private void checkBoxDetails_CheckedChanged(object sender, EventArgs e)
865+
{
866+
detailsPane1.Visible = checkBoxDetails.Checked;
867+
}
751868
}
752869

753870
class CustomPreviewHandler : IShellPreviewHandler

0 commit comments

Comments
 (0)