/// <summary> /// Requests the PoolCop status from the PoolCopilot API. /// </summary> /// <returns></returns> private async Task <PoolCopStatus> RequestPoolCopilotStatus() { var token = await this.GetAuthentificationToken(); var statusResponse = await HttpUtils.GetWebResponseAsync(new Uri(POOLCOP_API_ROOT_URI + "/status"), headers : new Dictionary <string, string>() { ["PoolCop-Token"] = token, ["X-PoolCopilot-Lang"] = this.APILanguage }); return(PoolCopStatus.FromJson(statusResponse)); }
/// <summary> /// Queries the PoolCop by using the PoolCopilot interface or local interface if failure. /// </summary> /// <returns></returns> public async Task Query() { try { this.Status = await this.RequestPoolCopilotStatus(); } catch when(!string.IsNullOrEmpty(this.LocalAddress)) { this.Status = await this.RequestLocalStatus(); } this.StatusChanged?.Invoke(this, EventArgs.Empty); this.APIStatusChanged?.Invoke(this, EventArgs.Empty); }