using System;
using Avalonia.Controls;
using Avalonia.Interactivity;
using Avalonia.Markup.Xaml;
namespace DispenserUI.Views.Windows;
///
/// 用于手动操作输入动打偏移量的弹窗
///
public partial class ManualStrikeOffsetWindow : Window
{
public ManualStrikeOffsetWindow(string title)
{
Title = title;
InitializeComponent();
}
private void InitializeComponent()
{
AvaloniaXamlLoader.Load(this);
}
private void Confirm(object sender, RoutedEventArgs e)
{
var startIndex = this.FindControl("StartIndex")!.Value;
var endIndex = this.FindControl("EndIndex")!.Value;
// 可以传递结果给ShowDialog的调用者
Close(new[] { Convert.ToInt32(startIndex), Convert.ToInt32(endIndex) });
}
private void Cancel(object sender, RoutedEventArgs e)
{
Close(new int[] { });
}
}