Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Runtime.Serialization;
- using System.ServiceModel;
- using System.Text;
- using System.Threading;
- namespace WcfServiceLibrary2
- {
- // NOTE: You can use the "Rename" command on the "Refactor" menu to change the class name "Service1" in both code and config file together.
- [ServiceBehavior(InstanceContextMode = InstanceContextMode.PerSession)]
- public class myCallbackKalkulator : ICallbackKalkulator
- {
- private double result;
- private ICallbackHandler callback = null;
- public myCallbackKalkulator()
- {
- callback = OperationContext.Current.GetCallbackChannel<ICallbackHandler>();
- }
- public void Factorial(double n)
- {
- Console.WriteLine("...call of Factorial({0})", n);
- Thread.Sleep(1000);
- result = 1;
- for (int i = 1; i <= n; i++)
- {
- result *= i;
- }
- callback.FactorialCB(result);
- }
- public void CalcSomething(int sek)
- {
- Console.WriteLine("...call of CalcSomething({0})", sek);
- if (sek < 10)
- {
- Thread.Sleep(sek * 1000);
- }
- else
- {
- Thread.Sleep(1000);
- }
- callback.CalcSomethingCB("Calculations lasted " + (sek + 1) + " second(s)");
- }
- }
- }
Add Comment
Please, Sign In to add comment