Exemple #1
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();
            this._touchBarDelegate.ColorSelected    += (_, color) => this.ColorSelector.Color = color;
            this._touchBarDelegate.TurnOffRequested += (_, __) => BlynclightControl.TurnOffV30Light(0);

            BlynclightControl.FindDevices(ref this._numberOfDevices);
        }
Exemple #2
0
        private void OnColorChanged(NSColor color)
        {
            var r = (byte)(color.RedComponent * ToNumbersConstant);
            var g = (byte)(color.GreenComponent * ToNumbersConstant);
            var b = (byte)(color.BlueComponent * ToNumbersConstant);

            Debug.WriteLine($"(r,g,b) = ({r},{g},{b})");

            if (this._numberOfDevices < 1)
            {
                return;
            }
            // note: first device
            BlynclightControl.TurnOnRGBLights(0, r, g, b);
        }
Exemple #3
0
 public override void ViewWillDisappear()
 {
     base.ViewWillDisappear();
     this._colorChangedObserver.Dispose();
     BlynclightControl.TurnOffV30Light(0);
 }
Exemple #4
0
 public override void WillTerminate(NSNotification notification)
 {
     // Insert code here to tear down your application
     BlynclightControl.ReleaseDevices();
 }