demo_trade/Views/OrderManagerControl.axaml.cs
2024-10-04 15:41:04 +03:00

36 lines
1.2 KiB
C#

using Avalonia;
using Avalonia.Controls;
using Avalonia.Markup.Xaml;
using Avalonia.ReactiveUI;
using demo_trade.ViewModels;
using ReactiveUI;
namespace demo_trade;
public partial class OrderManagerControl : ReactiveUserControl<OrderManagerViewModel>
{
public OrderManagerControl()
{
this.WhenActivated(disposables => { });
AvaloniaXamlLoader.Load(this);
}
private void DeliveryDatePicker_SelectedDateChanged(object? sender, Avalonia.Controls.DatePickerSelectedValueChangedEventArgs e)
{
var datePicker = (DatePicker)sender;
int? orderId = datePicker.Tag as int?;
if (orderId != null && datePicker.SelectedDate != null && datePicker.IsEnabled) {
ViewModel.OrderDateChanged(orderId.Value, datePicker.SelectedDate.Value);
}
}
private void StatusComboBox_SelectionChanged(object? sender, Avalonia.Controls.SelectionChangedEventArgs e)
{
var comboBox = (ComboBox)sender;
int? orderId = comboBox.Tag as int?;
if (orderId != null && comboBox.SelectedIndex > 0 && comboBox.IsEnabled)
{
ViewModel.OrderStatusChanged(orderId.Value, comboBox.SelectedIndex);
}
}
}