Exemple #1
0
 public InitSettingPageViewModel(INavigationService navigationService)
     : base(navigationService)
 {
     _navigationService = navigationService;
     Title = "Permissions for device (BLE)";
     AppUtils.CheckPermission();
 }
Exemple #2
0
        public BeaconPageViewModel(INavigationService navigationService, IBeaconService beaconService)
            : base(navigationService)
        {
            _navigationService = navigationService;
            _beaconService     = beaconService;
            Title = "Beacon Page";
            AppUtils.CheckPermission();

            _beaconService.InitializeService();
            _beaconService.StartBeacon();

            UserData userData = new UserData();

            userData.Uuid  = AppConstants.AppUUID;
            userData.Major = "23";
            userData.Minor = "45";
            _beaconService.StartAdvertising(userData);

            /*
             * try
             * {
             *  beaconService =DependencyService.Get<IBeaconService>();
             * }
             * catch (Exception e)
             * {
             *  Console.WriteLine(e);
             * }
             */

            //beaconService.StartBeacon();
            //beaconService.StopAdvertising();
            var beaconList = _beaconService.GetBeaconData();
            //var list = beaconService.GetBeaconData();

            var dummyCell = new BeaconViewCell();

            dummyCell.UUID.Value = "AAAAAAAAAA";

            //beaconList.Add(dummyCell);
            //beaconList.Add(dummyCell);

            // Create User
            // TODO Check Register User (UUID.Major.Minor) or New
            // POST New User and Store local properities

            /*
             * if (!Application.Current.Properties.ContainsKey("UserData"))
             * {
             *  // Access REST API and new id case
             *  UserData userData = new UserData();
             *  userData.Uuid = AppConstants.AppUUID;
             *  userData.Major = "23";
             *  userData.Minor = "45";
             *  Application.Current.Properties["UserData"] = userData;
             * }
             */
        }
        public BeaconPageViewModel(INavigationService navigationService)
            : base(navigationService)
        {
            _navigationService = navigationService;
            Title = "Beacon Page";
            AppUtils.CheckPermission();

            // Create User
            // TODO Check Register User (UUID.Major.Minor) or New
            // POST New User and Store local properities
            if (!Application.Current.Properties.ContainsKey("UserData"))
            {
                // Access REST API and new id case
                UserData userData = new UserData();
                userData.Uuid  = AppConstants.AppUUID;
                userData.Major = "23";
                userData.Minor = "45";
                Application.Current.Properties["UserData"] = userData;
            }
        }
Exemple #4
0
        protected override async void OnInitialized()
        {
            InitializeComponent();
            LogUnobservedTaskExceptions();

            Distribute.ReleaseAvailable    = OnReleaseAvailable;
            Push.PushNotificationReceived += OnPushNotificationReceived;
            AppCenter.Start($"android={AppConstants.AppCenterTokensAndroid};ios={AppConstants.AppCenterTokensIOS};", typeof(Analytics), typeof(Crashes), typeof(Distribute), typeof(Push));
            Container.Resolve <ILogger>().Log("Started App Center");

            INavigationResult result;
            // Check user data and skip tutorial
            UserDataService userDataService = Xamarin.Forms.DependencyService.Resolve <UserDataService>();

            if (userDataService.IsExistUserData)
            {
                UserDataModel _userData = userDataService.Get();
                _beaconService = Xamarin.Forms.DependencyService.Resolve <IBeaconService>();
                // Only Call InitializeService! Start automagically!
                AppUtils.CheckPermission();
                _beaconService.InitializeService();
                result = await NavigationService.NavigateAsync("NavigationPage/HomePage");
            }
            else
            {
                result = await NavigationService.NavigateAsync("NavigationPage/StartTutorialPage");
            }

            if (!result.Success)
            {
                MainPage = new ExceptionPage
                {
                    BindingContext = new ExceptionPageViewModel()
                    {
                        Message = result.Exception.Message
                    }
                };
                System.Diagnostics.Debugger.Break();
            }
        }
Exemple #5
0
        protected override async void OnInitialized()
        {
            InitializeComponent();
            INavigationResult result;

            // Check user data and skip tutorial
            UserDataService userDataService = Xamarin.Forms.DependencyService.Resolve <UserDataService>();

            //UserDataModel userData =await userDataService.Register();

            if (userDataService.IsExistUserData())
            {
                _userData      = userDataService.Get();
                _beaconService = Xamarin.Forms.DependencyService.Resolve <IBeaconService>();
                // Only Call InitializeService! Start automagically!
                AppUtils.CheckPermission();
                _beaconService.InitializeService();

                result = await NavigationService.NavigateAsync("NavigationPage/HomePage");
            }
            else
            {
                result = await NavigationService.NavigateAsync("NavigationPage/StartTutorialPage");
            }

            if (!result.Success)
            {
                MainPage = new ExceptionPage
                {
                    BindingContext = new ExceptionPageViewModel()
                    {
                        Message = result.Exception.Message
                    }
                };
                System.Diagnostics.Debugger.Break();
            }
        }
 public InitSettingPageViewModel(INavigationService navigationService) : base(navigationService)
 {
     Title = Resx.AppResources.TitleDeviceAccess;
     AppUtils.CheckPermission();
 }