using GalaSoft.MvvmLight;
using GalaSoft.MvvmLight.Command;
using Muchinfo.MTPClient.Data;
using Muchinfo.MTPClient.Infrastructure.Helpers;
using Muchinfo.MTPClient.Infrastructure.Utilities;
using Muchinfo.MTPClient.IService;
using Muchinfo.MTPClient.Resources;
using System;
//----------------------------------------------------------------
//Module Name: $safeprojectname$
//Purpose:
//CopyRight: Muchinfo
//History:
//----------------------------------------------------------------
//DateTime 2016/4/16 13:44:50
//Author
//Description Create
//----------------------------------------------------------------
using System.Windows;
namespace Muchinfo.MTPClient.Infrastructure.Windows
{
public abstract class QueryPanelModelBase : ViewModelBase, IOrderRefresh
{
private bool _isBusy;
///
/// 是否在忙
///
public bool IsBusy
{
get { return _isBusy; }
set
{
Set(() => IsBusy, ref _isBusy, value);
}
}
///
/// 刷新
///
public virtual RelayCommand RefreshCommand
{
get
{
return new RelayCommand(() =>
{
RefreshContent();
});
}
}
///
/// 单据注册消息
///
public abstract void RegisterMessage();
///
/// 销毁消息
///
public virtual void UnRegisterMessage()
{
// MessengerHelper.DefaultUnregister(this);
}
///
/// 刷新数据
///
public abstract void RefreshContent();
public virtual void QueryErrorCallback(ErrorEntity errorEntity)
{
IsBusy = false;
Application.Current.Dispatcher.BeginInvoke(new Action(() =>
{
ErrorManager.ShowReturnError(errorEntity, Client_Resource.APP_Tips, false);
}));
}
///
/// 刷新数据
///
public void Refresh()
{
RefreshContent();
}
///
/// Cleanups this instance.
///
public override void Cleanup()
{
////取消注册消息
base.Cleanup();
MessengerHelper.QuoteUnregister(this);
}
}
}