public static async Task Increment() { if (Interlocked.Increment(ref _count) == 1) { _current = UIThreadHelper.Instance.Invoke(() => new ContainerHost()); await _current.ShowWindowAsync(); } }
public static async Task Decrement() { if (Interlocked.Decrement(ref _count) == 0) { await _current.CloseWindowAsync(); _current = null; } }
public ContainerHost(Window window) { _window = window; _current = this; _firstEmptySlot = 0; HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch; VerticalAlignment = VerticalAlignment.Stretch; _grid = new Grid { RowDefinitions = { new RowDefinition() }, ColumnDefinitions = { new ColumnDefinition() } }; Content = _grid; UpdateWindowSize(); }