/// <summary> /// Wraps the getGlobalSettings and didReceiveGlobalSettings events into a single procedural method. /// </summary> /// <param name="client">An IStreamDeckClient instance as passed to the constructor of an IStreamDeckAction or IStreamDeckGlobalEvent.</param> /// <returns>A json object containing data that you can set and are stored persistently.</returns> public static async Task <JObject> GetGlobalSettings(IStreamDeckClient client) { TaskCompletionSource <JObject> completionSource; var sendRequest = false; lock (ResponseLock) { CheckRegistered(); // If a request is already running, await the same response completionSource = globalSettingsResponse; if (completionSource == null) { completionSource = new TaskCompletionSource <JObject>(); globalSettingsResponse = completionSource; sendRequest = true; } } if (sendRequest) { await client.GetGlobalSettings(); } return(await completionSource.Task); }
public IEnumerable <IStreamDeckEventMonitor> CreateEventMonitors(IStreamDeckClient client) { lock (application.eventMonitorFactories) { return(application.eventMonitorFactories.Select(f => f(client)).ToList()); } }
/// <summary> /// Wraps the getSettings and didReceiveSettings events into a single procedural method. /// </summary> /// <param name="client">An IStreamDeckClient instance as passed to the constructor of an IStreamDeckAction.</param> /// <remarks> /// Not available from a global event. /// </remarks> /// <returns>A json object containing data that you can set and are stored persistently.</returns> public static async Task <JObject> GetSettings(IStreamDeckClient client) { TaskCompletionSource <JObject> completionSource; var sendRequest = false; lock (ResponseLock) { CheckRegistered(); // If a request is already running, await the same response if (!SettingsResponse.TryGetValue(client.ActionContext, out completionSource)) { completionSource = new TaskCompletionSource <JObject>(); SettingsResponse.Add(client.ActionContext, completionSource); sendRequest = true; } } if (sendRequest) { await client.GetSettings(); } return(await completionSource.Task); }
public IEnumerable <IStreamDeckGlobalEvent> CreateGlobalEventHandlers(IStreamDeckClient client) { lock (application.factoriesLock) { return(application.globalEventFactories.Select(f => f(client)).ToList()); } }
public IStreamDeckAction CreateAction(string actionUUID, IStreamDeckClient client) { lock (application.factoriesLock) { return(application.actionFactories.TryGetValue(actionUUID, out var factory) ? factory(client) : null); } }
public ToggleMutedAction(IStreamDeckClient client) : base(client) { }
public VolumeUpAction(IStreamDeckClient client) : base(client) { }
public SetUnmutedAction(IStreamDeckClient client) : base(client) { }
public BaseAudioDeviceAction(IStreamDeckClient client) { Client = client; controllerSubscriber = Controller.AudioDeviceChanged.Subscribe(this); }
public SetDefaultAction(IStreamDeckClient client) : base(client) { }