Example #1
0
        /// <summary>
        /// Creates a new <see cref="IChroma" /> instance using the specified API instance.
        /// </summary>
        /// <param name="info">Information about the application.</param>
        /// <param name="api">The API instance to use to route SDK calls.</param>
        /// <returns>A new instance of <see cref="IChroma" />.</returns>
        public static async Task <IChroma> CreateAsync(AppInfo info, IChromaApi api)
        {
            await ClearCurrentAsync().ConfigureAwait(false);

            _instance = new ChromaImplementation(api, info);
            return(_instance);
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="ChromaImplementation" /> class.
 /// </summary>
 /// <param name="api">API instance to use.</param>
 /// <param name="info">Information about the application.</param>
 public ChromaImplementation(IChromaApi api, AppInfo info)
 {
     _api             = api;
     _deviceInstances = new Dictionary <Guid, IGenericDevice>();
     Version          = typeof(ChromaImplementation).GetTypeInfo().Assembly.GetName().Version;
     InitializeAsync(info).Wait();
 }
Example #3
0
        /// <inheritdoc />
        /// <summary>
        /// Initializes a new instance of the <see cref="GenericDeviceImplementation" /> class.
        /// </summary>
        /// <param name="deviceId">The <see cref="Guid" /> of the device.</param>
        /// <param name="api">Reference to the Chroma API instance in use.</param>
        /// <exception cref="UnsupportedDeviceException">
        /// Thrown if <paramref name="deviceId" /> is not a valid Razer Chroma device ID.
        /// </exception>
        public GenericDeviceImplementation(Guid deviceId, IChromaApi api)
            : base(api)
        {
            Log.InfoFormat("New generic device initializing: {0}", deviceId);

            if (!Devices.IsValidId(deviceId))
            {
                throw new UnsupportedDeviceException(deviceId);
            }

            DeviceId = deviceId;
        }
        /// <inheritdoc />
        /// <summary>
        /// Initializes a new instance of the <see cref="KeyboardImplementation" /> class.
        /// </summary>
        public KeyboardImplementation(IChromaApi api)
            : base(api)
        {
            Log.Info("Keyboard initializing...");

            CurrentEffectId = Guid.Empty;

            // We keep a local copy of a grid to speed up grid operations
            Log.Debug("Initializing private copy of Custom");
            _grid = CustomKeyboardEffect.Create();

            Log.Debug("Initializing private copy of Deathstalker grid");
            _deathstalkerGrid = DeathstalkerGridEffect.Create();
        }
Example #5
0
 /// <summary>
 /// Initializes a new instance of the <see cref="DeviceImplementation" /> class.
 /// </summary>
 /// <param name="api">Reference to the Chroma API in use.</param>
 /// <exception cref="ArgumentNullException">Thrown if <paramref name="api" /> is null.</exception>
 protected DeviceImplementation(IChromaApi api) => Api = api ?? throw new ArgumentNullException(nameof(api));
Example #6
0
 /// <inheritdoc />
 /// <summary>
 /// Initializes a new instance of the <see cref="KeypadImplementation" /> class.
 /// </summary>
 public KeypadImplementation(IChromaApi api)
     : base(api)
 {
     Log.Debug("Keypad is initializing");
     _custom = CustomKeypadEffect.Create();
 }
 /// <inheritdoc />
 /// <summary>
 /// Initializes a new instance of the <see cref="MousepadImplementation" /> class.
 /// </summary>
 public MousepadImplementation(IChromaApi api)
     : base(api)
 {
     Log.Debug("Mousepad is initializing.");
     _custom = CustomMousepadEffect.Create();
 }
 /// <inheritdoc />
 /// <summary>
 /// Initializes a new instance of the <see cref="HeadsetImplementation" /> class.
 /// </summary>
 /// <param name="api">Reference to the Chroma API instance in use.</param>
 public HeadsetImplementation(IChromaApi api)
     : base(api)
 {
     Log.Info("Headset is initializing");
     _custom = CustomHeadsetEffect.Create();
 }
 /// <inheritdoc />
 /// <summary>
 /// Initializes a new instance of the <see cref="ChromaLinkImplementation" /> class.
 /// </summary>
 public ChromaLinkImplementation(IChromaApi api)
     : base(api)
 {
     Log.Debug("Chroma Link is initializing");
     _custom = CustomChromaLinkEffect.Create();
 }
Example #10
0
 /// <inheritdoc />
 /// <summary>
 /// Initializes a new instance of the <see cref="MouseImplementation" /> class.
 /// </summary>
 public MouseImplementation(IChromaApi api)
     : base(api)
 {
     Log.Info("Mouse is initializing");
     _custom = CustomMouseEffect.Create();
 }