Example #1
0
    protected void UnregisterSubcontrolPath(CogEditControlBaseV2 subcontrol)
    {
        CogSubcontrolWatcher cogSubcontrolWatcher = this.FindSubcontrolWatcher(subcontrol);

        if (cogSubcontrolWatcher == null)
        {
            throw new ArgumentException("subcontrol does not have a registered path");
        }
        cogSubcontrolWatcher.Subject = null;
        this.mSubcontrolSubjectWatchers.Remove(cogSubcontrolWatcher);
    }
Example #2
0
    private CogSubcontrolWatcher FindSubcontrolWatcher(CogEditControlBaseV2 subcontrol)
    {
        CogSubcontrolWatcher result = null;

        foreach (CogSubcontrolWatcher mSubcontrolSubjectWatcher in this.mSubcontrolSubjectWatchers)
        {
            if (object.ReferenceEquals(mSubcontrolSubjectWatcher.mSubcontrol, subcontrol))
            {
                return(mSubcontrolSubjectWatcher);
            }
        }
        return(result);
    }
Example #3
0
    protected void RegisterSubcontrolPath(CogEditControlBaseV2 subcontrol, string path)
    {
        CogSubcontrolWatcher subW = new CogSubcontrolWatcher(null, path, subcontrol);

        subW.Changed      += this.WatcherHandler;
        subcontrol.Enabled = false;
        this.mSubcontrolSubjectWatchers.Add(subW);
        if (this.SubjectInUse)
        {
            this.mPropertyProvider.LoopSafeDelegateQueue.Enqueue(new DelegateQueueItem((MethodInvoker) delegate
            {
                subW.Subject = this.mSubject;
            }, null));
        }
        else
        {
            subW.Subject = this.mSubject;
        }
    }
Example #4
0
 private void WatcherHandler(object sender, CogChangedEventArgs e)
 {
     if (base.InvokeRequired)
     {
         base.Invoke(new CogChangedEventHandler(this.WatcherHandler), sender, e);
     }
     else
     {
         using (this.mSafeFlag.StartUsing())
         {
             this.ProcessLoopSafeQueuedDelegates();
             if (!base.IsDisposed)
             {
                 CogSubcontrolWatcher cogSubcontrolWatcher = (CogSubcontrolWatcher)sender;
                 if ((e.StateFlags & 0x20) != 0)
                 {
                     cogSubcontrolWatcher.mSubcontrol.Enabled = cogSubcontrolWatcher.IsConnected;
                 }
                 if ((e.StateFlags & 8) != 0)
                 {
                     if (cogSubcontrolWatcher.Subject == null)
                     {
                         cogSubcontrolWatcher.mSubcontrol.SetSubjectAndInitialize(null);
                     }
                     else
                     {
                         object subjectAndInitialize = null;
                         try
                         {
                             subjectAndInitialize = cogSubcontrolWatcher.Value;
                         }
                         catch (Exception)
                         {
                         }
                         cogSubcontrolWatcher.mSubcontrol.SetSubjectAndInitialize(subjectAndInitialize);
                     }
                 }
             }
         }
     }
 }