Exemplo n.º 1
0
        public EventsWatcher(AConfiguration conf, CancellationToken token)
        {
            cancellationToken = token;

            // setup comunication with bot servers
            comunicator.ServersUrls = conf.ServersUrls;
            comunicator.OnRequest  += onServerRequest;
            comunicator.ConnectSubscribers();

            // create service for interecting with data
            eventService = new EventService(conf.ConnectionString, cancellationToken);

            event55Wtch = new EntitieWatcher <Event55>(conf.ConnectionString, filter: event55 => event55.EventCode == 105);
            onChangedEvent55EventHandler = new ChangedEventHandler <Event55>(async(s, e) => await onChanged(s, e));

            event55Wtch.Dependancy.OnChanged       += onChangedEvent55EventHandler;
            event55Wtch.Dependancy.OnStatusChanged += onStatusChanged;
            event55Wtch.Dependancy.OnError         += onError;

            event55Wtch.Start();
        }
Exemplo n.º 2
0
        public void How_to_parse_using_optionSet()
        {
            var config = new AConfiguration();

            var args = new[] {"--name=Gøran", "/age:31", "-male"};
            var optionSet = new OptionSet();
            optionSet.Add("name=", "Parameter is needed", option =>
            {
                config.Name = option;
            });
            optionSet.Add("age:", option =>
            {
                config.Age = int.Parse(option);
            });
            optionSet.Add("male|female", option => config.Gender = option);
            optionSet.Parse(args);

            Assert.AreEqual("Gøran", config.Name);
            Assert.AreEqual(31, config.Age);
            Assert.AreEqual("male", config.Gender);
        }
Exemplo n.º 3
0
        public void How_to_parse_using_optionSet()
        {
            var config = new AConfiguration();

            var args      = new[] { "--name=Gøran", "/age:31", "-male" };
            var optionSet = new OptionSet();

            optionSet.Add("name=", "Parameter is needed", option =>
            {
                config.Name = option;
            });
            optionSet.Add("age:", option =>
            {
                config.Age = int.Parse(option);
            });
            optionSet.Add("male|female", option => config.Gender = option);
            optionSet.Parse(args);

            Assert.AreEqual("Gøran", config.Name);
            Assert.AreEqual(31, config.Age);
            Assert.AreEqual("male", config.Gender);
        }