public HomePage() { BLEProfileManager = App.BLEProfileManager; InitializeComponent(); longRunningTask.Clicked += (s, e) => { if (BLEProfileManager.bleprofile.Devices.Count != 0) { string status = BLEProfileManager.bleprofile.Devices.FirstOrDefault().Device.State.ToString(); if (status.Equals("Disconnected")) { DisplayAlert("No BlueTooth ", "You need to connect to SmartBand Alert first", "Ok"); } else { var message = new StartLongRunningTaskMessage(); MessagingCenter.Send(message, "StartLongRunningTaskMessage"); } } else { DisplayAlert("No BlueTooth ", "You need to connect to SmartBand Alert first", "Ok"); } }; stopLongRunningTask.Clicked += (s, e) => { var message = new StopLongRunningTaskMessage(); MessagingCenter.Send(message, "StopLongRunningTaskMessage"); }; BindingContext = this; }
public Hem() { BLEProfileManager = App.BLEProfileManager; InitializeComponent(); theBTunits.IsPullToRefreshEnabled = true; stopDanger.BindingContext = new { w1 = App.ScreenWidth * 160 / (App.ScreenDPI), bgc2 = Color.White }; startDanger.BindingContext = new { w0 = App.ScreenWidth * 160 / (App.ScreenDPI), bgc1 = Color.FromHex("#ededed") }; //Battery progBar.BindingContext = new { w4 = App.ScreenWidth * 160 / (App.ScreenDPI * 3), theprog = 0.5 }; progBar.Scale = 1; batterystack.HorizontalOptions = LayoutOptions.CenterAndExpand; progBarText.BindingContext = new { theprogtext = "50%" }; checkBattery.BindingContext = new { bgc3 = Color.White }; startDanger.Clicked += (s, e) => { if (BLEProfileManager.bleprofile.Devices.Count != 0) { var device = BLEProfileManager.bleprofile.Devices.FirstOrDefault().Device; string status = device.State.ToString(); if (status.Equals("Disconnected")) { DisplayAlert("No BlueTooth ", "You need to connect to SmartBand Alert first", "Ok"); } else { //switchconnectbutton = 0; //App.isConnectedBLE = false; //need to be implement //BLEProfileManager.bleprofile.Adapter.DisconnectDeviceAsync(device); //BLEProfileManager.bleprofile.Devices.Clear(); //BLEProfileManager.init(); BLEProfileManager.newBLEprofile(); Task.Delay(1000); BLEProfileManager.bleprofile.Adapter.ConnectToDeviceAsync(device); Task.Delay(1000); var message = new StartLongRunningTaskMessage(); MessagingCenter.Send(message, "StartLongRunningTaskMessage"); } } else { DisplayAlert("No BlueTooth ", "You need to connect to SmartBand Alert first", "Ok"); } }; stopDanger.Clicked += (s, e) => { var message = new StopLongRunningTaskMessage(); MessagingCenter.Send(message, "StopLongRunningTaskMessage"); }; }
public App() { InitializeComponent(); UserManager = new UserManager(new RestService()); FriendsManager = new FriendsManager(new RestService()); VictimManager = new VictimManager(new RestService()); BLEProfileManager = new BLEProfileManager(); //NEW ADDED BLEAcrProfileManager = new BLEAcrProfileManager(); IProfileManager profileManager = new ProfileManager(); _profileManager = profileManager; LoadProfile(); //MainPage = new SmartBandAlertV6.MainPage(); PresentMainPage(); }