private void CreateMessageCenter() { MessagingCenter.Subscribe <List <int> >(this, "Lock", async l => { try { Lock.StartLockDevice(); //ActiveAdminDevice(); //LockDeivce(); } catch (System.Exception ex) { System.Diagnostics.Debug.WriteLine(ex.Message.ToString()); } }); MessagingCenter.Subscribe <List <int> >(this, "ShutDown", async l => { try { MenuControlPower.OpenMenuControl(); //ActiveAdminDevice(); //ShutDown(); } catch (System.Exception ex) { System.Diagnostics.Debug.WriteLine(ex.Message.ToString()); } }); }
public override StartCommandResult OnStartCommand(Intent intent, [GeneratedEnum] StartCommandFlags flags, int startId) { var bundle = intent.Extras; var isLockDeviceAction = bundle.GetBoolean("IsLockDeviceAction"); if (isLockDeviceAction) { Lock = new LockDevice(this); Lock.StartLockDevice(); } else { MenuControlPower = new MenuControlPower(this); MenuControlPower.OpenMenuControl(); } return(StartCommandResult.NotSticky); }