mirror of
https://github.com/Hofknecht/SystemTrayMenu.git
synced 2024-06-01 10:09:34 +12:00
Fix position calculation on watcher updates
This commit is contained in:
parent
3f92b082c2
commit
1d0741d54e
|
@ -644,6 +644,14 @@ namespace SystemTrayMenu.Business
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void AdjustLocationOnWatcherUpdate(Menu menu)
|
||||||
|
{
|
||||||
|
// Force refresh of view, let layout settle and then update position based on new size
|
||||||
|
menu.RefreshDataGridView();
|
||||||
|
menu.UpdateLayout();
|
||||||
|
AdjustMenusSizeAndLocation(menu.Level);
|
||||||
|
}
|
||||||
|
|
||||||
private void ExecuteWatcherHistory()
|
private void ExecuteWatcherHistory()
|
||||||
{
|
{
|
||||||
foreach (var fileSystemEventArgs in watcherHistory)
|
foreach (var fileSystemEventArgs in watcherHistory)
|
||||||
|
@ -720,8 +728,6 @@ namespace SystemTrayMenu.Business
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
rowDatas = DirectoryHelpers.SortItems(rowDatas);
|
|
||||||
|
|
||||||
if (menu.SelectedItem != null)
|
if (menu.SelectedItem != null)
|
||||||
{
|
{
|
||||||
menu.SelectedItem = null;
|
menu.SelectedItem = null;
|
||||||
|
@ -729,8 +735,11 @@ namespace SystemTrayMenu.Business
|
||||||
menu.RefreshSelection();
|
menu.RefreshSelection();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Apply list changes
|
||||||
|
rowDatas = DirectoryHelpers.SortItems(rowDatas);
|
||||||
menu.AddItemsToMenu(rowDatas, null);
|
menu.AddItemsToMenu(rowDatas, null);
|
||||||
AdjustMenusSizeAndLocation(menu.Level);
|
|
||||||
|
AdjustLocationOnWatcherUpdate(menu);
|
||||||
menu.OnWatcherUpdate();
|
menu.OnWatcherUpdate();
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
|
@ -763,12 +772,10 @@ namespace SystemTrayMenu.Business
|
||||||
menu.RefreshSelection();
|
menu.RefreshSelection();
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (RowData rowToRemove in rowsToRemove)
|
// Apply list changes
|
||||||
{
|
((List<RowData>)dgv.ItemsSource).RemoveAll(rowsToRemove.Contains);
|
||||||
((List<RowData>)dgv.ItemsSource).Remove(rowToRemove);
|
|
||||||
}
|
|
||||||
|
|
||||||
AdjustMenusSizeAndLocation(menu.Level);
|
AdjustLocationOnWatcherUpdate(menu);
|
||||||
menu.OnWatcherUpdate();
|
menu.OnWatcherUpdate();
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
|
@ -801,9 +808,11 @@ namespace SystemTrayMenu.Business
|
||||||
rowDatas.Add(item);
|
rowDatas.Add(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Apply list changes
|
||||||
rowDatas = DirectoryHelpers.SortItems(rowDatas);
|
rowDatas = DirectoryHelpers.SortItems(rowDatas);
|
||||||
menu.AddItemsToMenu(rowDatas, null);
|
menu.AddItemsToMenu(rowDatas, null);
|
||||||
AdjustMenusSizeAndLocation(menu.Level);
|
|
||||||
|
AdjustLocationOnWatcherUpdate(menu);
|
||||||
menu.OnWatcherUpdate();
|
menu.OnWatcherUpdate();
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
|
|
Loading…
Reference in a new issue