demo_trade/Views/OrderShowDialog.axaml.cs

42 lines
1.4 KiB
C#
Raw Normal View History

2024-10-04 12:41:04 +00:00
using Avalonia;
using Avalonia.Controls;
using Avalonia.Dialogs.Internal;
using Avalonia.Markup.Xaml;
using Avalonia.Platform.Storage;
using Avalonia.ReactiveUI;
using demo_trade.ViewModels;
using ReactiveUI;
using System.Collections.Generic;
using Tmds.DBus.Protocol;
namespace demo_trade;
public partial class OrderShowDialog : ReactiveWindow<OrderShowDialogViewModel>
{
public OrderShowDialog()
{
this.WhenActivated(disposables => { });
AvaloniaXamlLoader.Load(this);
}
private void NumericUpDown_ValueChanged(object? sender, Avalonia.Controls.NumericUpDownValueChangedEventArgs e)
{
var numeric = (sender as NumericUpDown);
if (numeric.Tag == null) return;
string? aritcle = numeric.Tag.ToString();
if (numeric.Value == null) return;
ViewModel.NumericChange(aritcle, (int)numeric.Value );
}
private static FilePickerFileType Pdf { get; } = new FilePickerFileType("All pdf") { Patterns = new[] { ".pdf" } };
private async void Save_Click(object? sender, Avalonia.Interactivity.RoutedEventArgs e)
{
var file = await TopLevel.GetTopLevel(this).StorageProvider.SaveFilePickerAsync(new Avalonia.Platform.Storage.FilePickerSaveOptions
{
Title = "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>",
FileTypeChoices = new List<FilePickerFileType> { Pdf }
});
if (file != null) ViewModel!.SaveFile(file.Path.AbsolutePath);
}
}