Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public interface ClientInterface
- {
- [OperationContract]
- void OnCallback(object aUpdatedObject);
- }
- [ServiceContract(SessionMode=SessionMode.Required,
- CallbackContract=typeof(ClientInterface))]
- public interface RequestInterface
- {
- [OperationContract]
- void Subscribe();
- /* */
- [OperationContract]
- TransmissionClass GetInterface();
- }
- [KnownType(typeof(TransmissionClass))]
- public class RequestHandler : RequestInterface
- {
- private static int MAXIMUM = 32760;
- internal static RequestHandler Instance;
- private List<ClientInterface> iClients = new List<ClientInterface>();
- ClientInterface channel;
- public RequestHandler()
- {
- Instance = this;
- }
- public TransmissionClass GetInterface()
- {
- Form1.AddText("method invoked by:" + Thread.CurrentContext.ToString());
- List<MySubInterface> tList = new List<MySubInterface>();
- for(int i = MAXIMUM; i >= 0; i--)
- {
- tList.Add(new TransmissionSubclass(i));
- }
- MAXIMUM += 1;
- /* */
- TransmissionClass tTC = new TransmissionClass("invokedMethod", tList);
- Form1.AddText("created:" + tTC);
- return tTC;
- }
- public void Subscribe()
- {
- channel = OperationContext.Current.GetCallbackChannel<ClientInterface>();
- }
- public void Send()
- {
- try
- {
- channel.OnCallback("I love deadlines. I like the whooshing sound they make as they fly by.");
- }
- catch (Exception ex)
- {
- Form1.AddText(ex.GetType() + "|" + ex.Message);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement