using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Windows; using System.Windows.Controls; using System.Windows.Data; using System.Windows.Documents; using System.Windows.Input; using System.Windows.Media; using System.Windows.Media.Imaging; using System.Windows.Navigation; using System.Windows.Shapes; using FLY.Thick.Base.UI.Converter; using System.Net; using FLY.Thick.Base.Client; using FLY.Thick.Base.Common; using Unity; using FLY.Thick.Base.IService; using System.ComponentModel; using GalaSoft.MvvmLight.Command; using FLY.Thick.Base.UI; namespace FLY.Thick.Blowing.UI.Fix.Client { /// /// Page_FlyAD.xaml 的交互逻辑 /// public partial class PgFlyAd : Page { PgFlyAdVm viewModel; public PgFlyAd() { InitializeComponent(); } [InjectionMethod] public void Init( IUnityContainer container, IFlyADService flyAdService) { viewModel = new PgFlyAdVm(); viewModel.Init(flyAdService); this.DataContext = viewModel; } } public class PgFlyAdVm : INotifyPropertyChanged { public event PropertyChangedEventHandler PropertyChanged; #region 参数 public bool HasCRC { get; set; } public IPEndPoint EP { get; set; } public int PosOfGrid { get; set; } public MOTORTYPE MotorType { set; get; } public UInt16 Ratio01 { get; set; } public UInt16 Ratio02 { get; set; } public Int16 PosOffset { set; get; }//脉冲平移 public UInt32 JogVelocity { set; get; } public int GridSmooth { get; set; } #endregion #region Command public RelayCommand ApplyCmd { get; } #endregion IFlyADService flyAdService; public PgFlyAdVm() { ApplyCmd = new RelayCommand(Apply); } public void Init( IFlyADService flyAdService) { this.flyAdService = flyAdService; Misc.BindingOperations.SetBinding(this.flyAdService, "HasCRC", this, "HasCRC"); Misc.BindingOperations.SetBinding(this.flyAdService, "EP", this, "EP"); Misc.BindingOperations.SetBinding(this.flyAdService, "PosOfGrid", this, "PosOfGrid"); Misc.BindingOperations.SetBinding(this.flyAdService, "MotorType", this, "MotorType"); Misc.BindingOperations.SetBinding(this.flyAdService, "Ratio01", this, "Ratio01"); Misc.BindingOperations.SetBinding(this.flyAdService, "Ratio02", this, "Ratio02"); Misc.BindingOperations.SetBinding(this.flyAdService, "PosOffset", this, "PosOffset"); Misc.BindingOperations.SetBinding(this.flyAdService, "JogVelocity", this, "JogVelocity"); Misc.BindingOperations.SetBinding(this.flyAdService, "GridSmooth", this, "GridSmooth"); } private void Apply() { if (!WdPassword.Authorize("FlyAd")) return; flyAdService.HasCRC=this.HasCRC; flyAdService.EP=this.EP; flyAdService.PosOfGrid=this.PosOfGrid; flyAdService.MotorType=this.MotorType; flyAdService.Ratio01=this.Ratio01; flyAdService.Ratio02=this.Ratio02; flyAdService.PosOffset=this.PosOffset; flyAdService.JogVelocity=this.JogVelocity; flyAdService.GridSmooth = this.GridSmooth; flyAdService.Apply(); FLY.ControlLibrary.Window_Tip.Show("应用成功", null, TimeSpan.FromSeconds(2)); } } }