Example #1
0
		public virtual void Off()
		{
			if (State != EPowerState.Broken)
			{
				State = EPowerState.Off;
			}
		}
Example #2
0
		public virtual void On()
		{
			if (State != EPowerState.Broken)
			{
				State = EPowerState.On;
			}
		}
Example #3
0
        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;
        }
Example #4
0
        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);
        }
Example #5
0
		//public virtual ISmartHouse Parent
		//{
		//	get
		//	{
		//		return parent;
		//	}

		//	set
		//	{
		//		parent = value;
		//	}
		//}

		public virtual void Break()
		{
			State = EPowerState.Broken;
		}