public Subscription(WeakEvent <TSender, TEventArgs> ev, TSender target) { _ev = ev; _target = target; _compact = Compact; _unsubscribe = ev._subscribe(target, OnEvent); }
public TNavigateMessage (TAction action, TSender sender, TWhere where, Type typeNavigateTo) { Action = action; Where = where; Sender = sender; TypeNavigateTo = typeNavigateTo; }
private void EventHandlerFilter(TSender sender, TEventArgs e) { if (_sender == null || object.ReferenceEquals(sender, _sender)) { _handler(sender, e); } }
public Channel(UserProtocol <TSender> channel, Func <TSender, uint> identifyCallback, TSender source, TSender target) { this._channel = channel; this._identifyCallback = identifyCallback; this._source = source; this._target = target; this._channel.Receive += this._channel_Receive; }
public static TSender Seek(Connection conn, string ucn, char ucnType) { TSender sender = new TSender(); sender.ucn = ucn; sender.ucnType = ucnType; sender.Get(conn, null); return(sender); }
public Subscription( Event <TSender, TEventArgs> @event, TSender sender, Action <TSender, TEventArgs> handler) { _event = @event; _sender = sender; _handler = handler; _tag = _event.SubscribeCore(sender, EventHandlerFilter); }
private void BGWConn_DoWork(object sender, DoWorkEventArgs e) { //GetData(true); opcServer = new OPCServer(); WriteLog.GetLog().Write("正在尝试连接服务器......"); string[] str = opcServer.Connection(); if (string.IsNullOrWhiteSpace(str[0])) { opcServer.OnlyTaskGroup.addItem(PlcItemCollection.GetOnlyUnnormalItem()); //任务交互区 opcServer.SpyBiaozhiGroup.addItem(PlcItemCollection.GetSpanUnnormalItem()); //监控任务标识位 opcServer.FinishOnlyGroup.addItem(PlcItemCollection.GetFinishUnnormalItem()); //完成信号交互区; WriteLog.GetLog().Write("opC服务器创成功!"); opcServer.ConnectState = opcServer.CheckConnection(); if (opcServer.ConnectState) { GetData(); opcServer.SpyBiaozhiGroup.callback = OnDataChange; opcServer.FinishOnlyGroup.callback = OnDataChange; WriteLog.GetLog().Write("PLC连接成功!"); WriteLog.GetLog().Write("触发定时器"); if (opcServer.SpyBiaozhiGroup.Read(0).ToString() != "1" && !opcServer.IsSendOn)//监控标志位第一组 产生跳变 { opcServer.IsSendOn = true; opcServer.SpyBiaozhiGroup.Write(2, 0); opcServer.SpyBiaozhiGroup.Write(0, 0); ReadFinish(); opcServer.IsSendOn = false; WriteLog.GetLog().Write("发送任务"); } else { WriteLog.GetLog().Write("强制跳变失败"); } } else { WriteLog.GetLog().Write("PLC连接失败!"); databaselinkcheck("plc连接失败"); TSender.Stop(); TRefresh.Stop(); } } else { TSender.Stop(); TRefresh.Stop(); databaselinkcheck("plc连接失败"); WriteLog.GetLog().Write(str[0]); } }
public void Invoke(TSender sender, TData e) { T target = (T)_TargetRef.Target; if (target != null) { _OpenHandler.Invoke(target, sender, e); } else if (_Unregister != null) { _Unregister(_Handler); _Unregister = null; } }
public MainScreen() { InitializeComponent(); //OpenSerialPort(); lbladded = new Label[15] { LblAdded1, LblAdded2, LblAdded3, LblAdded4, LblAdded5, LblAdded6, LblAdded7, LblAdded8, LblAdded9, LblAdded10, LblAdded11, LblAdded12, LblAdded13, LblAdded14, LblAdded15 }; lbladd = new Label[15] { LblAdd1, LblAdd2, LblAdd3, LblAdd4, LblAdd5, LblAdd6, LblAdd7, LblAdd8, LblAdd9, LblAdd10, LblAdd11, LblAdd12, LblAdd13, LblAdd14, LblAdd15 }; try { sp_name = ConfigurationManager.AppSettings["SerialPort"].ToString(); } catch { sp_name = "COM2"; } CheckForIllegalCrossThreadCalls = false; machineSeq = 1; groupNo = 1; lblpack = new Label(); lblpack.BackColor = Color.Transparent; lblpack.Font = new Font("宋体", 10, FontStyle.Bold | FontStyle.Italic); lblpack.Name = "lblpack"; lblpack.Text = "特异型烟道补货顺序"; lblpack.Location = new Point(Convert.ToInt32(64), 7); lblpack.Size = new Size(300, 20); panel1.Controls.Add(lblpack); OpenSerialPort(); TSender.Start(); BGWConn.RunWorkerAsync(); //ProgramAutoRun.SetMeStart(true); try { sortnum = RelenishimentClass.GetMinSortNum(); } catch { } lblSortnum.Text = "当前任务:" + sortnum; GetData(); X = this.Width; //获取窗体的宽度 Y = this.Height; //获取窗体的高度 SetTag(this); //调用方法 }
public MixedThrough() { InitializeComponent(); lbladded = new Label[15] { LblAdded1, LblAdded2, LblAdded3, LblAdded4, LblAdded5, LblAdded6, LblAdded7, LblAdded8, LblAdded9, LblAdded10, LblAdded11, LblAdded12, LblAdded13, LblAdded14, LblAdded15 }; lbladd = new Label[15] { LblAdd1, LblAdd2, LblAdd3, LblAdd4, LblAdd5, LblAdd6, LblAdd7, LblAdd8, LblAdd9, LblAdd10, LblAdd11, LblAdd12, LblAdd13, LblAdd14, LblAdd15 }; sp_name = "COM1"; OpenSerialPort(); machineSeq = 90; groupNo = 2; lblpack = new Label(); lblpack.BackColor = Color.Transparent; lblpack.Font = new Font("宋体", 10, FontStyle.Bold | FontStyle.Italic); CheckForIllegalCrossThreadCalls = false; lblpack.Name = "lblpack"; lblpack.Text = "混合道补货顺序"; lblpack.Location = new Point(Convert.ToInt32(64), 7); lblpack.Size = new Size(300, 20); panel1.Controls.Add(lblpack); TSender.Start(); BGWConn.RunWorkerAsync(); GetData(); ProgramAutoRun.SetMeStart(true); List <MixInfo> list = new List <MixInfo>(); X = this.Width; //获取窗体的宽度 Y = this.Height; //获取窗体的高度 SetTag(this); //调用方法 }
public TModuleNavigateResponseMessage(TSender sender, TWhere where, Type typeNavigateTo) : base(TAction.NavigateTo, sender, where, typeNavigateTo) { }
this TSender sender, Func <EventHandler <TArgs>, THandler> conversion, Action <THandler> subscribe, Action <THandler> unsubscribe) { return(Observable.FromEventPattern(conversion, subscribe, unsubscribe).Select(e => (sender, e.EventArgs)));
public EventEventArg(TSender sender, TResult result) { this.sender = sender; this.result = result; }
public State(Func <TSender, TResult> j, TSender param) { _job = j; Parameter = param; }
public TModuleNavigateRequestMessage(TSender sender, TWhere where) : base(TAction.Request, sender, where) { }
public bool IsSender (TSender sender) { return (Sender == sender); }
public TNavigateMessage (TAction action, TSender sender, TWhere where) { Action = action; Where = where; Sender = sender; }