Exemplo n.º 1
0
 /// <summary>
 ///     Constructs a new <see cref="WebSocketPlugin"/> instance.
 /// </summary>
 /// <param name="connection">The Stream Deck connection.</param>
 /// <param name="payload">The initial payload.</param>
 public BasePlugin(ISDConnection connection, InitialPayload payload)
     : base(connection, payload)
 {
     // Deserialize settings or create a new instance.
     Settings = (payload.Settings == null || payload.Settings.Count == 0)
         ? new TSettings()
         : payload.Settings.ToObject <TSettings>();
     SetAuthenticationHeader();
 }
Exemplo n.º 2
0
 public PluginAction(ISDConnection connection, InitialPayload payload) : base(connection, payload)
 {
     if (payload.Settings == null || payload.Settings.Count == 0)
     {
         _settings = new PluginSettings();
         SaveSettingsAsync();
     }
     else
     {
         _settings = payload.Settings.ToObject <PluginSettings>();
     }
 }
Exemplo n.º 3
0
        public async Task <bool> ShowMixer(ISDConnection connection, MixerSettings mixerSettings)
        {
            this.connection    = connection;
            this.mixerSettings = mixerSettings;
            if (connection == null)
            {
                Logger.Instance.LogMessage(TracingLevel.ERROR, $"AudioMixerManager ShowMixer called with null connection");
                return(false);
            }

            streamDeckDeviceInfo = connection.DeviceInfo();
            int keys = streamDeckDeviceInfo.Size.Cols * streamDeckDeviceInfo.Size.Rows;

            currentPage = 0;
            appsPerPage = streamDeckDeviceInfo.Size.Cols - ACTION_KEY_COLUMN_START;
            if (!UIManager.Instance.RegisterUIHandler(this, keys))
            {
                Logger.Instance.LogMessage(TracingLevel.ERROR, $"AudioMixerManager RegisterGameHandler failed");
                return(false);
            }

            await FetchAudioApplications();

            // Wait until the GameUI Action keys have subscribed to get events
            int retries = 0;

            while (!UIManager.Instance.IsUIReady && retries < 100)
            {
                Thread.Sleep(100);
                retries++;
            }
            if (!UIManager.Instance.IsUIReady)
            {
                return(false);
            }

            // Generate game board
            GenerateMixer();
            tmrRefreshVolume.Start();

            return(true);
        }
Exemplo n.º 4
0
        public PluginAction(ISDConnection connection, InitialPayload payload) : base(connection, payload)
        {
            if (payload.Settings == null || payload.Settings.Count == 0)
            {
                this.settings = PluginSettings.CreateDefaultSettings();
            }
            else
            {
                this.settings = payload.Settings.ToObject <PluginSettings>();
            }

            Connection.OnApplicationDidLaunch          += Connection_OnApplicationDidLaunch;
            Connection.OnApplicationDidTerminate       += Connection_OnApplicationDidTerminate;
            Connection.OnDeviceDidConnect              += Connection_OnDeviceDidConnect;
            Connection.OnDeviceDidDisconnect           += Connection_OnDeviceDidDisconnect;
            Connection.OnPropertyInspectorDidAppear    += Connection_OnPropertyInspectorDidAppear;
            Connection.OnPropertyInspectorDidDisappear += Connection_OnPropertyInspectorDidDisappear;
            Connection.OnSendToPlugin             += Connection_OnSendToPlugin;
            Connection.OnTitleParametersDidChange += Connection_OnTitleParametersDidChange;
        }
Exemplo n.º 5
0
 /// <summary>
 ///     Constructs a new <see cref="BinarySwitchPlugin"/> instance.
 /// </summary>
 /// <param name="connection">The Stream Deck connection.</param>
 /// <param name="payload">The initial payload.</param>
 public BinarySwitchPlugin(ISDConnection connection, InitialPayload payload)
     : base(connection, payload)
 {
     GetInitialData().ConfigureAwait(true);
 }
 /// <summary>
 ///     Constructs a new <see cref="DimmerStatusPlugin"/> instance.
 /// </summary>
 /// <param name="connection">The Stream Deck connection.</param>
 /// <param name="payload">The initial payload.</param>
 public DimmerStatusPlugin(ISDConnection connection, InitialPayload payload)
     : base(connection, payload)
 {
     currentState = payload.State;
     GetInitialData().ConfigureAwait(true);
 }
Exemplo n.º 7
0
        /// <summary>
        /// Constructor for PluginBase. Receives the communication and plugin settings
        /// Note that the settings object is not used by the base and should be consumed by the deriving class.
        /// Usually, a private class inside the deriving class is created which stores the settings
        /// Example for settings usage:
        /// * if (payload.Settings == null || payload.Settings.Count == 0)
        /// * {
        /// *         // Create default settings
        /// * }
        /// * else
        /// * {
        ///     this.settings = payload.Settings.ToObject();
        /// * }
        ///
        /// </summary>
        /// <param name="connection">Communication module with Stream Deck</param>
        /// <param name="payload">Plugin settings - NOTE: Not used in base class, should be consumed by deriving class</param>
#pragma warning disable IDE0060 // Remove unused parameter
        public PluginBase(ISDConnection connection, InitialPayload payload)
#pragma warning restore IDE0060 // Remove unused parameter
        {
            Connection = connection;
        }
 /// <summary>
 ///     Constructs a new <see cref="ConnectionTestPlugin"/> instance.
 /// </summary>
 /// <param name="connection">The Stream Deck connection.</param>
 /// <param name="payload">The initial payload.</param>
 public ConnectionTestPlugin(ISDConnection connection, InitialPayload payload)
     : base(connection, payload)
 {
 }
Exemplo n.º 9
0
 /// <summary>
 ///     Constructs a new <see cref="WebSocketPlugin"/> instance.
 /// </summary>
 /// <param name="connection">The Stream Deck connection.</param>
 /// <param name="payload">The initial payload.</param>
 public WebSocketPlugin(ISDConnection connection, InitialPayload payload)
     : base(connection, payload)
 {
     CreateNewWebSocket();
 }