[BUG] ObjectDisposedException at Fading_Show User32ShowInactiveTopmost (#177)

This commit is contained in:
Markus Hofknecht 2021-05-28 20:48:17 +02:00
parent 30fe44980b
commit 0044b88a79
2 changed files with 22 additions and 22 deletions

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.44")]
[assembly: AssemblyFileVersion("1.0.17.44")]
[assembly: AssemblyVersion("1.0.17.45")]
[assembly: AssemblyFileVersion("1.0.17.45")]

View file

@ -36,34 +36,34 @@ namespace SystemTrayMenu.UserInterface
fading.Show += Fading_Show;
void Fading_Show()
{
if (Level == 0)
try
{
try
{
isShowing = true;
Visible = true;
isShowing = false;
}
catch (ObjectDisposedException)
{
Visible = false;
isShowing = false;
Log.Info($"Could not open menu, old menu was disposing," +
$" IsDisposed={IsDisposed}");
}
isShowing = true;
Visible = true;
isShowing = false;
}
catch (ObjectDisposedException)
{
Visible = false;
isShowing = false;
Log.Info($"Could not open menu, old menu was disposing," +
$" IsDisposed={IsDisposed}");
}
if (Visible)
if (Visible)
{
if (Level == 0)
{
Activate();
textBoxSearch.Focus();
NativeMethods.User32ShowInactiveTopmost(this);
NativeMethods.ForceForegroundWindow(Handle);
}
}
else
{
NativeMethods.User32ShowInactiveTopmost(this);
textBoxSearch.Focus();
else
{
NativeMethods.User32ShowInactiveTopmost(this);
textBoxSearch.Focus();
}
}
}