private async Task ConnectPropertiesAsync() { bool isDeveloperAPIEnabled = true; try { MixPlayStatus _ = await MixPlay.GetStatusAsync(); } catch { isDeveloperAPIEnabled = false; } if (isDeveloperAPIEnabled) { // Blank object to clear the loading JObject response = new JObject(); await this.connection.SendToPropertyInspectorAsync(this.Action, response, this.Context); } else { // Developer API is not enabled JObject response = new JObject { ["error"] = JValue.CreateString("developerAPINotEnabled") }; await this.connection.SendToPropertyInspectorAsync(this.Action, response, this.Context); } }
public override async Task RunTickAsync() { try { MixPlayStatus status = await MixPlay.GetStatusAsync(); if (status.IsConnected) { await this.connection.SetStateAsync(1, this.Context); string title = status.GameName.Replace(' ', '\n'); await this.connection.SetTitleAsync(title, this.Context, SDKTarget.HardwareAndSoftware); } else { await this.connection.SetStateAsync(0, this.Context); await this.connection.SetTitleAsync("Not\nConnected", this.Context, SDKTarget.HardwareAndSoftware); } } catch { await this.connection.SetStateAsync(0, this.Context); await this.connection.SetTitleAsync("Not\nConnected", this.Context, SDKTarget.HardwareAndSoftware); } }