using LogiBoardToolBox.ViewModels; using Microsoft.UI.Xaml.Media; using Windows.ApplicationModel.DataTransfer; namespace LogiBoardToolBox.Controls; /// A G HUB style phase: horizontal editable actions followed by an insert control. public sealed partial class MacroPhaseView : UserControl { public static readonly DependencyProperty ScriptProperty = DependencyProperty.Register(nameof(Script), typeof(string), typeof(MacroPhaseView), new PropertyMetadata("", Changed)); public static readonly DependencyProperty SegmentProperty = DependencyProperty.Register(nameof(Segment), typeof(string), typeof(MacroPhaseView), new PropertyMetadata("press", Changed)); public static readonly DependencyProperty TitleProperty = DependencyProperty.Register(nameof(Title), typeof(string), typeof(MacroPhaseView), new PropertyMetadata("点击", Changed)); public static readonly DependencyProperty ShowUpDownProperty = DependencyProperty.Register(nameof(ShowUpDown), typeof(bool), typeof(MacroPhaseView), new PropertyMetadata(true, Changed)); public bool ShowUpDown { get => (bool)GetValue(ShowUpDownProperty); set => SetValue(ShowUpDownProperty, value); } public string Script { get => (string)GetValue(ScriptProperty); set => SetValue(ScriptProperty, value); } public string Segment { get => (string)GetValue(SegmentProperty); set => SetValue(SegmentProperty, value); } public string Title { get => (string)GetValue(TitleProperty); set => SetValue(TitleProperty, value); } public event EventHandler? RecordRequested; private MainPageViewModel Model => App.MouseWorkspace; private readonly StackPanel actions = new() { Orientation = Orientation.Horizontal, Spacing = 12, Padding = new(24, 20, 12, 6) }; private readonly TextBlock title = new() { FontSize = 12, Foreground = new SolidColorBrush(Microsoft.UI.Colors.White) }; internal const int StepsPerPage = 96; private int page; private readonly TextBlock pageText = new() { VerticalAlignment = VerticalAlignment.Center, FontSize = 12 }; private readonly Button previous = new() { Content = "上一段", Padding = new(8, 3, 8, 3) }; private readonly Button next = new() { Content = "下一段", Padding = new(8, 3, 8, 3) }; private readonly StackPanel pager = new() { Orientation = Orientation.Horizontal, Spacing = 10 }; internal int RenderedActionCount => actions.Children.OfType