public virtual void Off() { if (State != EPowerState.Broken) { State = EPowerState.Off; } }
public virtual void On() { if (State != EPowerState.Broken) { State = EPowerState.On; } }
static void OnBatteryChanged(Mouse mouse, uint voltage, float percent, EPowerState state) { if (state == EPowerState.OnBattery && voltage < settings.low_battery_voltage) { SendBatteryLowNotification(); } if (lastPowerState != state && state == EPowerState.Charged) { SendBatteryFullNotification(); } lastPowerState = state; lastVoltage = voltage; lastPercent = percent; }
static async Task <bool> RunMouse() { lastVoltage = 0; lastPowerState = 0; using Mouse mouse = await Mouse.GetConnected(); if (mouse != null && await mouse.Initialize()) { mouse.OnBatteryChanged = OnBatteryChanged; mouse.OnButtonChanged = OnMouseButtonsChanged; return(await mouse.ListenForEvents()); } return(false); }
//public virtual ISmartHouse Parent //{ // get // { // return parent; // } // set // { // parent = value; // } //} public virtual void Break() { State = EPowerState.Broken; }