Skip to content

Commit

Permalink
Close parent window.
Browse files Browse the repository at this point in the history
  • Loading branch information
C1rdec committed Jan 6, 2020
1 parent 94002bd commit d24dd64
Showing 1 changed file with 21 additions and 4 deletions.
25 changes: 21 additions & 4 deletions src/Lurker.UI/Views/TradebarView.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

namespace Lurker.UI.Views
{
using System;
using System.Windows;
using System.Windows.Controls;

Expand All @@ -14,6 +15,12 @@ namespace Lurker.UI.Views
/// </summary>
public partial class TradebarView : Window
{
#region Fields

private Window _parent;

#endregion

#region Constructors

/// <summary>
Expand All @@ -30,12 +37,22 @@ public TradebarView()

#region Methods

/// <summary>
/// Raises the <see cref="E:System.Windows.Window.Closed" /> event.
/// </summary>
/// <param name="e">An <see cref="T:System.EventArgs" /> that contains the event data.</param>
protected override void OnClosed(EventArgs e)
{
this._parent.Close();
base.OnClosed(e);
}

/// <summary>
/// Hides the window from alt tab.
/// </summary>
private void HideFromAltTab()
{
var newWindow = new Window
this._parent = new Window
{
Top = -100,
Left = -100,
Expand All @@ -46,9 +63,9 @@ private void HideFromAltTab()
ShowInTaskbar = false
};

newWindow.Show();
this.Owner = newWindow;
newWindow.Hide();
this._parent.Show();
this.Owner = this._parent;
this._parent.Hide();
}

/// <summary>
Expand Down

0 comments on commit d24dd64

Please sign in to comment.