mirror of
https://github.com/Hofknecht/SystemTrayMenu.git
synced 2024-05-29 08:39:34 +12:00
[BUG] ObjectDisposedException at Fading_Show User32ShowInactiveTopmost (#177)
This commit is contained in:
parent
30fe44980b
commit
0044b88a79
|
@ -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")]
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue