Esempio n. 1
0
        static void Main(string[] args)
        {
            //InkDemoServiceProxy proxy = new InkDemoServiceProxy();
            //proxy.Open();

            //var result = proxy.Sum (5,5);

            //proxy.Add(new InkDTO() { Name = "Name1", Color = "Black1" });
            //var inks = proxy.GetAll();

            var ruleResolver = new WatchServiceRuleResolver( new List< KeyValuePair<TimeSpan, String>>
                    {
                        new KeyValuePair<TimeSpan, String>(new TimeSpan(0, 0, 0, -3), "Green" + 1),
                        new KeyValuePair<TimeSpan, String>(new TimeSpan(0, 0, 0, -2), "Amber" + 2),
                        new KeyValuePair<TimeSpan, String>(new TimeSpan(0, 0, 0, -1), "Red" + 3),
                        new KeyValuePair<TimeSpan, String>(new TimeSpan(0, 0, 0, 0), "Off" + 4),
                        new KeyValuePair<TimeSpan, String>(new TimeSpan(0, 0, 0, Int32.MaxValue), "Death men" + 5)
                    });

            var range = Enumerable.Range(1, 1).ToList();
            var items = range.Select(x => new Watchable(DateTime.UtcNow.AddSeconds(-10), new TimeSpan(0, 0, 0, 18))).ToList();

            var watchService = new WatchService();
            watchService.AddRules(ruleResolver);
            watchService.Update(items);
            watchService.Start();

            //InstanceContext callbackContext = new InstanceContext(new InkDemoDualCallback());
            //InkDemoDualServiceProxy proxyDual = new InkDemoDualServiceProxy(callbackContext);
            //proxyDual.StartDual();
            //proxyDual.StopDual();

            System.Console.WriteLine("Client is running... Press <Enter> key to stop");
            System.Console.WriteLine("Result: " );
            System.Console.ReadLine();
        }
Esempio n. 2
0
 internal void AddRules(WatchServiceRuleResolver ruleResolver)
 {
     _ruleResolver = ruleResolver;
 }