Пример #1
0
    public ExampleModule(ExampleNotificationService exampleNotificationService)
    {
      if (exampleNotificationService == null) throw new ArgumentNullException("exampleNotificationService");

      _ExampleNotificationService = exampleNotificationService;

      Get["/"] = x =>
      {
        return ContentModule.GetEmbeddedResource("Nancy.LongPoll.Example.Index.html", Assembly.GetExecutingAssembly());
      };

      Post["/Stop"] = x =>
      {
        _ExampleNotificationService.RunNotifications = false;

        return null;
      };

      Post["/Start"] = x =>
      {
        _ExampleNotificationService.RunNotifications = true;

        return null;
      };
    }
Пример #2
0
        public ExampleModule(ExampleNotificationService exampleNotificationService)
        {
            if (exampleNotificationService == null)
            {
                throw new ArgumentNullException("exampleNotificationService");
            }

            _ExampleNotificationService = exampleNotificationService;

            Get["/"] = x =>
            {
                return(ContentModule.GetEmbeddedResource("Nancy.LongPoll.Example.Index.html", Assembly.GetExecutingAssembly()));
            };

            Post["/Stop"] = x =>
            {
                _ExampleNotificationService.RunNotifications = false;

                return(null);
            };

            Post["/Start"] = x =>
            {
                _ExampleNotificationService.RunNotifications = true;

                return(null);
            };
        }