using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; 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 System.Windows.Threading; namespace FLY.IBC.UI.Client.UIModule { /// /// Page_Main.xaml 的交互逻辑 /// public partial class Page_Main : Page { FLY.IBC.Client.IBCSystemClient iBCSystemClient; FLY.OBJComponents.Client.SetPLCUpdatePlan setPlan; public Page_Main() { InitializeComponent(); } public void Init(int id) { iBCSystemClient = TDGage.Current.mIBCSystemService; grid_ibc.DataContext = iBCSystemClient.Item; setPlan = new FLY.OBJComponents.Client.SetPLCUpdatePlan( iBCSystemClient.PLCos, iBCSystemClient.Item, new string[] { "IsIBCAuto", "FilmWidth", "FilmWidthSet", "IsFilmWidthChanged", "ErrorCorrection", "IsInletAirOn", "InletAirFreq", "InletAirFreqSet", "IsOutletAirOn", "OutletAirFreq", "OutletAirFreqSet", "IsOutletAirFreqChanged" }); ibcCtrlGraph.Init(); iBCSystemClient.Item.PropertyChanged += Item_PropertyChanged; } private async void Item_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e) { if (iBCSystemClient.IsInPushValue) return; if (e.PropertyName == "FilmWidthSet") { await Task.Delay(1000);//1s后触发通知 iBCSystemClient.Item.IsFilmWidthChanged = true; } else if (e.PropertyName == "OutletAirFreqSet") { await Task.Delay(1000);//1s后触发通知 iBCSystemClient.Item.IsOutletAirFreqChanged = true; } } private void button_inletAir_plus_Click(object sender, RoutedEventArgs e) { if (iBCSystemClient.Item.InletAirFreqSet < 49.9) iBCSystemClient.Item.InletAirFreqSet += 0.1f; } private void button_inletAir_minus_Click(object sender, RoutedEventArgs e) { if(iBCSystemClient.Item.InletAirFreqSet>0.1) iBCSystemClient.Item.InletAirFreqSet -= 0.1f; } private void button_outletAir_plus_Click(object sender, RoutedEventArgs e) { if (iBCSystemClient.Item.OutletAirFreqSet < 49.9) iBCSystemClient.Item.OutletAirFreqSet += 0.1f; } private void button_outletAir_minus_Click(object sender, RoutedEventArgs e) { if(iBCSystemClient.Item.OutletAirFreqSet>0.1) iBCSystemClient.Item.OutletAirFreqSet -= 0.1f; } private void button_k123_Click(object sender, RoutedEventArgs e) { Window_K123 w = new Window_K123(); w.Owner = FLY.ControlLibrary.COMMON.GetWindow(this); w.ShowDialog(); } } public class ToggleButtonText { public string IsCheckText { get; set; } public string NoCheckText { get; set; } } public class UIModule_Main : FLY.UI.Module.IUIModule { /// /// 控件标题 /// 它的值取决于culture /// public string Title { get { return "IBC主界面"; } } /// /// 控件 /// 创建时,需要给它唯一ID,让加载自己的数据 /// /// /// public FrameworkElement GetComponent(int id) { Page_Main graph = new Page_Main(); graph.Init(id); return graph; } /// /// 控件缩略图,用于编辑界面时,大致看看 /// 创建时,需要给它唯一ID,让加载自己的数据 /// /// /// public FrameworkElement GetThumbnail(int id) { return new System.Windows.Controls.Grid(); } /// /// 给出全部控件ID, 控件自行删除没有的参数 /// /// public void MatchParam(int[] IDs) { } } }