public override void Dispose() { if (_isDisposed) { return; } if (IsEnabled) { Disable(); } try { OverlayWindow?.Hide(); OverlayWindow?.Close(); } catch (Exception ex) { ex.Log("Ошибка в OverlayLayer.Dispose() на строке OverlayWindow.Hide() или Close()"); } OverlayWindow = null; _tickEngine.Stop(); Settings.Save(); base.Dispose(); _isDisposed = true; }
internal void Hide() { if (_window != null) { _window.Hide(); } }
// Clear objects public override void Dispose() { if (_isDisposed) { return; } if (IsEnabled) { Disable(); } Application.Current.Dispatcher.Invoke((Action) delegate { try { OverlayWindow.Hide(); OverlayWindow.Close(); OverlayWindow = null; } catch (NullReferenceException e) { } }); _tickEngine.Stop(); base.Dispose(); _isDisposed = true; }
/// <summary> /// shows the overlay window if the target window is visible and activated(the current window the user is interacting with) /// and hides the overlay window if the is not visible or not activated /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void OnPreTick(object sender, EventArgs e) { var targetWindowIsActivated = TargetWindow.IsActivated; if (!targetWindowIsActivated && OverlayWindow.IsVisible) { ClearScreen(); OverlayWindow.Hide(); } else if (targetWindowIsActivated && !OverlayWindow.IsVisible) { OverlayWindow.Show(); } }
private void OnPreTick(object sender, EventArgs eventArgs) { // Only want to set them up once. if (!_isSetup) { SetUp(); _isSetup = true; return; } var isActive = TargetWindow.IsActivated; var isVisible = !OverlayWindow.IsVisible; //if (visible) //{ //OverlayWindow.Show(); //Ex.Log($"activ={isActive}; visible={isVisible};"); if (isActive) //needToShow { if (true) //isActive { OverlayWindow.Show(); //OverlayWindow.ActivateParent(); needToShow = false; } } if (!isActive) { OverlayWindow.Hide(); needToShow = true; } //if (_firstShow) { OverlayWindow.ActivateParent(); _firstShow = false; } //} //else { OverlayWindow.Hide(); } //Ensure window is shown or hidden correctly prior to updating //if (activated && visible) //{ // OverlayWindow.Show(); // if (!_isSetup) { OverlayWindow.SetFocus(); } //} //else if (!activated && !visible) //{ // OverlayWindow.Hide(); //} }
void OnPreTick(object sender, EventArgs e) { var activated = TargetWindow.IsActivated; var visible = OverlayWindow.IsVisible; // Ensure window is shown or hidden correctly prior to updating if (!activated && visible) { OverlayWindow.Hide(); } else if (activated && !visible) { OverlayWindow.Show(); } }
private void OnPreTick(object?_, EventArgs e) { var targetWindowIsActivated = TargetWindow.IsActivated; switch (targetWindowIsActivated) { case false when OverlayWindow.IsVisible: ClearScreen(); OverlayWindow.Hide(); break; case true when !OverlayWindow.IsVisible: OverlayWindow.Show(); break; } }
// Clear objects public override void Dispose() { if (_isDisposed) { return; } if (IsEnabled) { Disable(); } OverlayWindow.Hide(); OverlayWindow.Close(); OverlayWindow = null; _tickEngine.Stop(); base.Dispose(); _isDisposed = true; }
protected void AdjustVisibility() { if (_window == null) { return; } if (_window.IsVisible == true) { if (InvalidSize == true || Owner.RenderingActive == false) { _window.Hide(); } } else { if (InvalidSize == false && Owner.RenderingActive == true) { _window.Show(); } } }