mirror of
https://github.com/Hofknecht/SystemTrayMenu.git
synced 2024-05-21 21:02:47 +12:00
[Feature] Refresh root folder on change of contents (#330), version 1.2.9.22
This commit is contained in:
parent
e4c297e333
commit
1ec1842bb0
|
@ -1334,20 +1334,21 @@ namespace SystemTrayMenu.Business
|
|||
{
|
||||
try
|
||||
{
|
||||
DataRow rowToRemove = null;
|
||||
List<DataRow> rowsToRemove = new List<DataRow>();
|
||||
DataGridView dgv = menus[0].GetDataGridView();
|
||||
DataTable dataTable = (DataTable)dgv.DataSource;
|
||||
foreach (DataRow row in dataTable.Rows)
|
||||
{
|
||||
RowData rowData = (RowData)row[2];
|
||||
if (rowData.Path == e.FullPath)
|
||||
if (rowData.Path == e.FullPath ||
|
||||
rowData.Path.StartsWith($"{e.FullPath}\\"))
|
||||
{
|
||||
IconReader.RemoveIconFromCache(rowData.Path);
|
||||
rowToRemove = row;
|
||||
rowsToRemove.Add(row);
|
||||
}
|
||||
}
|
||||
|
||||
if (rowToRemove != null)
|
||||
foreach (DataRow rowToRemove in rowsToRemove)
|
||||
{
|
||||
dataTable.Rows.Remove(rowToRemove);
|
||||
}
|
||||
|
|
|
@ -211,25 +211,32 @@ namespace SystemTrayMenu.DataClasses
|
|||
DirectoryInfo[] dir = new DirectoryInfo[1];
|
||||
dir[0] = new DirectoryInfo(Path);
|
||||
ctxMnu.ShowContextMenu(dir, point);
|
||||
|
||||
// Triggers filewatcher change event
|
||||
string parentFolder = System.IO.Path.GetDirectoryName(Path);
|
||||
Directory.GetFiles(parentFolder);
|
||||
TriggerFileWatcherChangeWorkaround();
|
||||
}
|
||||
else
|
||||
{
|
||||
FileInfo[] arrFI = new FileInfo[1];
|
||||
arrFI[0] = FileInfo;
|
||||
ctxMnu.ShowContextMenu(arrFI, point);
|
||||
|
||||
// Triggers filewatcher change event
|
||||
string parentFolder = System.IO.Path.GetDirectoryName(Path);
|
||||
Directory.GetFiles(parentFolder);
|
||||
TriggerFileWatcherChangeWorkaround();
|
||||
}
|
||||
|
||||
IsContextMenuOpen = false;
|
||||
contextMenuClosed = DateTime.Now;
|
||||
}
|
||||
|
||||
void TriggerFileWatcherChangeWorkaround()
|
||||
{
|
||||
try
|
||||
{
|
||||
string parentFolder = System.IO.Path.GetDirectoryName(Path);
|
||||
Directory.GetFiles(parentFolder);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Log.Warn($"{nameof(TriggerFileWatcherChangeWorkaround)} '{Path}'", ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
internal void MouseClick(MouseEventArgs e, out bool toCloseByDoubleClick)
|
||||
|
|
|
@ -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.2.9.21")]
|
||||
[assembly: AssemblyFileVersion("1.2.9.21")]
|
||||
[assembly: AssemblyVersion("1.2.9.22")]
|
||||
[assembly: AssemblyFileVersion("1.2.9.22")]
|
||||
|
|
Loading…
Reference in a new issue