1
0
Fork 0
mirror of https://github.com/hawkeye-stan/msfs-popout-panel-manager.git synced 2024-11-25 15:20:10 +00:00
msfs-popout-panel-manager/MainApp/UserControl/ProfileCardList.xaml.cs
2023-07-12 18:47:24 -04:00

39 lines
1.2 KiB
C#

using Microsoft.Extensions.DependencyInjection;
using MSFSPopoutPanelManager.MainApp.ViewModel;
using System;
using System.Windows.Controls;
namespace MSFSPopoutPanelManager.MainApp
{
public partial class ProfileCardList : UserControl
{
private ProfileCardListViewModel _viewModel;
public ProfileCardList()
{
_viewModel = App.AppHost.Services.GetRequiredService<ProfileCardListViewModel>();
InitializeComponent();
Loaded += (sender, e) =>
{
DataContext = _viewModel;
_viewModel.OnProfileSelected += (sender, e) =>
{
PopupBoxFinder.StaysOpen = false;
PopupBoxFinder.IsPopupOpen = false;
};
};
}
private void BtnPopupBoxFinder_Click(object sender, System.Windows.RoutedEventArgs e)
{
PopupBoxFinder.IsPopupOpen = !PopupBoxFinder.IsPopupOpen;
PopupBoxFinder.StaysOpen = PopupBoxFinder.IsPopupOpen;
if (PopupBoxFinder.IsPopupOpen)
{
ComboBoxSearchProfile.Text = null;
ComboBoxSearchProfile.Focus();
}
}
}
}