51 lines
1.4 KiB
C#
51 lines
1.4 KiB
C#
using Livia.Utility.DependencyInjection;
|
|
using Livia.ViewModels;
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
using System.Windows;
|
|
using System.Windows.Input;
|
|
using Microsoft.Extensions.Logging;
|
|
|
|
namespace Livia.Views;
|
|
|
|
/// <summary>
|
|
/// Interaction logic for ValidateSerialKeyDialog.xaml
|
|
/// </summary>
|
|
public partial class ValidateSerialKeyDialog
|
|
{
|
|
private readonly ILogger _logger;
|
|
private readonly ValidateSerialKeyWindowViewModel _viewModel;
|
|
|
|
public ValidateSerialKeyDialog()
|
|
{
|
|
_viewModel = ActivatorUtilities.CreateInstance<ValidateSerialKeyWindowViewModel>(ServiceProviderFactory.ServiceProvider);
|
|
DataContext = _viewModel;
|
|
InitializeComponent();
|
|
_logger = ActivatorUtilities.GetServiceOrCreateInstance<ILogger>(ServiceProviderFactory.ServiceProvider);
|
|
}
|
|
|
|
private void TitleBarMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
|
|
{
|
|
try
|
|
{
|
|
DragMove();
|
|
}
|
|
catch (Exception exception)
|
|
{
|
|
_logger.LogError(exception, "Error dragging window, sender = {sender}, event = {event}", sender, e);
|
|
}
|
|
}
|
|
|
|
private void CopySerialKeyButtonClick(object sender, RoutedEventArgs e)
|
|
{
|
|
_viewModel.CopyHardwareId();
|
|
}
|
|
|
|
private void ConfirmButtonClick(object sender, RoutedEventArgs e)
|
|
{
|
|
if (!_viewModel.Validate())
|
|
return;
|
|
|
|
DialogResult = true;
|
|
Close();
|
|
}
|
|
} |