Exemplo n.º 1
0
 /// <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);
 }
Exemplo n.º 2
0
 /// <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);
 }