private void CControl_SizeChanged(object sender, EventArgs e) { CControl cc = sender as CControl; if (cc != null & cc.InnerControl != null) { UpdateSize(cc.Size); } }
/// <summary> /// 取得所有存活下来的CControl /// </summary> public static Dictionary <string, CControl> GetAlives() { Dictionary <string, CControl> alives = new Dictionary <string, CControl>(); foreach (string key in CControls.Keys) { CControl control = CControls[key]; if (control != null & control.IsHandleCreated) { alives[key] = CControls[key]; } } return(alives); }
/// <summary> /// 添加变量监视 /// </summary> /// <param name="tagObserver"></param> /// <param name="tag"></param> public static void AddTagRx(CControl tagObserver, CCTag tag) { if (!HotTags.ContainsKey(tag.Name)) { Subject <ReadTagResult> tagSubject = new Subject <ReadTagResult>(); IObservable <long> tagTimer = GetOrCreateTimer(tag.AcquisitionCycle); TagObserver tagTimerObser = new TagObserver(ref tagObserver, tag, tagSubject); IObservable <ReadTagResult> hotTag = tagTimerObser.Publish().RefCount(); HotTags[tag.Name] = hotTag; TagObservers[tag.Name] = tagTimerObser; TagTimerObservsers[tag.Name] = tagTimer.Subscribe(tagTimerObser); } else { TagObserver tagTimerObser = TagObservers[tag.Name]; tagTimerObser.changeCC(ref tagObserver); } }
public void changeCC(ref CControl cc) { CC = cc; }
public TagObserver(ref CControl cc, CCTag tag, Subject <ReadTagResult> subject) { CC = cc; Tag = tag; Subject = subject; }