using BBWY.Client.Models; using BBWY.Common.Models; using GalaSoft.MvvmLight.Command; using System; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Windows; using System.Windows.Input; namespace BBWY.Client.ViewModels { public class ServiceOrderViewModel : BaseVM, IDenpendency { private bool isLoading; private ServiceOrderState? serviceOrderState; private ReturnDirection? returnDirection; private int serviceOrderCount; private int pageIndex; private int pageSize; public bool IsLoading { get => isLoading; set { Set(ref isLoading, value); } } public ServiceOrderState? ServiceOrderState { get => serviceOrderState; set { Set(ref serviceOrderState, value); } } public ReturnDirection? ReturnDirection { get => returnDirection; set { Set(ref returnDirection, value); } } public ICommand SetServiceOrderStateCommand { get; set; } public ICommand SetReturnDirectionCommand { get; set; } public ICommand OnPageIndexChangedCommand { get; set; } public ICommand CopyTextCommand { get; set; } public IList ServiceOrderList { get; set; } public int ServiceOrderCount { get => serviceOrderCount; set { Set(ref serviceOrderCount, value); } } public int PageIndex { get => pageIndex; set { Set(ref pageIndex, value); } } public int PageSize { get => pageSize; set { Set(ref pageSize, value); } } public ServiceOrderViewModel() { SetServiceOrderStateCommand = new RelayCommand(SetServiceOrderState); SetReturnDirectionCommand = new RelayCommand(SetReturnDirection); CopyTextCommand = new RelayCommand(s => { try { Clipboard.SetText(s); } catch (Exception ex) { } }); ServiceOrderList = new ObservableCollection() { new ServiceOrder(), new ServiceOrder(), new ServiceOrder() }; } private void SetServiceOrderState(ServiceOrderState? state) { this.ServiceOrderState = state; //query } private void SetReturnDirection(ReturnDirection? returnDirection) { this.ReturnDirection = returnDirection; //query } } }