Beispiel #1
0
        /// <summary>
        /// Outputs connection information with Debug.DevelInfo
        /// </summary>
        public virtual void DebugConnection()
        {
            string preffix = "  ";

            if (Adaptor.FinalTarget == null)
            {
                return;
            }
            string s = "Control=" + Control + " Target=" + Adaptor.FinalTarget;

            if (TypeValidator.IsCompatible(Adaptor.FinalTarget.GetType(), typeof(IAdaptor)) == true)
            {
                IAdaptor a = (IAdaptor)Adaptor.FinalTarget;
                while (TypeValidator.IsCompatible(a.GetType(), typeof(IAdaptor)) == true)
                {
                    if (a.Control == null)
                    {
                        s = s + "\n" + preffix + "Control=[POINTER] Target=" + a.FinalTarget;
                    }
                    else
                    {
                        s = s + "\n" + preffix + "Control=" + a.Control + " Target=" + a.FinalTarget;
                    }
                    preffix += "  ";
                }
                s = s + "\n" + preffix + "Control=" + a.Control + " Target=" + a.FinalTarget;
            }
            Debug.DevelInfo("ControlAdaptor.DebugConnection (" + Control + ")", s);
        }
Beispiel #2
0
 /// <summary>
 /// Calls controls GetDataFromDataSource, in case of gtk this handles being called
 /// in the right thread
 /// </summary>
 /// <param name="aControl">
 /// Control to call GetDataFromDataSource <see cref="IChangeableControl"/>
 /// </param>
 /// <param name="aSender">
 /// Sender object <see cref="System.Object"/>
 /// </param>
 /// <remarks>
 /// By overriding this method one can handle things differently. Specific
 /// example of this is GTK+ which needs to call control changes in its master thread
 /// </remarks>
 public virtual void InvokeControlAdapteeDataChange(IChangeableControl aControl, object aSender)
 {
     if (TypeValidator.IsCompatible(aControl.GetType(), typeof(ICustomGetData)) == true)
     {
         if (ActivateUserGetData() == true)
         {
             return;
         }
     }
     // Since control will load new values clear flag that data has changed
     DataChanged = false;
     // Transfer data
     aControl.GetDataFromDataSource(aSender);
     if (DisableMappingsDataTransfer == false)
     {
         if (TypeValidator.IsCompatible(adaptor.GetType(), typeof(Adaptor)) == true)
         {
             if ((adaptor as Adaptor).SingleMappingOnly == false)
             {
                 GetValuesFromDataSource();
             }
         }
     }
 }
 /// <summary>
 /// Notifies all connected parties about new Target
 ///
 /// The only ones connected here are ControlAdaptor types which took care
 /// of the controls
 /// </summary>
 /// <param name="aAdaptor">
 /// Calling adaptor <see cref="IAdaptor"/>
 /// </param>
 public void DestinationTargetChanged(IAdaptor aAdaptor)
 {
     if (Active == false)
     {
         return;
     }
     if (destination.FinalTarget != null)
     {
         // Check if this Adaptor is optimal for this type or remake it
         IAdaptorSelector sel = AdaptorSelector.GetCorrectAdaptor(aAdaptor.FinalTarget);
         if (destination.GetType() != sel.GetAdaptorType())
         {
             IAdaptor newdest = sel.CreateAdaptor();
             newdest.Target         = destination.Target;
             newdest.Mappings       = destination.Mappings;
             newdest.DataChanged   += DestinationDataChanged;
             newdest.TargetChanged += DestinationTargetChanged;
             destination.Disconnect();
             destination = newdest;
         }
     }
     TransferData(source, destination);
 }
 /// <summary>
 /// Notifies all connected parties about new Target
 ///
 /// The only ones connected here are ControlAdaptor types which took care
 /// of the controls
 /// </summary>
 /// <param name="aAdaptor">
 /// Calling adaptor <see cref="IAdaptor"/>
 /// </param>
 public void SourceTargetChanged(IAdaptor aAdaptor)
 {
     if (Active == false)
     {
         return;
     }
     if (source.FinalTarget != null)
     {
         // Check if this Adaptor is optimal for this type or remake it
         IAdaptorSelector sel = AdaptorSelector.GetCorrectAdaptor(aAdaptor.FinalTarget);
         if (source.GetType() != sel.GetAdaptorType())
         {
             IAdaptor newsrc = sel.CreateAdaptor();
             newsrc.Target         = source.Target;
             newsrc.Mappings       = source.Mappings;
             newsrc.DataChanged   += SourceDataChanged;
             newsrc.TargetChanged += SourceTargetChanged;
             source.Disconnect();
             source = newsrc;
         }
     }
     TransferData(source, destination);
 }