Skip to content
This repository has been archived by the owner on Aug 27, 2022. It is now read-only.

Commit

Permalink
Fix NavogationButton close method
Browse files Browse the repository at this point in the history
  • Loading branch information
FrediKats committed Jan 12, 2019
1 parent 0325b58 commit 5554751
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
6 changes: 3 additions & 3 deletions LimpStats.Client/CustomControls/NavigateButton.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,21 @@ namespace LimpStats.Client.CustomControls
public partial class NavigateButton : UserControl
{
private readonly IViewNavigateService _navigateService;
private readonly UserControl _currentControl;
public readonly UserControl CurrentControl;

public NavigateButton(string viewName, IViewNavigateService navigateService, UserControl block)
{
InitializeComponent();

_navigateService = navigateService;
_currentControl = block;
CurrentControl = block;

OpenViewButton.DataContext = viewName;
}

private void ShowUserControl(object sender, RoutedEventArgs e)
{
_navigateService.OpenView(_currentControl);
_navigateService.OpenView(CurrentControl);
}

private void RemoveFromListButton(object sender, RoutedEventArgs e)
Expand Down
5 changes: 5 additions & 0 deletions LimpStats.Client/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ public MainWindow()
public void RemoveButton(NavigateButton button)
{
NavigatePanel.Children.Remove(button);
if (MainWindowContent.Content == button.CurrentControl.Content)
{
MainWindowContent.Visibility = Visibility.Hidden;
}
//TODO: implement closing content window
}

Expand All @@ -31,6 +35,7 @@ public void AddToViewList(string viewTitle, UserControl view)

public void OpenView(UserControl view)
{
MainWindowContent.Visibility = Visibility.Visible;
MainWindowContent.Content = view.Content;
}

Expand Down

0 comments on commit 5554751

Please sign in to comment.