Пример #1
0
        public override async Task Init()
        {
            await NavService.PushAlertPopupAsync("Loading...");

            MeetingName = string.Empty;
            Users       = (await DataRetrievalService.GetUsersAsync()).ToObservableCollection();

            await NavService.PopAlertPopupsAsync();
        }
Пример #2
0
        public override async Task Init()
        {
            await NavService.PushAlertPopupAsync("Loading...");

            CurrentUser    = StateService.GetCurrentUser();
            CurrentCompany = await DataRetrievalService.GetCompanyByIdOrNull(CurrentUser.CompanyId);

            await NavService.PopAlertPopupsAsync();
        }
Пример #3
0
        public override async Task Init()
        {
            await NavService.PushAlertPopupAsync("Loading...");

            if (!_hasLoaded)
            {
                /* TOGGLE DEMO MODE HERE */

                /* DEMO MODE ON */
                //For development only -> Demo mode
                //StateService.SetCurrentUser(DemoUser.UserGeorge.ToModelObj());
                //await ((App)Application.Current).SetModeAndSync(true);

                /* DEMO MODE OFF - BYPASS AZURE AD AUTHENTICATION */
                // Hardcode authentication by doing this - robin's dev user - already in the db
                //await DataDownloadService.InsertOrReplaceAuthenticatedUser(Guid.Parse("b79ed0e3-ddb9-4920-8900-ffc55a73b4b5"));
                //var user = await DataRetrievalService.GetUserByEmailOrNullAsync("*****@*****.**");

                /* DEMO MODE OFF - USE AZURE AD AUTHENTICATION */
                //Assuming here that we will be using the same user that just authenticated
                //now that the user has logged in, we need to see if they are a bingoBuzz user, if not, we can add them
                //TODO: should probably do a try parse here if we add more providers
                await DataDownloadService.InsertOrReplaceAuthenticatedUser(
                    StateService.GetAuthEmail(),
                    Guid.Parse(StateService.GetAuthId()),
                    StateService.GetAuthGivenName(),
                    StateService.GetAuthSurName()
                    );

                var user = await DataRetrievalService.GetUserByEmailOrNullAsync(StateService.GetAuthEmail());

                /* END TOGGLE DEMO MODE HERE */

                if (user != null)
                {
                    StateService.SetCurrentUser(user);
                }
                else
                {
                    string whatHappened = "Can't find this BingoBuzz user!";
                    LoggingService.Error(whatHappened, LogMessageType.Instance.Info_Synchronization);
                    throw new Exception(whatHappened);
                }
                await((App)Application.Current).SetModeAndSync(user.UserId, false);

                //Load the contents of the welcome page
                Meetings   = (await DataRetrievalService.GetMeetingsAsync()).ToObservableCollection();
                _hasLoaded = true;
            }
            await CheckAppCenter();

            await NavService.PopAlertPopupsAsync();
        }
Пример #4
0
        public override async Task Init()
        {
            await NavService.PushAlertPopupAsync("Loading...");

            NumSquaresClicked = await DataRetrievalService.GetTotalNumberOfSquareClicks();

            NumBingos = await DataRetrievalService.GetTotalNumberOfBingos();

            NumGames = await DataRetrievalService.GetTotalNumberOfGames();

            await NavService.PopAlertPopupsAsync();
        }
Пример #5
0
        public override async Task Init(Guid meetingId)
        {
            await NavService.PushAlertPopupAsync("Loading...");

            Meeting = await DataRetrievalService.GetMeetingOrNullAsync(meetingId);

            if (Meeting != null)
            {
                var players = await DataRetrievalService.GetMeetingAttendeesAsync(meetingId);

                List <PlayerViewModel> playerVms = new List <PlayerViewModel>();
                foreach (var p in players)
                {
                    playerVms.Add(new PlayerViewModel()
                    {
                        PlayerName = $"{p.User_UserId.FirstName}  {p.User_UserId.LastName.Substring(0, 1)}.",
                        Score      = 0 //TODO: need to wire this up
                    });
                }
                Players = playerVms;
                RaisePropertyChanged(nameof(Players));

                BingoInstance = await DataRetrievalService.GetCurrentBingoInstanceOrNullAsync(meetingId);

                if (BingoInstance == null)
                {
                    //we need to make a new instance of this meeting, and make new content too
                    BingoInstance = await DataRetrievalService.CreateNewBingoInstance(meetingId);
                }

                BingoInstanceContent = await DataRetrievalService.GetBingoInstanceContentAsync(BingoInstance.BingoInstanceId);

                RaisePropertyChanged(nameof(BingoInstanceContent));
            }

            await NavService.PopAlertPopupsAsync();
        }