Exemple #1
0
 public UsageView(ICustomer client, string question = "", bool emptyResponse = false, Style style = null)
 {
     coordinator = CoordinatorManager.Instance.CoordinatorOfType <IServiceCoordinator>();
     #region Precondizioni
     if (client == null)
     {
         throw new ArgumentNullException("client null");
     }
     if (question == null)
     {
         throw new ArgumentNullException("question null");
     }
     if (coordinator == null)
     {
         throw new InvalidOperationException("Il coordinatore degli utilizzi non è disponibile");
     }
     #endregion
     InitializeComponent();
     _client        = client;
     _question.Text = question;
     _emptyResponse = emptyResponse;
     _usageList     = _view;
     _usages        = coordinator.Usages;
     ActiveControl  = _view;
     this.ApplyStyle(style);
 }
        public PacketManagerPresenter(PacketManagerView view)
        {
            #region Precondizioni
            if (view == null)
            {
                throw new ArgumentNullException("view null");
            }
            #endregion
            view.AddButton.Click += AddHandler;

            if (view.RetrieveTagInformation <AuthorizationLevel>("authorizationLevel") < AuthorizationLevel.BASIC_STAFF)
            {
                view.ActionPanel.Enabled = false;
                view.ActionPanel.Visible = false;
            }

            _packetList = view.ListView;
            coordinator = CoordinatorManager.Instance.CoordinatorOfType <IServiceCoordinator>();
            if (coordinator == null)
            {
                throw new InvalidOperationException("Il coordinatore dei paccheti non è disponibile");
            }

            _packets = coordinator.Packets;
            coordinator.ServiceChanged += ServiceChangedHandler;
            // Popolo la list view all'avvio
            ServiceChangedHandler(this, EventArgs.Empty);
        }
 public ShutdownHandler(
     ISubscriptionManager subscriptionManager,
     IServiceCoordinator serviceCoordinator)
 {
     SubscriptionManager = subscriptionManager;
     ServiceCoordinator  = serviceCoordinator;
 }
        public WindowsServiceHost([NotNull] ServiceDescription description, [NotNull] IServiceCoordinator coordinator)
        {
            if (description == null)
                throw new ArgumentNullException("description");
            if (coordinator == null)
                throw new ArgumentNullException("coordinator");

            _coordinator = coordinator;
            _description = description;
        }
Exemple #5
0
        public virtual Host Build()
        {
            _coordinator = new ServiceCoordinator(new PoolFiber(),
                                                  ExecutePreStartActions,
                                                  ExecutePostStartActions,
                                                  ExecutePostStopActions,
                                                  _timeout);

            _serviceBuilders.Each(x => { _coordinator.CreateService(x.Name, x.Build); });

            return(CreateHost(_coordinator));
        }
Exemple #6
0
        Host CreateHost(IServiceCoordinator coordinator)
        {
            if (Process.GetCurrentProcess().GetParent().ProcessName == "services")
            {
                _log.Debug("Running as a Windows service, using the service host");

                return(new WindowsServiceHost(_description, coordinator));
            }

            _log.Debug("Running as a console application, using the console host");
            return(new ConsoleRunHost(_description, coordinator));
        }
Exemple #7
0
        public ConsoleRunHost([NotNull] ServiceDescription description, [NotNull] IServiceCoordinator coordinator, [NotNull]Os osCommands)
        {
            if (description == null)
                throw new ArgumentNullException("description");
            if (coordinator == null)
                throw new ArgumentNullException("coordinator");
            if(osCommands ==null)
                throw new ArgumentNullException("osCommands");

            _description = description;
            _coordinator = coordinator;
            _osCommands = osCommands;
        }
Exemple #8
0
        Host CreateHost(IServiceCoordinator coordinator, Os osCommands)
        {
            var process = Process.GetCurrentProcess().GetParent();

            if (process != null && process.ProcessName == "services")
            {
                _log.Debug("Running as a Windows service, using the service host");

                return(new WindowsServiceHost(_description, coordinator));
            }

            _log.Debug("Running as a console application, using the console host");
            return(new ConsoleRunHost(_description, coordinator, osCommands));
        }
        public ConsoleRunHost([NotNull] ServiceDescription description, [NotNull] IServiceCoordinator coordinator)
        {
            if (description == null)
            {
                throw new ArgumentNullException("description");
            }
            if (coordinator == null)
            {
                throw new ArgumentNullException("coordinator");
            }

            _description = description;
            _coordinator = coordinator;
        }
Exemple #10
0
        public WindowsServiceHost([NotNull] ServiceDescription description, [NotNull] IServiceCoordinator coordinator)
        {
            if (description == null)
            {
                throw new ArgumentNullException("description");
            }
            if (coordinator == null)
            {
                throw new ArgumentNullException("coordinator");
            }

            _coordinator = coordinator;
            _description = description;
        }
Exemple #11
0
        public virtual Host Build()
        {
            _coordinator = new ServiceCoordinator(new PoolFiber(),
                                                  ExecutePreStartActions,
                                                  ExecutePostStartActions,
                                                  ExecutePostStopActions,
                                                  _timeout);

            _serviceBuilders.Each(x => { _coordinator.CreateService(x.Name, x.Build); });

            //TODO: feels like it should be a builder
            var osCommands = OsDetector.DetectOs();


            return(CreateHost(_coordinator, osCommands));
        }
Exemple #12
0
        public ConsoleRunHost([NotNull] ServiceDescription description, [NotNull] IServiceCoordinator coordinator, [NotNull] Os osCommands)
        {
            if (description == null)
            {
                throw new ArgumentNullException("description");
            }
            if (coordinator == null)
            {
                throw new ArgumentNullException("coordinator");
            }
            if (osCommands == null)
            {
                throw new ArgumentNullException("osCommands");
            }

            _description = description;
            _coordinator = coordinator;
            _osCommands  = osCommands;
        }
Exemple #13
0
        void ShutdownCoordinator()
        {
            try
            {
                _log.Info("[Topshelf] Stopping");

                _coordinator.Stop();
            }
            catch (Exception ex)
            {
                _log.Error("The service did not shut down gracefully", ex);
            }
            finally
            {
                _coordinator.Dispose();
                _coordinator = null;

                _log.Info("[Topshelf] Stopped");
            }
        }
Exemple #14
0
        protected override void OnStop()
        {
            try
            {
                _log.Info("[Topshelf] Stopping");

                _coordinator.Stop();
            }
            catch (Exception ex)
            {
                _log.Fatal("The service did not shut down gracefully", ex);
                throw;
            }
            finally
            {
                _coordinator.Dispose();
                _coordinator = null;

                _log.Info("[Topshelf] Stopped");
            }
        }
Exemple #15
0
        protected override void OnStop()
        {
            try
            {
                _log.Info("[Topshelf] Stopping");

                _coordinator.Stop();
            }
            catch (Exception ex)
            {
                _log.Fatal("The service did not shut down gracefully", ex);
                throw;
            }
            finally
            {
                _coordinator.Dispose();
                _coordinator = null;

                _log.Info("[Topshelf] Stopped");
            }
        }
Exemple #16
0
        public ServiceManagerPresenter(ServiceManagerView view)
        {
            view.AddButton.Click    += AddHandler;
            view.DeleteButton.Click += DeleteHandeler;
            _serviceList             = view.ListView;
            coordinator              = CoordinatorManager.Instance.CoordinatorOfType <IServiceCoordinator>();
            if (coordinator == null)
            {
                throw new InvalidOperationException("Il coordinatore dei servizi non è disponibile");
            }

            if (view.RetrieveTagInformation <AuthorizationLevel>("authorizationLevel") < AuthorizationLevel.BASIC_STAFF)
            {
                view.ActionPanel.Enabled = false;
                view.ActionPanel.Visible = false;
            }

            _services = coordinator.Services;
            coordinator.ServiceChanged += ServiceChangedHandler;
            // Popolo la list view all'avvio
            ServiceChangedHandler(this, EventArgs.Empty);
        }
 public SelectionPacket(DateRange range = null, string question = "", bool emptyResponse = false, Style style = null)
 {
     coordinator = CoordinatorManager.Instance.CoordinatorOfType <IServiceCoordinator>();
     #region Precondizioni
     if (question == null)
     {
         throw new ArgumentNullException("question null");
     }
     if (coordinator == null)
     {
         throw new InvalidOperationException("Il coordinatore dei pacchetti non è disponibile");
     }
     #endregion
     InitializeComponent();
     _range         = range;
     _question.Text = question;
     _emptyResponse = emptyResponse;
     _packetList    = _view;
     _packets       = coordinator.Packets;
     ActiveControl  = _view;
     this.ApplyStyle(style);
 }
Exemple #18
0
 public HaltMinionHandler(IServiceCoordinator coordinator)
 {
     Coordinator = coordinator;
 }
Exemple #19
0
 public InventoryServiceTask(IServiceCoordinator serviceCoordinator)
 {
     this.serviceCoordinator = serviceCoordinator;
 }
Exemple #20
0
 void ExecutePostStopActions(IServiceCoordinator coordinator)
 {
     _postStopActions.Each(x => x(coordinator));
 }
Exemple #21
0
 void Ignored(IServiceCoordinator coordinator)
 {
 }
 public PaymentServiceTask(IServiceCoordinator serviceCoordinator)
 {
     this.serviceCoordinator = serviceCoordinator;
 }
 public AccountServiceTask(IServiceCoordinator serviceCoordinator)
 {
     this.serviceCoordinator = serviceCoordinator;
 }
 public ServiceCommand(IServiceCoordinator coordinator, WinServiceSettings settings)
 {
     _coordinator = coordinator;
     _settings = settings;
 }
Exemple #25
0
 public ConsoleRunHost(ServiceDescription description, IServiceCoordinator coordinator)
 {
     _description = description;
     _coordinator = coordinator;
 }
Exemple #26
0
 public ConsoleHost(IServiceCoordinator coordinator)
 {
     _coordinator = coordinator;
 }
Exemple #27
0
 public WinServiceHost(IServiceCoordinator coordinator, ServiceName fullServiceName)
 {
     _coordinator = coordinator;
     _fullServiceName = fullServiceName;
 }
Exemple #28
0
 public ConsoleRunHost(ServiceDescription description, IServiceCoordinator coordinator)
 {
     _description = description;
     _coordinator = coordinator;
 }
Exemple #29
0
 public CommandLineHost(ServiceName name, IServiceCoordinator coordinator)
 {
     _serviceName = name;
     _coordinator = coordinator;
 }
Exemple #30
0
 public WindowsServiceHost(ServiceDescription description, IServiceCoordinator coordinator)
 {
     _coordinator = coordinator;
     _description = description;
 }
Exemple #31
0
 public ServiceHost(IServiceCoordinator coordinator)
 {
     _coordinator = coordinator;
 }
Exemple #32
0
 public WindowsServiceHost(ServiceDescription description, IServiceCoordinator coordinator)
 {
     _coordinator = coordinator;
     _description = description;
 }
Exemple #33
0
 public RunCommand(IServiceCoordinator coordinator, string serviceName)
 {
     _coordinator = coordinator;
     _serviceName = serviceName;
 }
Exemple #34
0
 public ConsoleHost( ServiceName name, IServiceCoordinator serviceCoordinator )
 {
     Name = name;
     ServiceCoordinator = serviceCoordinator;
 }
Exemple #35
0
 public ConsoleHost(ServiceName name, IServiceCoordinator serviceCoordinator)
 {
     Name = name;
     ServiceCoordinator = serviceCoordinator;
 }
Exemple #36
0
 public DaemonHost(IServiceCoordinator serviceCoordinator, ServiceName name)
 {
     ServiceCoordinator = serviceCoordinator;
     Name = name;
 }
Exemple #37
0
 void ExecutePreStartActions(IServiceCoordinator coordinator)
 {
     _preStartActions.Each(x => x(coordinator));
 }
Exemple #38
0
 public RunCommand(IServiceCoordinator coordinator)
 {
     _coordinator = coordinator;
 }
 public CategoryService(IServiceCoordinator serviceCoordinator)
 {
     this._serviceCoordinator = serviceCoordinator;
 }
Exemple #40
0
 public DaemonHost( IServiceCoordinator serviceCoordinator, ServiceName name )
 {
     ServiceCoordinator = serviceCoordinator;
     Name = name;
 }
Exemple #41
0
        void ShutdownCoordinator()
        {
            try
            {
                _log.Info("[Topshelf] Stopping");

                _coordinator.Stop();
            }
            catch (Exception ex)
            {
                _log.Error("The service did not shut down gracefully", ex);
            }
            finally
            {
                _coordinator.Dispose();
                _coordinator = null;

                _log.Info("[Topshelf] Stopped");
            }
        }
        //public ProductController()
        //{
        //    string connectionString = "";//todo use IOC later
        //   // this._service = new ServiceCoordinator(connectionString);
        //}

        public ProductController(Infrastructure.Entities.InventoryContext context)
        {
            this._service = new ServiceCoordinator(context);
            //this._service = service;
        }
 public ConsoleHost(IServiceCoordinator coordinator)
 {
     _coordinator = coordinator;
 }
Exemple #44
0
 public ProductService(IServiceCoordinator serviceCoordinator)
 {
     this._serviceCoordinator = serviceCoordinator;
 }