protected override WuRemoteCallResult CallInternal(IWuEndpoint endpoint, object param) { if (ReconnectIfDisconnected(endpoint)) { switch (endpoint.State.StateId) { case WuStateId.Searching: endpoint.Service.AbortSearchUpdates(); break; case WuStateId.Downloading: endpoint.Service.AbortDownloadUpdates(); break; case WuStateId.Installing: endpoint.Service.AbortInstallUpdates(); break; default: return(new WuRemoteCallResult(endpoint, this, false, null, "The remote service is not searching, downloading or installing updates, can not abort the current state.")); } return(WuRemoteCallResult.SuccessResult(endpoint, this)); } return(WuRemoteCallResult.EndpointNotAvailableResult(endpoint, this)); }
protected override WuRemoteCallResult CallInternal(IWuEndpoint endpoint, object param) { SelectionParameter parameter; if (param is SelectionParameter) { parameter = (SelectionParameter)param; } else { throw new ArgumentException($"A {nameof(SelectionParameter)} parameter is required.", nameof(param)); } if (ReconnectIfDisconnected(endpoint)) { if (parameter.Value && endpoint.Service.SelectUpdate(parameter.Update.ID)) // try to select update { return(WuRemoteCallResult.SuccessResult(endpoint, this, $"Update {parameter.Update.Title} selected.")); } if (!parameter.Value && endpoint.Service.UnselectUpdate(parameter.Update.ID)) // try to unselect update { return(WuRemoteCallResult.SuccessResult(endpoint, this, $"Update {parameter.Update.Title} unselected.")); } return(new WuRemoteCallResult(endpoint, this, false, null, $"Update {parameter.Update.Title} could not be {(parameter.Value?"selected":"unselected")}.")); } return(WuRemoteCallResult.EndpointNotAvailableResult(endpoint, this)); }
protected override WuRemoteCallResult CallInternal(IWuEndpoint endpoint, object param) { if (ReconnectIfDisconnected(endpoint)) { endpoint.Service.BeginInstallUpdates(); return(WuRemoteCallResult.SuccessResult(endpoint, this)); } return(WuRemoteCallResult.EndpointNotAvailableResult(endpoint, this)); }
protected override WuRemoteCallResult CallInternal(IWuEndpoint endpoint, object param) { if (ReconnectIfDisconnected(endpoint)) { endpoint.Service.ResetService(); endpoint.RefreshState(); return(WuRemoteCallResult.SuccessResult(endpoint, this)); } return(WuRemoteCallResult.EndpointNotAvailableResult(endpoint, this)); }
protected override WuRemoteCallResult CallInternal(IWuEndpoint endpoint, object param) { bool value = (param is bool) ? (bool)param : true; if (ReconnectIfDisconnected(endpoint)) { endpoint.Service.SetAutoSelectUpdates(value); endpoint.RefreshSettings(); return(WuRemoteCallResult.SuccessResult(endpoint, this)); } return(WuRemoteCallResult.EndpointNotAvailableResult(endpoint, this)); }
protected override WuRemoteCallResult CallInternal(IWuEndpoint endpoint, object param) { UpdateDescription update = param as UpdateDescription; if (update == null) { throw new ArgumentException($"A {nameof(UpdateDescription)} parameter which includes an update id is required.", nameof(param)); } if (ReconnectIfDisconnected(endpoint)) { if (endpoint.Service.AcceptEula(update.ID)) { return(WuRemoteCallResult.SuccessResult(endpoint, this, $"The EULA of update {update.Title} was accepted.")); } return(new WuRemoteCallResult(endpoint, this, false, null, $"The EULA of update {update.Title} could not be accepted.")); } return(WuRemoteCallResult.EndpointNotAvailableResult(endpoint, this)); }