mirror of
https://github.com/Hofknecht/SystemTrayMenu.git
synced 2024-06-27 18:40:32 +12:00
[BUG] Fix DataGridView Default Error is shown + NullReferenceException (#139), version 1.0.16.2
This commit is contained in:
parent
a2f697a49d
commit
808ab532c9
|
@ -37,6 +37,7 @@ namespace SystemTrayMenu.Business
|
||||||
private RowData loadingRowData = null;
|
private RowData loadingRowData = null;
|
||||||
private bool showingMessageBox = false;
|
private bool showingMessageBox = false;
|
||||||
private TaskbarPosition taskbarPosition = new WindowsTaskbar().Position;
|
private TaskbarPosition taskbarPosition = new WindowsTaskbar().Position;
|
||||||
|
private bool searchTextChanging = false;
|
||||||
|
|
||||||
public Menus()
|
public Menus()
|
||||||
{
|
{
|
||||||
|
@ -484,25 +485,28 @@ namespace SystemTrayMenu.Business
|
||||||
menuToDispose.CmdKeyProcessed -= keyboardInput.CmdKeyProcessed;
|
menuToDispose.CmdKeyProcessed -= keyboardInput.CmdKeyProcessed;
|
||||||
menuToDispose.SearchTextChanging -= keyboardInput.SearchTextChanging;
|
menuToDispose.SearchTextChanging -= keyboardInput.SearchTextChanging;
|
||||||
menuToDispose.SearchTextChanged -= Menu_SearchTextChanged;
|
menuToDispose.SearchTextChanged -= Menu_SearchTextChanged;
|
||||||
DataGridView dgv = menuToDispose.GetDataGridView();
|
DataGridView dgv = menuToDispose?.GetDataGridView();
|
||||||
dgv.CellMouseEnter -= dgvMouseRow.CellMouseEnter;
|
if (dgv != null)
|
||||||
dgv.CellMouseLeave -= dgvMouseRow.CellMouseLeave;
|
|
||||||
dgv.MouseLeave -= dgvMouseRow.MouseLeave;
|
|
||||||
dgv.MouseMove -= waitToOpenMenu.MouseMove;
|
|
||||||
dgv.MouseDown -= Dgv_MouseDown;
|
|
||||||
dgv.MouseDoubleClick -= Dgv_MouseDoubleClick;
|
|
||||||
dgv.SelectionChanged -= Dgv_SelectionChanged;
|
|
||||||
dgv.RowPostPaint -= Dgv_RowPostPaint;
|
|
||||||
dgv.ClearSelection();
|
|
||||||
|
|
||||||
foreach (DataGridViewRow row in dgv.Rows)
|
|
||||||
{
|
{
|
||||||
RowData rowData = (RowData)row.Cells[2].Value;
|
dgv.CellMouseEnter -= dgvMouseRow.CellMouseEnter;
|
||||||
rowData.Dispose();
|
dgv.CellMouseLeave -= dgvMouseRow.CellMouseLeave;
|
||||||
DisposeMenu(rowData.SubMenu);
|
dgv.MouseLeave -= dgvMouseRow.MouseLeave;
|
||||||
|
dgv.MouseMove -= waitToOpenMenu.MouseMove;
|
||||||
|
dgv.MouseDown -= Dgv_MouseDown;
|
||||||
|
dgv.MouseDoubleClick -= Dgv_MouseDoubleClick;
|
||||||
|
dgv.SelectionChanged -= Dgv_SelectionChanged;
|
||||||
|
dgv.RowPostPaint -= Dgv_RowPostPaint;
|
||||||
|
dgv.ClearSelection();
|
||||||
|
|
||||||
|
foreach (DataGridViewRow row in dgv.Rows)
|
||||||
|
{
|
||||||
|
RowData rowData = (RowData)row.Cells[2].Value;
|
||||||
|
rowData?.Dispose();
|
||||||
|
DisposeMenu(rowData.SubMenu);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
menuToDispose.Dispose();
|
menuToDispose?.Dispose();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -613,7 +617,7 @@ namespace SystemTrayMenu.Business
|
||||||
menu.MouseEnter += waitLeave.Stop;
|
menu.MouseEnter += waitLeave.Stop;
|
||||||
menu.KeyPress += keyboardInput.KeyPress;
|
menu.KeyPress += keyboardInput.KeyPress;
|
||||||
menu.CmdKeyProcessed += keyboardInput.CmdKeyProcessed;
|
menu.CmdKeyProcessed += keyboardInput.CmdKeyProcessed;
|
||||||
menu.SearchTextChanging += keyboardInput.SearchTextChanging;
|
menu.SearchTextChanging += Menu_SearchTextChanging;
|
||||||
menu.SearchTextChanged += Menu_SearchTextChanged;
|
menu.SearchTextChanged += Menu_SearchTextChanged;
|
||||||
menu.Deactivate += Deactivate;
|
menu.Deactivate += Deactivate;
|
||||||
void Deactivate(object sender, EventArgs e)
|
void Deactivate(object sender, EventArgs e)
|
||||||
|
@ -719,6 +723,7 @@ namespace SystemTrayMenu.Business
|
||||||
|
|
||||||
private void RefreshSelection(DataGridView dgv)
|
private void RefreshSelection(DataGridView dgv)
|
||||||
{
|
{
|
||||||
|
dgv.SelectionChanged -= Dgv_SelectionChanged;
|
||||||
foreach (DataGridViewRow row in dgv.Rows)
|
foreach (DataGridViewRow row in dgv.Rows)
|
||||||
{
|
{
|
||||||
RowData rowData = (RowData)row.Cells[2].Value;
|
RowData rowData = (RowData)row.Cells[2].Value;
|
||||||
|
@ -752,7 +757,12 @@ namespace SystemTrayMenu.Business
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
dgv.Refresh();
|
dgv.SelectionChanged += Dgv_SelectionChanged;
|
||||||
|
|
||||||
|
if (!searchTextChanging)
|
||||||
|
{
|
||||||
|
dgv.Refresh();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Dgv_RowPostPaint(object sender, DataGridViewRowPostPaintEventArgs e)
|
private void Dgv_RowPostPaint(object sender, DataGridViewRowPostPaintEventArgs e)
|
||||||
|
@ -921,10 +931,17 @@ namespace SystemTrayMenu.Business
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void Menu_SearchTextChanging()
|
||||||
|
{
|
||||||
|
searchTextChanging = true;
|
||||||
|
keyboardInput.SearchTextChanging();
|
||||||
|
}
|
||||||
|
|
||||||
private void Menu_SearchTextChanged(object sender, EventArgs e)
|
private void Menu_SearchTextChanged(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
keyboardInput.SearchTextChanged(sender, e);
|
keyboardInput.SearchTextChanged(sender, e);
|
||||||
AdjustMenusSizeAndLocation();
|
AdjustMenusSizeAndLocation();
|
||||||
|
searchTextChanging = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,5 +39,5 @@ using System.Runtime.InteropServices;
|
||||||
// You can specify all the values or you can default the Build and Revision Numbers
|
// You can specify all the values or you can default the Build and Revision Numbers
|
||||||
// by using the '*' as shown below:
|
// by using the '*' as shown below:
|
||||||
// [assembly: AssemblyVersion("1.0.*")]
|
// [assembly: AssemblyVersion("1.0.*")]
|
||||||
[assembly: AssemblyVersion("1.0.16.1")]
|
[assembly: AssemblyVersion("1.0.16.2")]
|
||||||
[assembly: AssemblyFileVersion("1.0.16.1")]
|
[assembly: AssemblyFileVersion("1.0.16.2")]
|
||||||
|
|
Loading…
Reference in a new issue