Пример #1
0
        void SendStopCommandToServices()
        {
            _serviceCache.Each((name, service) =>
            {
                var message = new StopService(name);

                _actorCache[name].Send(message);
            });
        }
Пример #2
0
        static void Main(string[] args)
        {
            RouteService routeService = new RouteService();
            StopService  stopService  = new StopService();

            Console.WriteLine("Copy open date from New Taipei city open data platform start!");
            routeService.Backup();
            stopService.Backup();
            Console.WriteLine("Copy open date from New Taipei city open data platform finsh!");
            Console.ReadLine();
        }
Пример #3
0
        private void ServiceContextActionButton_Click(object sender, EventArgs e)
        {
            ServiceParameters ServiceParams = new ServiceParameters();

            ServiceParams.ServiceName = SelectedService;
            NetworkParameters NetParams = new NetworkParameters();

            NetParams.RemoteSystemName = MachineName;
            RemoteExecutionManager RemoteExec = new RemoteExecutionManager();

            if (ServiceAction == ServiceActionType.StartService)
            {
                StartService Start = new StartService();
                Start.ServiceParameters = ServiceParams;

                RemoteExec.Command   = Start;
                RemoteExec.NetParams = NetParams;
                IResult StartResult = RemoteExec.Execute();
                if (StartResult.Result == ExecutionResultType.Passed)
                {
                    MessageBox.Show(SelectedService + " has been successfully started on the remote machine " + MachineName, "Start Service", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    RefreshServiceList();
                }
                else
                {
                    MessageBox.Show("Failed to start the service " + SelectedService + " on the remote machine " + MachineName + " due to the following reason : " + StartResult.FailureException.Message, "Start Service", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            else
            if (ServiceAction == ServiceActionType.StopService)
            {
                StopService Stop = new StopService();
                Stop.ServiceParameters = ServiceParams;
                RemoteExec.Command     = Stop;
                RemoteExec.NetParams   = NetParams;
                IResult StopResult = RemoteExec.Execute();
                if (StopResult.Result == ExecutionResultType.Passed)
                {
                    MessageBox.Show(SelectedService + " has been successfully stopped on the remote machine " + MachineName, "Stop Service", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    RefreshServiceList();
                }
                else
                {
                    MessageBox.Show("Failed to stop the service " + SelectedService + " on the remote machine " + MachineName + " due to the following reason : " + StopResult.FailureException.Message, "Stop Service", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }
Пример #4
0
        public static void SetMainPage()
        {
            var ss    = new StopService();
            var stops = Task.Run(() => ss.GetAllStops(StopType.Tram)).Result;

            Current.MainPage = new TabbedPage
            {
                Children =
                {
                    new NavigationPage(new FavouriteStopsPage(stops))
                    {
                        Title = "Przystanki",
                        Icon  = Device.OnPlatform("tab_feed.png", null, null)
                    },
                }
            };
        }
Пример #5
0
        private void ConfigInputPoint_Click(object sender, RoutedEventArgs e)
        {
            wndWayPointsConfig wpc;

            if (service is StopService)
            {
                StopService serv = service as StopService;
                if (serv.InputPoints == null)
                {
                    wpc = new wndWayPointsConfig();
                }
                else
                {
                    wpc = new wndWayPointsConfig(serv.InputPoints);
                }
                if (wpc.ShowDialog() == true)
                {
                    (service as StopService).InputPoints = wpc.WayPointsList;
                    lvInputPoints.ItemsSource            = null;
                    lvInputPoints.ItemsSource            = (service as StopService).InputPoints;
                }
            }
            else if (service is QueueService)
            {
                QueueService serv = service as QueueService;
                if (serv.InputPoints == null)
                {
                    wpc = new wndWayPointsConfig();
                }
                else
                {
                    wpc = new wndWayPointsConfig(serv.InputPoints);
                }
                if (wpc.ShowDialog() == true)
                {
                    (service as QueueService).InputPoints = wpc.WayPointsList;
                    lvInputQueuePoints.ItemsSource        = null;
                    lvInputQueuePoints.ItemsSource        = (service as QueueService).InputPoints;
                }
            }
        }
Пример #6
0
        public void StopService()
        {
            string expected = File.ReadAllText(Path.Combine(_requestsTestDataPath, "StopService.xml"));
            var    request  = new StopService
            {
                SessionId = "sid",
                Service   = TServiceType.POP3
            };
            var xml = request.ToXml().InnerXmlFormatted();

            Assert.AreEqual(expected, xml);

            XmlDocument doc = new XmlDocument();

            doc.LoadXml(File.ReadAllText(Path.Combine(_responsesTestDataPath, "StopService.xml")));
            var response = request.FromHttpRequestResult(new HttpRequestResult {
                Response = doc.InnerXml
            });

            Assert.AreEqual("result", response.Type);
            Assert.True(response.Success);
        }
Пример #7
0
 public StopServiceShould()
 {
     sut = new StopService();
 }
        public Task Handle(StopService message, CancellationToken cancellationToken)
        {
            this._manager.Stop();

            return(Task.CompletedTask);
        }
 public NextToArriveViewModel(string urlBase)
 {
     RouteService = new RouteService(urlBase);
     StopService  = new StopService(urlBase);
 }
Пример #10
0
 public UserController(UserService userService, StopService stopService)
 {
     _service     = userService;
     _stopService = stopService;
 }
Пример #11
0
        public Task <Unit> Handle(StopService message, CancellationToken cancellationToken)
        {
            this._manager.Stop();

            return(Unit.Task);
        }
Пример #12
0
        public async Task LoadStops()
        {
            var ss = new StopService();

            Stops = await ss.GetAllStops();
        }