public HttpResponseMessage SacuvajInkrement(HttpRequestMessage request, [FromBody] Inkrement inkrement) { HttpResponseMessage response = null; try { using (SystemClient proxy = new SystemClient()) { proxy.Open(); proxy.SacuvajInkrement(inkrement); response = request.CreateResponse(HttpStatusCode.OK); proxy.Close(); } } catch (FaultException ex) { response = request.CreateResponse(HttpStatusCode.InternalServerError, ex.Message); } catch (Exception ex) { response = request.CreateResponse(HttpStatusCode.InternalServerError, ex.Message); } return(response); }
public ServerTaskService(SystemClient systemClient, string pivotalXmlServicesUriString, string pivotalSystemName, int timeoutms) { this.systemClient = systemClient; this.pivotalXmlServicesUriString = pivotalXmlServicesUriString; this.pivotalSystemName = pivotalSystemName; this.timeoutms = timeoutms; }
public MainPage(bool server, string endpoint = null, int port = 10156, string username = null) { InitializeComponent(); DataContext = this; CreateMatch = new CommandImplementation(CreateMatch_Executed, CreateMatch_CanExecute); AddAllPlayersToMatch = new CommandImplementation(AddAllPlayersToMatch_Executed, AddAllPlayersToMatch_CanExecute); DestroyMatch = new CommandImplementation(DestroyMatch_Executed, (_) => true); if (server) { Connection = new SystemServer(); (Connection as SystemServer).Start(); } else { Connection = new SystemClient(endpoint, port, username, TournamentAssistantShared.Models.Packets.Connect.ConnectTypes.Coordinator); (Connection as SystemClient).Start(); } /*Connection.PlayerConnected += RefreshPlayerListBox; * Connection.PlayerDisconnected += RefreshPlayerListBox; * Connection.MatchCreated += RefreshPlayerListBox; * Connection.MatchDeleted += RefreshPlayerListBox;*/ }
public HttpResponseMessage GetArtikli(HttpRequestMessage request) { HttpResponseMessage response = null; try { using (SystemClient proxy = new SystemClient()) { proxy.Open(); Artikal[] artikli = proxy.GetArtikli(); response = request.CreateResponse <Artikal[]>(HttpStatusCode.OK, artikli); proxy.Close(); } } catch (FaultException ex) { response = request.CreateResponse(HttpStatusCode.InternalServerError, ex.Message); } catch (Exception ex) { response = request.CreateResponse(HttpStatusCode.InternalServerError, ex.Message); } return(response); }
public HttpResponseMessage GetKategorije(HttpRequestMessage request) { HttpResponseMessage response = null; try { using (SystemClient proxy = new SystemClient()) { proxy.Open(); Kategorija[] kategorije = proxy.GetKategorije( ); response = request.CreateResponse <Kategorija[]>(HttpStatusCode.OK, kategorije); proxy.Close(); } } catch (FaultException ex) { response = request.CreateResponse(HttpStatusCode.InternalServerError, ex.Message); } catch (Exception ex) { response = request.CreateResponse(HttpStatusCode.InternalServerError, ex.Message); } return(response); }
public HttpResponseMessage ObrisiNacinPlacanja(HttpRequestMessage request, [FromBody] int id) { HttpResponseMessage response = null; try { using (SystemClient proxy = new SystemClient()) { proxy.Open(); proxy.ObrisiNacinPlacanja(id); proxy.Close(); response = request.CreateResponse(HttpStatusCode.OK); } } catch (FaultException ex) { response = request.CreateResponse(HttpStatusCode.InternalServerError, ex.Message); } catch (Exception ex) { response = request.CreateResponse(HttpStatusCode.InternalServerError, ex.Message); } return(response); }
public HttpResponseMessage GetNaciniPlacanja(HttpRequestMessage request) { HttpResponseMessage response = null; try { using (SystemClient proxy = new SystemClient()) { proxy.Open(); NacinPlacanja[] naciniPlacanja = proxy.GetNaciniPlacanja( ); response = request.CreateResponse <NacinPlacanja[]>(HttpStatusCode.OK, naciniPlacanja); proxy.Close(); } } catch (FaultException ex) { response = request.CreateResponse(HttpStatusCode.InternalServerError, ex.Message); } catch (Exception ex) { response = request.CreateResponse(HttpStatusCode.InternalServerError, ex.Message); } return(response); }
protected SampleProviderService(SampleMessenger messenger, SystemClient systemClient) { ArgumentMust.NotBeNull(() => messenger); ArgumentMust.NotBeNull(() => systemClient); Messenger = messenger; Client = systemClient; }
public bool ValidateInstallation() { WaitForServiceToStart(); using (var ctx = new SystemClient()) { return(ctx.ValidateInstallation()); } }
public PiCommandPage(Topic topic, SystemClient piStatsService) { InitializeComponent(); Title = topic.Name; _monitorTopic = topic; _piSystemClient = piStatsService; InitializeCommandsGrid(); }
/// <summary> /// create and initialize a PiCar /// </summary> public static PiCar CreatePiCar(string serverAndPort, string credential) { DiscoverService discoverService = DiscoverService.GetOrCreateService(serverAndPort, credential); SystemClient httpSystem = discoverService.GetClientNode <SystemClient>(); PiCar picar = discoverService.GetClientNode <PiCar>(); if (picar != null) { picar.Server = httpSystem; } return(picar); }
private void Initialize() { if (_initialized) { return; } _discoverService = DiscoverService.GetOrCreateService(_monitorTopic.Server, _monitorTopic.Credential, _failedInit); _piSystem = _discoverService.GetClientNode <SystemClient>(); _hygroThermoSensor = _discoverService.GetClientNode <HygroThermoSensorClient>(); _initialized = _piSystem != null; _failedInit = _piSystem == null; if (_initialized) { CommandButton.IsEnabled = true; GpioButton.IsEnabled = true; } else { CommandButton.IsEnabled = false; GpioButton.IsEnabled = false; } }
public async Task GivenApiUp_WhenGetInfoAsync_ThenApiCalledAndResponseReturned() { // Arrange var mockHttpAdapter = new Mock <IHttpAdapter <SystemClient> >(); var sut = new SystemClient(mockHttpAdapter.Object); var startedAt = DateTime.UtcNow.Subtract(new TimeSpan(1, 0, 0)); var response = new ObjectResponse <SystemInfo> { Success = true, Value = new SystemInfo { StartedAt = startedAt } }; mockHttpAdapter.Setup(x => x.GetAsync( It.IsAny <Uri>(), It.IsAny <CancellationToken>())) .ReturnsAsync(new System.Net.Http.HttpResponseMessage { StatusCode = System.Net.HttpStatusCode.OK, Content = new StringContent(JsonConvert.SerializeObject(response)) }); var cancellationTokenSource = new CancellationTokenSource(); // Act var result = await sut.GetInfoAsync(cancellationTokenSource.Token); // Assert Assert.True(result.Success); Assert.Equal(startedAt, result.Value.StartedAt); mockHttpAdapter.Verify(x => x.GetAsync( It.Is <Uri>(y => y.ToString() == new Uri("/api/System/Info", UriKind.Relative).ToString()), It.Is <CancellationToken>(y => y == cancellationTokenSource.Token)), Times.Once); }
public MainPage(bool server, string endpoint = null, int port = 10156, string username = null, string password = null) { InitializeComponent(); DataContext = this; CreateStandardMatch = new CommandImplementation(CreateStandardMatch_Executed, CreateStandardMatch_CanExecute); CreateBRMatch = new CommandImplementation(CreateBRMatch_Executed, CreateStandardMatch_CanExecute); DestroyMatch = new CommandImplementation(DestroyMatch_Executed, (_) => true); MoveAllRight = new CommandImplementation(MoveAllRight_Executed, MoveAllRight_CanExecute); MoveSelectedRight = new CommandImplementation(MoveSelectedRight_Executed, MoveSelectedRight_CanExecute); MoveAllLeft = new CommandImplementation(MoveAllLeft_Executed, MoveAllLeft_CanExecute); MoveSelectedLeft = new CommandImplementation(MoveSelectedLeft_Executed, MoveSelectedLeft_CanExecute); ListBoxLeft = new ObservableCollection <Player>(); Application.Current.Dispatcher.BeginInvoke(new Action(() => { BindingOperations.EnableCollectionSynchronization(ListBoxLeft, ListBoxLeftSync); })); ListBoxRight = new ObservableCollection <Player>(); Application.Current.Dispatcher.BeginInvoke(new Action(() => { BindingOperations.EnableCollectionSynchronization(ListBoxRight, ListBoxRightSync); })); if (server) { Connection = new SystemServer(); (Connection as SystemServer).Start(); } else { Connection = new SystemClient(endpoint, port, username, TournamentAssistantShared.Models.Packets.Connect.ConnectTypes.Coordinator, password: password); (Connection as SystemClient).Start(); } (Connection as SystemClient).PlayerConnected += MainPage_PlayerConnected; (Connection as SystemClient).PlayerDisconnected += MainPage_PlayerDisconnected; (Connection as SystemClient).ConnectedToServer += MainPage_ConnectedToServer; }
public ServerTaskService(SystemClient systemClient, string pivotalXmlServicesUriString, string pivotalSystemName) { this.systemClient = systemClient; this.pivotalXmlServicesUriString = pivotalXmlServicesUriString; this.pivotalSystemName = pivotalSystemName; }
public ServerTaskService(SystemClient systemClient) { this.systemClient = systemClient; }
public void LoginService(string ip, string port) { _imageClient = new ImageClient(ip, port); _systemClient = new SystemClient(ip, port); }
public GpuSampleProviderService(SampleMessenger messenger, SystemClient systemClient) : base(messenger, systemClient) { Messenger.SubscribeTo(this); }
public void OneTimeSetUp() { InitDokladApi(); _client = DokladApi.SystemClient; }