示例#1
0
        async Task LoadplayerInfo(int matchid)
        {
            exampleJsInterop = new ExampleJsInterop(JSRuntime);
            playerlistlocal  = await exampleJsInterop.GetItem <Player2[]>("CreateTeam");

            // playerlistlocal = common.GetPlayerArray(await exampleJsInterop.GetItem<UserTeam>("CreateTeam"));
            autoken = await exampleJsInterop.GetStringItem <Object>("utoken");

            if (playerlistlocal == null)
            {
                playerlistlocal = await PlayerData.GetPlayerInfo(matchid, userteamid, autoken);
            }
            // { playerlistlocal = await PlayerData.GetPlayerInfo(matchid, autoken); }
            //else
            //{

            if (playerlistlocal.Where(T => T.player.isSelected == true).Count() == 11)
            {
                this.btncontinue = true;
            }
            if (playerlistlocal.Where(T => T.player.isSelected == true).Count() != 11)
            {
                this.btncontinue = false;
            }
            //  }

            Playerlist     = playerlistlocal.Where(p => p.player.playerRoleName == Common.PlayerType.WK.ToString()).ToArray();
            selectedPlayer = playerlistlocal.Where(T => T.player.isSelected == true).ToList();
            PlayerRoleWiseCount(playerlistlocal);
        }
        protected override async Task OnInitAsync()
        {
            var exampleJsInterop = new ExampleJsInterop(JSRuntime);

            PlayerList = await exampleJsInterop.GetItem <List <Player2> >("CreateTeam");

            selectedPlayer = PlayerList.Where(p => p.player.isSelected == true).ToList();
        }
        protected override async Task OnInitAsync()
        {
            var exampleJsInterop = new ExampleJsInterop(JSRuntime);

            //await exampleJsInterop.CallHelloHelperSayHello("Blazor");
            matches = await exampleJsInterop.GetItem <Match>("UserTeam2");


            appState._expenses.Clear();
        }
        public async Task Search(SearchCriteria criteria)
        {
            SearchInProgress = true;
            NotifyStateChanged();

            SearchResults = await http.PostJsonAsync <Itinerary[]>("/api/flightsearch", criteria);

            SearchInProgress = false;
            NotifyStateChanged();

            ExampleJsInterop.Prompt("I am Calling My Javascript File");
        }
示例#5
0
        public void Test2()
        {
            // Arrange
            using var ctx = new TestContext();
            var mockJS = ctx.Services.AddMockJSRuntime();

            mockJS.SetupVoid("exampleJsFunctions.showPrompt");
            var JSRuntime = ctx.Services.GetService <IJSRuntime>();

            // Act
            ExampleJsInterop.Prompt(JSRuntime, "message");

            // Assert
            mockJS.VerifyInvoke("exampleJsFunctions.showPrompt");
        }
        protected override async Task OnInitAsync()
        {
            exampleJsInterop = new ExampleJsInterop(JSRuntime);
            playerList       = await exampleJsInterop.GetItem <List <Player2> >("CreateTeam");

            authToken = await exampleJsInterop.GetStringItem <Object>("utoken");

            if (playerList == null)
            {
                selectedPlayer = await playerobj.GetPlayerData(matchid, userteamid, authToken);

                selectedPlayer = selectedPlayer.Where(p => p.player.isSelected == true).ToList();
            }
            else
            {
                selectedPlayer = playerList.Where(p => p.player.isSelected == true).ToList();
            }

            //string _saveteam = playerList.Where(p => p.isCaptain == true && p.isViceCaptain == true).ToString();
            //if (!string.IsNullOrEmpty(_saveteam)) this.btnsave = false;
        }
示例#7
0
 protected override Size MeasureOverride(Size availableSize)
 {
     if (_needsTextMeasure)
     {
         _needsTextMeasure = false;
         ExampleJsInterop.MeasureTextAsync(
             this.Element.Text,
             this.Element.FontFamily,
             this.Element.FontSize).ContinueWith(t =>
         {
             var width        = t.Result;
             this.DesiredSize = new Size(width, this.Element.FontSize * this.ActualLineHeight);
             this.Element.NativeSizeChanged();
             this.StateHasChanged();
         });
         return(new Size(1, this.Element.FontSize));
     }
     else
     {
         return(this.DesiredSize);
     }
 }
示例#8
0
 protected override Size MeasureOverride(Size availableSize)
 {
     if (_needsTextMeasure)
     {
         _needsTextMeasure = false;
         ExampleJsInterop.MeasureTextAsync(
             this.Element.Text,
             this.ActualFontFamily,
             this.Element.FontSize).ContinueWith(t =>
         {
             var width = t.Result;
             _textSize = new Size(width, this.Element.FontSize);
             this.Element.NativeSizeChanged();
             this.StateHasChanged();
         });
         return(new Size(
                    this.Element.Padding.HorizontalThickness
                    // + this.ActualBorderWidth * 2
                    ,
                    this.Element.FontSize +
                    this.Element.Padding.VerticalThickness
                    //+ this.ActualBorderWidth * 2
                    ));
     }
     else
     {
         return(new Size
         {
             Width = _textSize.Width +
                     this.Element.Padding.HorizontalThickness
                     //+ this.ActualBorderWidth * 2
             ,
             Height = _textSize.Height +
                      this.Element.Padding.VerticalThickness
                      //+ this.ActualBorderWidth * 2
         });
     }
 }
示例#9
0
        async Task Login()
        {
            exampleJsInterop = new ExampleJsInterop(JSRuntime);

            //Registers = await LoginData.UserLoginAsync(register);
            //Console.WriteLine(Registers);
            //if (Registers == null)
            //{
            //    error = "someting its wrong!!!";
            //}
            //else
            //{
            //   UriHelper.NavigateTo("/Home");
            //}

            if (register.username == null || register.password == null)
            {
                toastService.ShowToast("Can not null username & password", Common.ToastLevel.Error);
            }
            else
            {
                Registers = await LoginData.UserLoginAsync(register);

                Console.WriteLine(Registers);
                if (Registers.firstName != null)
                {
                    toastService.ShowToast("Welcome to " + Registers.username + "", Common.ToastLevel.Success);
                    await exampleJsInterop.SetStringItem <Login>("utoken", Registers.authToken);

                    UriHelper.NavigateTo("/Home");
                }
                else
                {
                    toastService.ShowToast("Something it's wrong", Common.ToastLevel.Error);
                }
            }
        }
示例#10
0
 void CommandPrompt()
 {
     ExampleJsInterop.Prompt("+1!");
 }
示例#11
0
 void IncrementCount()
 {
     currentCount += IncrementAmount;
     ExampleJsInterop.Prompt("+1!");
 }