[Feature] Show how many folders and files a folder contains in searchbar (#189), version 1.0.17.67

This commit is contained in:
Markus Hofknecht 2021-06-27 14:44:12 +02:00
parent f430782d23
commit 0a310aadb0
11 changed files with 203 additions and 34 deletions

View file

@ -190,9 +190,8 @@ namespace SystemTrayMenu.Handler
ClearIsSelectedByKey();
}
internal void SearchTextChanged(object sender, EventArgs e)
internal void SearchTextChanged(Menu menu)
{
Menu menu = (Menu)sender;
DataGridView dgv = menu.GetDataGridView();
if (dgv.Rows.Count > 0)
{

View file

@ -626,28 +626,23 @@ namespace SystemTrayMenu.Business
{
Menu menu = new Menu();
if (title != null)
string path = Config.Path;
if (title == null)
{
if (string.IsNullOrEmpty(title))
{
title = Path.GetPathRoot(Config.Path);
}
menu.SetTitle(title);
menu.UserClickedOpenFolder += OpenMainFolder;
void OpenMainFolder()
{
OpenFolder();
}
title = Path.GetFileName(menuData.RowDataParent.TargetFilePath);
path = menuData.RowDataParent.TargetFilePath;
}
else
if (string.IsNullOrEmpty(title))
{
menu.SetTitle(Path.GetFileName(menuData.RowDataParent.TargetFilePath));
menu.UserClickedOpenFolder += OpenSubFolder;
void OpenSubFolder()
{
OpenFolder(menuData.RowDataParent.TargetFilePath);
}
title = Path.GetPathRoot(path);
}
menu.SetTitle(title);
menu.UserClickedOpenFolder += OpenFolderInExplorer;
void OpenFolderInExplorer()
{
OpenFolder(path);
}
menu.Level = menuData.Level;
@ -680,9 +675,11 @@ namespace SystemTrayMenu.Business
}
menu.VisibleChanged += MenuVisibleChanged;
AddItemsToMenu(menuData.RowDatas, menu);
static void AddItemsToMenu(List<RowData> data, Menu menu)
AddItemsToMenu(menuData.RowDatas, menu, out int foldersCount, out int filesCount);
static void AddItemsToMenu(List<RowData> data, Menu menu, out int foldersCount, out int filesCount)
{
foldersCount = 0;
filesCount = 0;
DataGridView dgv = menu.GetDataGridView();
DataTable dataTable = new DataTable();
dataTable.Columns.Add(dgv.Columns[0].Name, typeof(Icon));
@ -691,6 +688,15 @@ namespace SystemTrayMenu.Business
dataTable.Columns.Add("SortIndex");
foreach (RowData rowData in data)
{
if (rowData.ContainsMenu)
{
foldersCount++;
}
else
{
filesCount++;
}
rowData.SetData(rowData, dataTable);
}
@ -716,6 +722,8 @@ namespace SystemTrayMenu.Business
Log.Warn("Dgv_DataError occured", e.Exception);
}
menu.SetCounts(foldersCount, filesCount);
return menu;
}
@ -1011,9 +1019,17 @@ namespace SystemTrayMenu.Business
private void Menu_SearchTextChanged(object sender, EventArgs e)
{
keyboardInput.SearchTextChanged(sender, e);
Menu menu = (Menu)sender;
keyboardInput.SearchTextChanged(menu);
AdjustMenusSizeAndLocation();
searchTextChanging = false;
// if any open menu close
Menu menuToClose = menus[menu.Level + 1];
if (menuToClose != null)
{
HideOldMenu(menuToClose);
}
}
}
}

View file

@ -18,10 +18,12 @@ namespace SystemTrayMenu
public static class Config
{
internal static readonly Bitmap BitmapOpenFolder = ReadSvg(Properties.Resources.ic_fluent_folder_48_regular);
internal static readonly Bitmap BitmapOpenFolder = ReadSvg(Properties.Resources.ic_fluent_folder_arrow_right_48_regular);
internal static readonly Bitmap BitmapPin = ReadSvg(Properties.Resources.ic_fluent_pin_48_regular);
internal static readonly Bitmap BitmapPinActive = ReadSvg(Properties.Resources.ic_fluent_pin_48_filled);
internal static readonly Bitmap BitmapSearch = ReadSvg(Properties.Resources.ic_fluent_search_48_regular);
internal static readonly Bitmap BitmapFoldersCount = ReadSvg(Properties.Resources.ic_fluent_folder_48_regular);
internal static readonly Bitmap BitmapFilesCount = ReadSvg(Properties.Resources.ic_fluent_document_48_regular);
private static bool readDarkModeDone;
private static bool isDarkMode;

View file

@ -39,5 +39,5 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.17.66")]
[assembly: AssemblyFileVersion("1.0.17.66")]
[assembly: AssemblyVersion("1.0.17.67")]
[assembly: AssemblyFileVersion("1.0.17.67")]

View file

@ -60,6 +60,16 @@ namespace SystemTrayMenu.Properties {
}
}
/// <summary>
/// Looks up a localized resource of type System.Byte[].
/// </summary>
public static byte[] ic_fluent_document_48_regular {
get {
object obj = ResourceManager.GetObject("ic_fluent_document_48_regular", resourceCulture);
return ((byte[])(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Byte[].
/// </summary>
@ -70,6 +80,16 @@ namespace SystemTrayMenu.Properties {
}
}
/// <summary>
/// Looks up a localized resource of type System.Byte[].
/// </summary>
public static byte[] ic_fluent_folder_arrow_right_48_regular {
get {
object obj = ResourceManager.GetObject("ic_fluent_folder_arrow_right_48_regular", resourceCulture);
return ((byte[])(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Byte[].
/// </summary>

View file

@ -193,4 +193,10 @@
<data name="ic_fluent_search_48_regular" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\ic_fluent_search_48_regular.svg;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="ic_fluent_document_48_regular" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\ic_fluent_document_48_regular.svg;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="ic_fluent_folder_arrow_right_48_regular" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\ic_fluent_folder_arrow_right_48_regular.svg;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
</root>

View file

@ -0,0 +1,3 @@
<svg width="48" height="48" viewBox="0 0 48 48" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill="#585858" d="M12.25 4C9.90279 4 8 5.90279 8 8.25V39.75C8 42.0972 9.90279 44 12.25 44H35.75C38.0972 44 40 42.0972 40 39.75V18.4142C40 17.8175 39.7629 17.2452 39.341 16.8232L27.1768 4.65901C26.7548 4.23705 26.1825 4 25.5858 4H12.25ZM10.5 8.25C10.5 7.2835 11.2835 6.5 12.25 6.5H24V15.25C24 17.3211 25.6789 19 27.75 19H37.5V39.75C37.5 40.7165 36.7165 41.5 35.75 41.5H12.25C11.2835 41.5 10.5 40.7165 10.5 39.75V8.25ZM35.4822 16.5H27.75C27.0596 16.5 26.5 15.9404 26.5 15.25V7.51777L35.4822 16.5Z"/>
</svg>

After

Width:  |  Height:  |  Size: 607 B

View file

@ -0,0 +1,3 @@
<svg width="48" height="48" viewBox="0 0 48 48" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill="#585858" d="M17.0607 9C17.8933 9 18.7 9.27703 19.3552 9.78393L19.5301 9.92784L22.1162 12.1907C22.3061 12.3569 22.5409 12.4609 22.7891 12.4909L22.9393 12.5H40.25C42.2543 12.5 43.8913 14.0724 43.9948 16.0508L44 16.25L44.0009 24.0564C43.2472 23.3816 42.4076 22.8008 41.5007 22.3322L41.5 16.25C41.5 15.6028 41.0081 15.0705 40.3778 15.0065L40.25 15L22.8474 14.9989L20.7205 17.6147C20.0559 18.4327 19.0803 18.9305 18.035 18.9933L17.8101 19L6.5 18.999V35.25C6.5 35.8972 6.99187 36.4295 7.62219 36.4935L7.75 36.5L24.5186 36.5005C24.7868 37.3812 25.1535 38.219 25.606 39.0011L7.75 39C5.74574 39 4.10873 37.4276 4.0052 35.4492L4 35.25V12.75C4 10.7457 5.57236 9.10873 7.55084 9.0052L7.75 9H17.0607ZM17.0607 11.5H7.75C7.10279 11.5 6.57047 11.9919 6.50645 12.6222L6.5 12.75V16.499L17.8101 16.5C18.1394 16.5 18.4534 16.3701 18.6858 16.142L18.7802 16.0382L20.415 14.025L17.8838 11.8093C17.6939 11.6431 17.4591 11.5391 17.2109 11.5091L17.0607 11.5ZM36 23C41.5228 23 46 27.4772 46 33C46 38.5228 41.5228 43 36 43C30.4772 43 26 38.5228 26 33C26 27.4772 30.4772 23 36 23ZM35.9991 27.6342L35.8871 27.7097L35.7929 27.7929L35.7097 27.8871C35.4301 28.2467 35.4301 28.7533 35.7097 29.1129L35.7929 29.2071L38.585 32H31L30.8834 32.0067C30.4243 32.0601 30.06 32.4243 30.0067 32.8834L30 33L30.0067 33.1166C30.06 33.5757 30.4243 33.9399 30.8834 33.9933L31 34H38.585L35.7929 36.7929L35.7097 36.8871C35.4047 37.2794 35.4324 37.8466 35.7929 38.2071C36.1534 38.5676 36.7206 38.5953 37.1129 38.2903L37.2071 38.2071L41.7071 33.7071L41.7578 33.6525L41.8296 33.5585L41.8751 33.4843L41.9063 33.4232L41.9503 33.3121L41.9726 33.2335L41.9932 33.1175L42 33L41.997 32.924L41.9798 32.7992L41.9505 32.6883L41.9288 32.6287L41.8753 32.5159L41.8296 32.4415L41.7872 32.3833L41.7485 32.3369L41.7071 32.2929L37.2071 27.7929L37.1129 27.7097C36.7893 27.4581 36.3465 27.4329 35.9991 27.6342Z"/>
</svg>

After

Width:  |  Height:  |  Size: 1.9 KiB

View file

@ -109,6 +109,17 @@ namespace SystemTrayMenu.UserInterface
Scaling.Scale(pictureBoxSearch.Width),
Scaling.Scale(pictureBoxSearch.Height));
pictureBoxFoldersCount.Size = new Size(
Scaling.Scale(pictureBoxFoldersCount.Width),
Scaling.Scale(pictureBoxFoldersCount.Height));
pictureBoxFilesCount.Size = new Size(
Scaling.Scale(pictureBoxFilesCount.Width),
Scaling.Scale(pictureBoxFilesCount.Height));
labelFoldersCount.Font = new Font("Segoe UI", 7F * Scaling.Factor, FontStyle.Bold, GraphicsUnit.Point, (byte)0);
labelFilesCount.Font = new Font("Segoe UI", 7F * Scaling.Factor, FontStyle.Bold, GraphicsUnit.Point, (byte)0);
// tableLayoutPanelDgvAndScrollbar.ResumeLayout(false);
// ((System.ComponentModel.ISupportInitialize)dgv).EndInit();
// tableLayoutPanelSearch.ResumeLayout(false);

View file

@ -34,8 +34,12 @@
this.tableLayoutPanelDgvAndScrollbar = new System.Windows.Forms.TableLayoutPanel();
this.dgv = new System.Windows.Forms.DataGridView();
this.tableLayoutPanelSearch = new System.Windows.Forms.TableLayoutPanel();
this.labelFilesCount = new System.Windows.Forms.Label();
this.textBoxSearch = new System.Windows.Forms.TextBox();
this.pictureBoxSearch = new System.Windows.Forms.PictureBox();
this.pictureBoxFilesCount = new System.Windows.Forms.PictureBox();
this.pictureBoxFoldersCount = new System.Windows.Forms.PictureBox();
this.labelFoldersCount = new System.Windows.Forms.Label();
this.tableLayoutPanelMenu = new System.Windows.Forms.TableLayoutPanel();
this.tableLayoutPanelTitle = new System.Windows.Forms.TableLayoutPanel();
this.pictureBoxOpenFolder = new System.Windows.Forms.PictureBox();
@ -44,6 +48,8 @@
((System.ComponentModel.ISupportInitialize)(this.dgv)).BeginInit();
this.tableLayoutPanelSearch.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.pictureBoxSearch)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.pictureBoxFilesCount)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.pictureBoxFoldersCount)).BeginInit();
this.tableLayoutPanelMenu.SuspendLayout();
this.tableLayoutPanelTitle.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.pictureBoxOpenFolder)).BeginInit();
@ -106,20 +112,39 @@
this.tableLayoutPanelSearch.AutoSize = true;
this.tableLayoutPanelSearch.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
this.tableLayoutPanelSearch.BackColor = System.Drawing.Color.White;
this.tableLayoutPanelSearch.ColumnCount = 2;
this.tableLayoutPanelSearch.ColumnCount = 6;
this.tableLayoutPanelSearch.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
this.tableLayoutPanelSearch.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.tableLayoutPanelSearch.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
this.tableLayoutPanelSearch.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
this.tableLayoutPanelSearch.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
this.tableLayoutPanelSearch.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
this.tableLayoutPanelSearch.Controls.Add(this.labelFilesCount, 5, 0);
this.tableLayoutPanelSearch.Controls.Add(this.textBoxSearch, 1, 0);
this.tableLayoutPanelSearch.Controls.Add(this.pictureBoxSearch, 0, 0);
this.tableLayoutPanelSearch.Controls.Add(this.pictureBoxFilesCount, 4, 0);
this.tableLayoutPanelSearch.Controls.Add(this.pictureBoxFoldersCount, 2, 0);
this.tableLayoutPanelSearch.Controls.Add(this.labelFoldersCount, 3, 0);
this.tableLayoutPanelSearch.Location = new System.Drawing.Point(0, 63);
this.tableLayoutPanelSearch.Margin = new System.Windows.Forms.Padding(0, 1, 0, 0);
this.tableLayoutPanelSearch.Name = "tableLayoutPanelSearch";
this.tableLayoutPanelSearch.RowCount = 1;
this.tableLayoutPanelSearch.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.tableLayoutPanelSearch.Size = new System.Drawing.Size(83, 22);
this.tableLayoutPanelSearch.Size = new System.Drawing.Size(129, 22);
this.tableLayoutPanelSearch.TabIndex = 5;
this.tableLayoutPanelSearch.MouseWheel += new System.Windows.Forms.MouseEventHandler(this.DgvMouseWheel);
//
// labelFilesCount
//
this.labelFilesCount.Anchor = System.Windows.Forms.AnchorStyles.Left;
this.labelFilesCount.AutoSize = true;
this.labelFilesCount.Location = new System.Drawing.Point(104, 3);
this.labelFilesCount.Margin = new System.Windows.Forms.Padding(0);
this.labelFilesCount.Name = "labelFilesCount";
this.labelFilesCount.Size = new System.Drawing.Size(25, 15);
this.labelFilesCount.TabIndex = 2;
this.labelFilesCount.Text = "999";
//
// textBoxSearch
//
this.textBoxSearch.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
@ -130,7 +155,7 @@
this.textBoxSearch.Margin = new System.Windows.Forms.Padding(3, 4, 3, 2);
this.textBoxSearch.MaxLength = 37;
this.textBoxSearch.Name = "textBoxSearch";
this.textBoxSearch.Size = new System.Drawing.Size(55, 15);
this.textBoxSearch.Size = new System.Drawing.Size(15, 15);
this.textBoxSearch.TabIndex = 0;
this.textBoxSearch.TextChanged += new System.EventHandler(this.TextBoxSearch_TextChanged);
//
@ -147,6 +172,45 @@
this.pictureBoxSearch.Paint += new System.Windows.Forms.PaintEventHandler(this.PictureBoxSearch_Paint);
this.pictureBoxSearch.Resize += new System.EventHandler(this.PictureBox_Resize);
//
// pictureBoxFilesCount
//
this.pictureBoxFilesCount.Anchor = System.Windows.Forms.AnchorStyles.Left;
this.pictureBoxFilesCount.BackColor = System.Drawing.Color.White;
this.pictureBoxFilesCount.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
this.pictureBoxFilesCount.Location = new System.Drawing.Point(86, 2);
this.pictureBoxFilesCount.Margin = new System.Windows.Forms.Padding(0);
this.pictureBoxFilesCount.Name = "pictureBoxFilesCount";
this.pictureBoxFilesCount.Size = new System.Drawing.Size(18, 18);
this.pictureBoxFilesCount.TabIndex = 1;
this.pictureBoxFilesCount.TabStop = false;
this.pictureBoxFilesCount.Paint += new System.Windows.Forms.PaintEventHandler(this.PictureBoxFilesCount_Paint);
this.pictureBoxFilesCount.Resize += new System.EventHandler(this.PictureBox_Resize);
//
// pictureBoxFoldersCount
//
this.pictureBoxFoldersCount.Anchor = System.Windows.Forms.AnchorStyles.Left;
this.pictureBoxFoldersCount.BackColor = System.Drawing.Color.White;
this.pictureBoxFoldersCount.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
this.pictureBoxFoldersCount.Location = new System.Drawing.Point(43, 2);
this.pictureBoxFoldersCount.Margin = new System.Windows.Forms.Padding(0);
this.pictureBoxFoldersCount.Name = "pictureBoxFoldersCount";
this.pictureBoxFoldersCount.Size = new System.Drawing.Size(18, 18);
this.pictureBoxFoldersCount.TabIndex = 1;
this.pictureBoxFoldersCount.TabStop = false;
this.pictureBoxFoldersCount.Paint += new System.Windows.Forms.PaintEventHandler(this.PictureBoxFoldersCount_Paint);
this.pictureBoxFoldersCount.Resize += new System.EventHandler(this.PictureBox_Resize);
//
// labelFoldersCount
//
this.labelFoldersCount.Anchor = System.Windows.Forms.AnchorStyles.Left;
this.labelFoldersCount.AutoSize = true;
this.labelFoldersCount.Location = new System.Drawing.Point(61, 3);
this.labelFoldersCount.Margin = new System.Windows.Forms.Padding(0);
this.labelFoldersCount.Name = "labelFoldersCount";
this.labelFoldersCount.Size = new System.Drawing.Size(25, 15);
this.labelFoldersCount.TabIndex = 2;
this.labelFoldersCount.Text = "999";
//
// tableLayoutPanelMenu
//
this.tableLayoutPanelMenu.AutoSize = true;
@ -163,7 +227,7 @@
this.tableLayoutPanelMenu.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.tableLayoutPanelMenu.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.tableLayoutPanelMenu.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.tableLayoutPanelMenu.Size = new System.Drawing.Size(83, 85);
this.tableLayoutPanelMenu.Size = new System.Drawing.Size(129, 85);
this.tableLayoutPanelMenu.TabIndex = 4;
this.tableLayoutPanelMenu.MouseWheel += new System.Windows.Forms.MouseEventHandler(this.DgvMouseWheel);
//
@ -183,7 +247,7 @@
this.tableLayoutPanelTitle.Name = "tableLayoutPanelTitle";
this.tableLayoutPanelTitle.RowCount = 1;
this.tableLayoutPanelTitle.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.tableLayoutPanelTitle.Size = new System.Drawing.Size(83, 22);
this.tableLayoutPanelTitle.Size = new System.Drawing.Size(129, 22);
this.tableLayoutPanelTitle.TabIndex = 5;
//
// pictureBoxOpenFolder
@ -206,7 +270,7 @@
//
this.pictureBoxMenuAlwaysOpen.BackColor = System.Drawing.Color.Transparent;
this.pictureBoxMenuAlwaysOpen.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
this.pictureBoxMenuAlwaysOpen.Location = new System.Drawing.Point(62, 1);
this.pictureBoxMenuAlwaysOpen.Location = new System.Drawing.Point(108, 1);
this.pictureBoxMenuAlwaysOpen.Margin = new System.Windows.Forms.Padding(1);
this.pictureBoxMenuAlwaysOpen.Name = "pictureBoxMenuAlwaysOpen";
this.pictureBoxMenuAlwaysOpen.Size = new System.Drawing.Size(20, 20);
@ -246,6 +310,8 @@
this.tableLayoutPanelSearch.ResumeLayout(false);
this.tableLayoutPanelSearch.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.pictureBoxSearch)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.pictureBoxFilesCount)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.pictureBoxFoldersCount)).EndInit();
this.tableLayoutPanelMenu.ResumeLayout(false);
this.tableLayoutPanelMenu.PerformLayout();
this.tableLayoutPanelTitle.ResumeLayout(false);
@ -270,5 +336,9 @@
private System.Windows.Forms.TableLayoutPanel tableLayoutPanelTitle;
private System.Windows.Forms.PictureBox pictureBoxOpenFolder;
private System.Windows.Forms.PictureBox pictureBoxMenuAlwaysOpen;
private System.Windows.Forms.Label labelFilesCount;
private System.Windows.Forms.PictureBox pictureBoxFilesCount;
private System.Windows.Forms.PictureBox pictureBoxFoldersCount;
private System.Windows.Forms.Label labelFoldersCount;
}
}

View file

@ -85,6 +85,9 @@ namespace SystemTrayMenu.UserInterface
foreColor = Color.White;
labelTitle.ForeColor = foreColor;
textBoxSearch.ForeColor = foreColor;
ColorConverter colorConverter = new ColorConverter();
labelFoldersCount.ForeColor = (Color)colorConverter.ConvertFromString("#585858");
labelFilesCount.ForeColor = (Color)colorConverter.ConvertFromString("#585858");
titleBackColor = AppColors.DarkModeTitle;
backColor = AppColors.DarkModeBackground;
backColorSearch = AppColors.DarkModeSearchField;
@ -100,6 +103,8 @@ namespace SystemTrayMenu.UserInterface
dgv.BackgroundColor = backColor;
textBoxSearch.BackColor = backColorSearch;
pictureBoxSearch.BackColor = backColorSearch;
pictureBoxFoldersCount.BackColor = backColorSearch;
pictureBoxFilesCount.BackColor = backColorSearch;
tableLayoutPanelSearch.BackColor = backColorSearch;
dgv.DefaultCellStyle = new DataGridViewCellStyle
{
@ -607,7 +612,9 @@ namespace SystemTrayMenu.UserInterface
string filterField = dgv.Columns[1].Name;
SearchTextChanging?.Invoke();
string searchString = textBoxSearch.Text.Trim();
string searchString = textBoxSearch.Text.Trim()
.Replace("%", " ")
.Replace("*", " ");
string like = string.Empty;
string[] splittedParts = searchString.Split(" ");
if (splittedParts.Length > 1)
@ -670,12 +677,26 @@ namespace SystemTrayMenu.UserInterface
data.DefaultView.Sort = columnSortIndex;
}
int foldersCount = 0;
int filesCount = 0;
foreach (DataGridViewRow row in dgv.Rows)
{
RowData rowData = (RowData)row.Cells[2].Value;
rowData.RowIndex = row.Index;
if (rowData.ContainsMenu)
{
foldersCount++;
}
else
{
filesCount++;
}
}
SetCounts(foldersCount, filesCount);
SearchTextChanged.Invoke(this, null);
}
@ -705,6 +726,18 @@ namespace SystemTrayMenu.UserInterface
e.Graphics.DrawImage(Config.BitmapSearch, new Rectangle(Point.Empty, pictureBox.ClientSize));
}
private void PictureBoxFoldersCount_Paint(object sender, PaintEventArgs e)
{
PictureBox pictureBox = (PictureBox)sender;
e.Graphics.DrawImage(Config.BitmapFoldersCount, new Rectangle(Point.Empty, pictureBox.ClientSize));
}
private void PictureBoxFilesCount_Paint(object sender, PaintEventArgs e)
{
PictureBox pictureBox = (PictureBox)sender;
e.Graphics.DrawImage(Config.BitmapFilesCount, new Rectangle(Point.Empty, pictureBox.ClientSize));
}
private void PictureBoxMenuAlwaysOpen_Paint(object sender, PaintEventArgs e)
{
PictureBox pictureBox = (PictureBox)sender;
@ -752,5 +785,11 @@ namespace SystemTrayMenu.UserInterface
UserClickedOpenFolder?.Invoke();
}
}
internal void SetCounts(int foldersCount, int filesCount)
{
labelFoldersCount.Text = foldersCount.ToString();
labelFilesCount.Text = filesCount.ToString();
}
}
}