using System.Windows.Controls;
using Muchinfo.MTPClient.Delivery.ViewModels;
using System.Windows;
using System.Windows.Input;
using Xceed.Wpf.Toolkit;
using Muchinfo.MTPClient.Infrastructure.Helpers;
using Muchinfo.MTPClient.Data.Enums;
using Muchinfo.MTPClient.Data.Model.Delivery;
namespace Muchinfo.MTPClient.Delivery.Views
{
///
/// Description for DeliveryOrderView.
///
public partial class DeliveryOrderView : Window
{
///
/// Initializes a new instance of the DeliveryOrderView class.
///
public DeliveryOrderView()
{
InitializeComponent();
this.DataContext = new DeliveryOrderViewModel();
//MessengerHelper.DefaultRegister(this, MessengerTokens.DeliveryBuyOrSellChanged, BuyOrSellChangedEvent);
}
public DeliveryOrderView(DeliveryOrderMessage info)
{
InitializeComponent();
this.DataContext = new DeliveryOrderViewModel(info);
}
public void drag_MouseLeftButtonDown(object sender, MouseButtonEventArgs args)
{
this.DragMove();
}
public void CloseWindow(object sender, RoutedEventArgs args)
{
this.Close();
}
private void DecimalUpDown_KeyDown(object sender, KeyEventArgs e)
{
var txtInput = (DecimalUpDown)sender;
if ((e.Key >= Key.NumPad0 && e.Key <= Key.NumPad9) || (e.Key >= Key.D0 && e.Key <= Key.D9 ))
{
if (txtInput.Text.Length >= 6)
{
e.Handled = true;
}
else
{
e.Handled = false;
}
}
else
{
e.Handled = true;
}
}
}
}