Пример #1
0
        public override object Clone()
        {
            var clone = new PowerSource();

            clone.CopyFrom(this);
            return(clone);
        }
Пример #2
0
 /// <summary>
 /// Raises a <see cref="Robot.PowerSource"/> change event.
 /// </summary>
 /// <param name="id">The <see cref="Robot"/> identifier.</param>
 /// <param name="powerSource">The Power Source (see <see cref="RefDataNamespace.PowerSource"/>).</param>
 public Task RaisePowerSourceChangeAsync(Guid id, RefDataNamespace.PowerSource powerSource)
 {
     return(ManagerInvoker.Default.InvokeAsync(this, async() =>
     {
         ExecutionContext.Current.OperationType = OperationType.Unspecified;
         await RaisePowerSourceChangeOnImplementationAsync(id, powerSource).ConfigureAwait(false);
     }));
 }
Пример #3
0
        private async Task RaisePowerSourceChangeOnImplementationAsync(Guid id, RefDataNamespace.PowerSource powerSource)
        {
            var e = new EventData <string>
            {
                Subject = $"Demo.Robot.{id}",
                Action  = "PowerSourceChange",
                Value   = powerSource,
                Key     = id
            };

            await _eventPublisher.Publish(e).SendAsync().ConfigureAwait(false);
        }
Пример #4
0
 /// <summary>
 /// Raises a <see cref="Robot.PowerSource"/> change event.
 /// </summary>
 /// <param name="id">The <see cref="Robot"/> identifier.</param>
 /// <param name="powerSource">The Power Source (see <see cref="RefDataNamespace.PowerSource"/>).</param>
 /// <param name="requestOptions">The optional <see cref="WebApiRequestOptions"/>.</param>
 /// <returns>A <see cref="WebApiAgentResult"/>.</returns>
 public Task <WebApiAgentResult> RaisePowerSourceChangeAsync(Guid id, RefDataNamespace.PowerSource powerSource, WebApiRequestOptions requestOptions = null)
 {
     return(RobotServiceAgent.RaisePowerSourceChangeAsync(id, powerSource, requestOptions));
 }
Пример #5
0
        public void CopyFrom(PowerSource from)
        {
            CopyFrom((ReferenceDataBaseGuid)from);

            OnAfterCopyFrom(from);
        }
Пример #6
0
 partial void OnAfterCopyFrom(PowerSource from);
Пример #7
0
 /// <summary>
 /// Raises a <see cref="Robot.PowerSource"/> change event.
 /// </summary>
 /// <param name="id">The <see cref="Robot"/> identifier.</param>
 /// <param name="powerSource">The Power Source (see <see cref="RefDataNamespace.PowerSource"/>).</param>
 /// <param name="requestOptions">The optional <see cref="WebApiRequestOptions"/>.</param>
 /// <returns>A <see cref="WebApiAgentResult"/>.</returns>
 public Task <WebApiAgentResult> RaisePowerSourceChangeAsync(Guid id, RefDataNamespace.PowerSource powerSource, WebApiRequestOptions requestOptions = null)
 {
     return(base.PostAsync("api/v1/robots/{id}/powerSource/{powerSource}", requestOptions: requestOptions,
                           args: new WebApiArg[] { new WebApiArg <Guid>("id", id), new WebApiArg <RefDataNamespace.PowerSource>("powerSource", powerSource) }));
 }