[ServiceContract(
Name = "ObserverService",
Namespace = "http://VarioBatch/ObserverService/",
SessionMode = SessionMode.Required,
CallbackContract = typeof(IVBObserverCallback))]
public interface IVBObserver
{
[OperationContract()]
int RegisterObserver();
[OperationContract(IsOneWay = true)]
void UnregisterObserver();
}
public interface IVBObserverCallback
{
[OperationContract(IsOneWay = true)]
void ReceiveSPSData(Guid vbO1ProcessCellID, string spsData);
}
public class AppContextClient : ObserverServiceCallback
{
public ObserverServiceClient _VBObserverClient = null;
public AppContextClient()
{
//_VBObserverClient = new ObserverServiceClient(new InstanceContext(this), "HttpBinding");
_VBObserverClient = new ObserverServiceClient(new InstanceContext(this), "TcpBinding");
_VBObserverClient.Open();
}
public override void Start()
{
_VBObserverClient.RegisterObserver();
}
#region ObserverServiceCallback Members
public void ReceiveSPSData(Guid vbO1ProcessCellID, string spsData)
{
System.Diagnostics.Debug.WriteLine(spsData);
}
#endregion
}