Esempio n. 1
0
        public HemPage()
        {
            InitializeComponent();

            bleACRProfileManager = App.BLEAcrProfileManager;
            //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;
            progBar.IsVisible      = false;
            progBarText.IsVisible  = false;
            progBarFirst.IsVisible = false;
            checkBattery.IsVisible = false;
            //btWarning.widthRequest = App.ScreenWidth * 160 / (App.ScreenDPI);
            batterystack.HorizontalOptions = LayoutOptions.CenterAndExpand;
            progBarText.BindingContext     = new { theprogtext = "........." };
            checkBattery.BindingContext    = new { bgc3 = Color.White };

            startDanger.Clicked += async(s, e) =>
            {
                if (App.isConnectedBLE && !App.dangerModeOn)
                {
                    //subNoTIFY.Dispose();
                    App.dangerModeOn = true;


                    var message = new StartLongRunningTaskMessage();
                    MessagingCenter.Send(message, "StartLongRunningTaskMessage");

                    connectToBackend(true);
                }
                else
                {
                    await DisplayAlert("Fel ", App.dangerModeOn? "Farligtläge är redan aktiverad." : "Anslut till en enhet först.", "Ok");
                }
                Task.Delay(500);     //Ska vi ta bort den ?
            };

            stopDanger.Clicked += (s, e) => {
                if (App.dangerModeOn)
                {
                    App.dangerModeOn = false;
                    connectToBackend(false);
                    App.ct.Cancel();
                    var message = new StopLongRunningTaskMessage();
                    MessagingCenter.Send(message, "StopLongRunningTaskMessage");
                }
            };
        }
Esempio n. 2
0
        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();
        }
Esempio n. 3
0
        public App()
        {
            InitializeComponent();


            UserManager    = new UserManager(new RestService());
            FriendsManager = new FriendsManager(new RestService());
            VictimManager  = new VictimManager(new RestService());

            BLEAcrProfileManager = new BLEAcrProfileManager();

            IProfileManager profileManager = new ProfileManager();

            _profileManager = profileManager;
            LoadProfile();


            PresentMainPage();
        }
Esempio n. 4
0
        public HemPage()
        {
            InitializeComponent();

            bleACRProfileManager = App.BLEAcrProfileManager;

            //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 += async(s, e) =>
            {
                if (App.isConnectedBLE)
                {
                    //subNoTIFY.Dispose();
                    dangerModeOn = true;
                    var message = new StartLongRunningTaskMessage();
                    MessagingCenter.Send(message, "StartLongRunningTaskMessage");
                }
                else
                {
                    await DisplayAlert("Wrong ", "Conect to a device first", "Ok");
                }
            };

            stopDanger.Clicked += (s, e) => {
                dangerModeOn = false;
                var message = new StopLongRunningTaskMessage();
                MessagingCenter.Send(message, "StopLongRunningTaskMessage");
            };
        }