1
0
Fork 0
mirror of https://github.com/hawkeye-stan/msfs-popout-panel-manager.git synced 2024-10-16 14:10:45 +00:00
msfs-popout-panel-manager/MainApp/AppUserControl/ProfileCardList.xaml.cs

43 lines
1.3 KiB
C#
Raw Permalink Normal View History

2024-02-28 02:44:21 +00:00
using Microsoft.Extensions.DependencyInjection;
using MSFSPopoutPanelManager.MainApp.ViewModel;
using System.ComponentModel;
using System.Windows;
namespace MSFSPopoutPanelManager.MainApp.AppUserControl
{
public partial class ProfileCardList
{
private readonly ProfileCardListViewModel _viewModel;
public ProfileCardList()
{
InitializeComponent();
if (DesignerProperties.GetIsInDesignMode(new DependencyObject()))
return;
_viewModel = App.AppHost.Services.GetRequiredService<ProfileCardListViewModel>();
Loaded += (_, _) =>
{
DataContext = _viewModel;
_viewModel.OnProfileSelected += (_, _) =>
{
PopupBoxFinder.StaysOpen = false;
PopupBoxFinder.IsPopupOpen = false;
};
};
}
private void BtnPopupBoxFinder_Click(object sender, RoutedEventArgs e)
{
PopupBoxFinder.IsPopupOpen = !PopupBoxFinder.IsPopupOpen;
PopupBoxFinder.StaysOpen = PopupBoxFinder.IsPopupOpen;
if (PopupBoxFinder.IsPopupOpen)
{
ComboBoxSearchProfile.Text = null;
ComboBoxSearchProfile.Focus();
}
}
}
}