Dispenser/DispenserUI/Views/Windows/ManualStrikeOffsetWindow.ax...

37 lines
951 B
C#
Raw Normal View History

2024-08-16 07:20:09 +00:00
using System;
using Avalonia.Controls;
using Avalonia.Interactivity;
using Avalonia.Markup.Xaml;
namespace DispenserUI.Views.Windows;
/// <summary>
/// 用于手动操作输入动打偏移量的弹窗
/// </summary>
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<NumericUpDown>("StartIndex")!.Value;
var endIndex = this.FindControl<NumericUpDown>("EndIndex")!.Value;
// 可以传递结果给ShowDialog的调用者
Close(new[] { Convert.ToInt32(startIndex), Convert.ToInt32(endIndex) });
}
private void Cancel(object sender, RoutedEventArgs e)
{
Close(new int[] { });
}
}