public void UnsubscribeFromEvents()
        {
            Logger.Info(string.Format("WCFCeBackupService::UnsubscribeFromEvents()"));
            CeBackupServerManager.Instance.BackupEvent  -= CeBackupServerManager_OnBackup;
            CeBackupServerManager.Instance.CleanupEvent -= CeBackupServerManager_OnCleanup;

            IBackupNotifications callbacks = OperationContext.Current.GetCallbackChannel <IBackupNotifications>();

            if (callbacks != null)
            {
                OnBackup  -= callbacks.OnBackup;
                OnCleanup -= callbacks.OnCleanup;
            }
        }
        public void SubscribeForEvents()
        {
            Logger.Info(string.Format("WCFCeBackupService::SubscribeForEvents()"));
            CeBackupServerManager.Instance.BackupEvent  += CeBackupServerManager_OnBackup;
            CeBackupServerManager.Instance.CleanupEvent += CeBackupServerManager_OnCleanup;

            IBackupNotifications callbacks = OperationContext.Current.GetCallbackChannel <IBackupNotifications>();

            OnBackup  += callbacks.OnBackup;
            OnCleanup += callbacks.OnCleanup;

            ICommunicationObject obj = (ICommunicationObject)callbacks;

            obj.Closed += ObjClosed;
        }
예제 #3
0
        public DuplexChannelFactory <IWCFCeBackupService> CreateBackupFactory(string url, IBackupNotifications eventTarget)
        {
            DuplexChannelFactory <IWCFCeBackupService> backupFactory = null;

            try
            {
                Binding         binding = ServiceSettings.Instance.CreateBinding();
                EndpointAddress ep      = new EndpointAddress(url);
                backupFactory = new DuplexChannelFactory <IWCFCeBackupService>(eventTarget, binding, ep);
            }
            catch (Exception e)
            {
                Logger.Error("ChannelFactory.CreateBackupFactory: Failed to create backup factory", e);
            }

            return(backupFactory);
        }