Exemplo n.º 1
0
        private void CControl_SizeChanged(object sender, EventArgs e)
        {
            CControl cc = sender as CControl;

            if (cc != null & cc.InnerControl != null)
            {
                UpdateSize(cc.Size);
            }
        }
Exemplo n.º 2
0
        /// <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);
        }
Exemplo n.º 3
0
        /// <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);
            }
        }
Exemplo n.º 4
0
 public void changeCC(ref CControl cc)
 {
     CC = cc;
 }
Exemplo n.º 5
0
 public TagObserver(ref CControl cc, CCTag tag, Subject <ReadTagResult> subject)
 {
     CC      = cc;
     Tag     = tag;
     Subject = subject;
 }