/// <summary>
 /// Initialize SynchronizationStateManager instance will all default values except the business logic
 /// </summary>
 /// <param name="synchronizationBusinessLogic">The business logic instance provide by the consumer</param>
 public SynchronizationStateManager(ISynchronizationBusinessLogic synchronizationBusinessLogic) :
     this(synchronizationBusinessLogic,
          Defaults.SyncDefaultEndpointConfigurationName,
          Defaults.DefaultSynchronizationMode, Defaults.ReSyncDefaultInterval)
 {
     Contract.Requires <ArgumentNullException>(synchronizationBusinessLogic != null);
 }
 /// <summary>
 /// Initialize SynchronizationStateManager instance will all default values except the business logic and the endpointConfigurationName
 /// </summary>
 /// <param name="synchronizationBusinessLogic">The business logic instance provide by the consumer</param>
 /// <param name="endpointConfigurationName">the endpointConfigurationName that will used to obtain the wcf configuration and create the channel, if not provide the default is SyncDefaultEndpointConfigurationName</param>
 public SynchronizationStateManager(ISynchronizationBusinessLogic synchronizationBusinessLogic,
                                    string endpointConfigurationName) :
     this(synchronizationBusinessLogic,
          endpointConfigurationName,
          Defaults.DefaultSynchronizationMode,
          Defaults.ReSyncDefaultInterval)
 {
     Contract.Requires <ArgumentNullException>(!string.IsNullOrEmpty(endpointConfigurationName));
     Contract.Requires <ArgumentNullException>(synchronizationBusinessLogic != null);
 }
 /// <summary>
 /// Initialize SynchronizationStateManager instance will all default values except the business logic and the endpointConfigurationName
 /// </summary>
 /// <param name="synchronizationBusinessLogic">The business logic instance provide by the consumer</param>
 /// <param name="endpointConfigurationName">the endpointConfigurationName that will used to obtain the wcf configuration and create the channel, if not provide the default is SyncDefaultEndpointConfigurationName</param>
 /// <param name="synchronizationMode">the synchronization mode that will used , if not provide the default is SynchronizationMode.Reliable</param>
 /// <param name="reSyncInterval">The interval in milliseconds that the peer try to re-sync itself - work only when synchronizationMode is Reliable</param>
 public SynchronizationStateManager(ISynchronizationBusinessLogic synchronizationBusinessLogic,
                                    string endpointConfigurationName,
                                    SynchronizationMode synchronizationMode,
                                    double reSyncInterval = Defaults.ReSyncDefaultInterval
                                    )
 {
     Contract.Requires <ArgumentNullException>(synchronizationBusinessLogic != null);
     Contract.Requires <ArgumentNullException>(!string.IsNullOrEmpty(endpointConfigurationName));
     Contract.Requires <ArgumentOutOfRangeException>(synchronizationMode != SynchronizationMode.Reliable || reSyncInterval > 0, Properties.Resources.SynchronizationModeReliableReSyncIntervalBiggerThenZero);
     this.endpointConfigurationName = endpointConfigurationName;
     this.businessLogic             = synchronizationBusinessLogic;
     this.synchronizationMode       = synchronizationMode;
     this.reSyncInterval            = reSyncInterval;
 }
Пример #4
0
 /// <summary>
 /// Initialize the callback instance
 /// </summary>
 /// <param name="synchronizationBusinessLogic">The business logic instance provide by the consumer</param>
 /// <param name="synchronizationMode">the synchronization mode that will used , if not provide the default is SynchronizationMode.Reliable</param>
 /// <param name="reSyncInterval">The interval in milliseconds that the peer try to re-sync itself - work only when synchronizationMode is Reliable</param>
 public SynchronizationCallback(ISynchronizationBusinessLogic synchronizationBusinessLogic,
                                SynchronizationMode synchronizationMode = Defaults.DefaultSynchronizationMode,
                                double reSyncInterval = Defaults.ReSyncDefaultInterval)
 {
     Contract.Requires <ArgumentNullException>(synchronizationBusinessLogic != null);
     Contract.Requires <ArgumentOutOfRangeException>(synchronizationMode != SynchronizationMode.Reliable || reSyncInterval > 0, Properties.Resources.SynchronizationModeReliableReSyncIntervalBiggerThenZero);
     businessLogic            = synchronizationBusinessLogic;
     this.synchronizationMode = synchronizationMode;
     if (synchronizationMode == SynchronizationMode.Reliable)
     {
         reSyncTimer = new Timer(reSyncInterval)
         {
             AutoReset = false
         };
         reSyncTimer.Elapsed += OnSyncTimerElapsed;
     }
 }