Esempio n. 1
0
 /// <summary>
 /// get a play area
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='tournamentId'>
 /// </param>
 /// <param name='playAreaId'>
 /// </param>
 /// <param name='cancellationToken'>
 /// The cancellation token.
 /// </param>
 public static async Task <PlayArea> GetPlayAreaAsync(this IModelClient operations, int tournamentId, int playAreaId, CancellationToken cancellationToken = default(CancellationToken))
 {
     using (var _result = await operations.GetPlayAreaWithHttpMessagesAsync(tournamentId, playAreaId, null, cancellationToken).ConfigureAwait(false))
     {
         return(_result.Body);
     }
 }
Esempio n. 2
0
 /// <summary>
 /// Get a match
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='matchId'>
 /// </param>
 /// <param name='tournamentId'>
 /// </param>
 /// <param name='cancellationToken'>
 /// The cancellation token.
 /// </param>
 public static async Task <Match> GetMatchAsync(this IModelClient operations, int matchId, int?tournamentId = default(int?), CancellationToken cancellationToken = default(CancellationToken))
 {
     using (var _result = await operations.GetMatchWithHttpMessagesAsync(matchId, tournamentId, null, cancellationToken).ConfigureAwait(false))
     {
         return(_result.Body);
     }
 }
Esempio n. 3
0
 /// <summary>
 /// Add a new team
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='tournamentId'>
 /// </param>
 /// <param name='name'>
 /// </param>
 /// <param name='cancellationToken'>
 /// The cancellation token.
 /// </param>
 public static async Task <Team> AddTeamAsync(this IModelClient operations, int tournamentId, string name, CancellationToken cancellationToken = default(CancellationToken))
 {
     using (var _result = await operations.AddTeamWithHttpMessagesAsync(tournamentId, name, null, cancellationToken).ConfigureAwait(false))
     {
         return(_result.Body);
     }
 }
Esempio n. 4
0
 /// <summary>
 /// Update an existing team
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='tournamentId'>
 /// </param>
 /// <param name='teamId'>
 /// Id of the team
 /// </param>
 /// <param name='team'>
 /// </param>
 /// <param name='cancellationToken'>
 /// The cancellation token.
 /// </param>
 public static async Task <Team> UpdateTeamAsync(this IModelClient operations, int tournamentId, int teamId, Team team = default(Team), CancellationToken cancellationToken = default(CancellationToken))
 {
     using (var _result = await operations.UpdateTeamWithHttpMessagesAsync(tournamentId, teamId, team, null, cancellationToken).ConfigureAwait(false))
     {
         return(_result.Body);
     }
 }
Esempio n. 5
0
 /// <summary>
 /// Create a new tournament
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='tournament'>
 /// </param>
 /// <param name='cancellationToken'>
 /// The cancellation token.
 /// </param>
 public static async Task <Tournament> NewTournamentAsync(this IModelClient operations, Tournament tournament = default(Tournament), CancellationToken cancellationToken = default(CancellationToken))
 {
     using (var _result = await operations.NewTournamentWithHttpMessagesAsync(tournament, null, cancellationToken).ConfigureAwait(false))
     {
         return(_result.Body);
     }
 }
Esempio n. 6
0
 /// <summary>
 /// Get the list of all tournaments
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='cancellationToken'>
 /// The cancellation token.
 /// </param>
 public static async Task <IList <Tournament> > GetAllAsync(this IModelClient operations, CancellationToken cancellationToken = default(CancellationToken))
 {
     using (var _result = await operations.GetAllWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false))
     {
         return(_result.Body);
     }
 }
        internal SmartObjectsClient(ClientConfig config)
        {
            client = new HttpClient(config);

            Objects     = new ObjectClient(client);
            Owners      = new OwnerClient(client);
            Events      = new EventClient(client);
            Restitution = new RestitutionClient(client);
            Model       = new ModelClient(client);
        }
        public async Task SetUp()
        {
            var container = new IndicoTestContainerBuilder().Build();

            _modelClient = container.Resolve <IModelClient>();
            var dataSets = await container.Resolve <IDataSetClient>().ListFullAsync(1);

            _modelGroupId = dataSets.First().ModelGroups.First().Id;
            _modelId      = (await _modelClient.GetGroup(_modelGroupId, default)).Id;
            _jobAwaiter   = container.Resolve <IJobAwaiter>();
        }
Esempio n. 9
0
 /// <summary>
 /// update play area
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='tournamentId'>
 /// </param>
 /// <param name='playAreaId'>
 /// </param>
 /// <param name='playArea'>
 /// </param>
 public static void UpdatePlayArea(this IModelClient operations, int tournamentId, int playAreaId, PlayArea playArea = default(PlayArea))
 {
     Task.Factory.StartNew(s => ((IModelClient)s).UpdatePlayAreaAsync(tournamentId, playAreaId, playArea), operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult();
 }
Esempio n. 10
0
 /// <summary>
 /// Delete the given tournament by its Id
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='tournamentId'>
 /// </param>
 /// <param name='cancellationToken'>
 /// The cancellation token.
 /// </param>
 public static async Task DeleteTournamentAsync(this IModelClient operations, int tournamentId, CancellationToken cancellationToken = default(CancellationToken))
 {
     await operations.DeleteTournamentWithHttpMessagesAsync(tournamentId, null, cancellationToken).ConfigureAwait(false);
 }
Esempio n. 11
0
 /// <summary>
 /// Get the tournament by its Id
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='tournamentId'>
 /// Id of the tournament
 /// </param>
 public static Tournament Get(this IModelClient operations, int tournamentId)
 {
     return(Task.Factory.StartNew(s => ((IModelClient)s).GetAsync(tournamentId), operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult());
 }
Esempio n. 12
0
 /// <summary>
 /// Update an existing team
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='tournamentId'>
 /// </param>
 /// <param name='teamId'>
 /// Id of the team
 /// </param>
 /// <param name='team'>
 /// </param>
 public static Team UpdateTeam(this IModelClient operations, int tournamentId, int teamId, Team team = default(Team))
 {
     return(Task.Factory.StartNew(s => ((IModelClient)s).UpdateTeamAsync(tournamentId, teamId, team), operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult());
 }
Esempio n. 13
0
 /// <summary>
 /// Set the score for a match. This call is only valid if the match is not
 /// finished yet
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='matchId'>
 /// Id of the match
 /// </param>
 /// <param name='scoreOne'>
 /// current score of team one
 /// </param>
 /// <param name='scoreTwo'>
 /// current score of team two
 /// </param>
 public static void SetScoreOnMatch(this IModelClient operations, int matchId, int scoreOne, int scoreTwo)
 {
     Task.Factory.StartNew(s => ((IModelClient)s).SetScoreOnMatchAsync(matchId, scoreOne, scoreTwo), operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult();
 }
Esempio n. 14
0
 /// <summary>
 /// Remove the team from the tournament
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='tournamentId'>
 /// Id of the tournament
 /// </param>
 /// <param name='teamId'>
 /// Id of the team
 /// </param>
 public static void RemoveTeam(this IModelClient operations, int tournamentId, int teamId)
 {
     Task.Factory.StartNew(s => ((IModelClient)s).RemoveTeamAsync(tournamentId, teamId), operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult();
 }
Esempio n. 15
0
 /// <summary>
 /// Remove the team from the tournament
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='tournamentId'>
 /// Id of the tournament
 /// </param>
 /// <param name='teamId'>
 /// Id of the team
 /// </param>
 /// <param name='cancellationToken'>
 /// The cancellation token.
 /// </param>
 public static async Task RemoveTeamAsync(this IModelClient operations, int tournamentId, int teamId, CancellationToken cancellationToken = default(CancellationToken))
 {
     await operations.RemoveTeamWithHttpMessagesAsync(tournamentId, teamId, null, cancellationToken).ConfigureAwait(false);
 }
Esempio n. 16
0
 /// <summary>
 /// Set the score for a match. This call is only valid if the match is not
 /// finished yet
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='matchId'>
 /// Id of the match
 /// </param>
 /// <param name='scoreOne'>
 /// current score of team one
 /// </param>
 /// <param name='scoreTwo'>
 /// current score of team two
 /// </param>
 /// <param name='cancellationToken'>
 /// The cancellation token.
 /// </param>
 public static async Task SetScoreOnMatchAsync(this IModelClient operations, int matchId, int scoreOne, int scoreTwo, CancellationToken cancellationToken = default(CancellationToken))
 {
     await operations.SetScoreOnMatchWithHttpMessagesAsync(matchId, scoreOne, scoreTwo, null, cancellationToken).ConfigureAwait(false);
 }
Esempio n. 17
0
 /// <summary>
 /// update play area
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='tournamentId'>
 /// </param>
 /// <param name='playAreaId'>
 /// </param>
 /// <param name='playArea'>
 /// </param>
 /// <param name='cancellationToken'>
 /// The cancellation token.
 /// </param>
 public static async Task UpdatePlayAreaAsync(this IModelClient operations, int tournamentId, int playAreaId, PlayArea playArea = default(PlayArea), CancellationToken cancellationToken = default(CancellationToken))
 {
     await operations.UpdatePlayAreaWithHttpMessagesAsync(tournamentId, playAreaId, playArea, null, cancellationToken).ConfigureAwait(false);
 }
Esempio n. 18
0
 public PresenterClient(IViewClient view, IModelClient model)
 {
     this.view  = view;
     this.model = model;
 }
Esempio n. 19
0
 /// <summary>
 /// Get a match
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='matchId'>
 /// </param>
 /// <param name='tournamentId'>
 /// </param>
 public static Match GetMatch(this IModelClient operations, int matchId, int?tournamentId = default(int?))
 {
     return(Task.Factory.StartNew(s => ((IModelClient)s).GetMatchAsync(matchId, tournamentId), operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult());
 }
Esempio n. 20
0
 /// <summary>
 /// create a play area
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='tournamentId'>
 /// </param>
 /// <param name='name'>
 /// </param>
 /// <param name='description'>
 /// </param>
 public static PlayArea AddPlayArea(this IModelClient operations, int tournamentId, string name, string description)
 {
     return(Task.Factory.StartNew(s => ((IModelClient)s).AddPlayAreaAsync(tournamentId, name, description), operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult());
 }