Bläddra i källkod

апдейты запуска через внешний запрос

Rimmon 3 år sedan
förälder
incheckning
0cd464737a
5 ändrade filer med 21 tillägg och 7 borttagningar
  1. 9 0
      Models/AccountModel.cs
  2. 1 0
      Pages/Blockchains.razor
  3. 8 5
      Pages/WebAPI.razor
  4. 2 2
      Pages/_Host.cshtml
  5. 1 0
      Startup.cs

+ 9 - 0
Models/AccountModel.cs

@@ -1,4 +1,5 @@
 using System;
+using System.Linq;
 using System.Numerics;
 using System.Threading.Tasks;
 using System.Collections.Generic;
@@ -96,6 +97,14 @@ namespace HyperCube.Models
             return Current;
         }
 
+        public static AccountModel FindByMail(string mail)
+        {
+            var selectedUsers = from user in Loaded.Values
+                                where user.Email == mail
+                                select user;
+            return selectedUsers.First();
+        }
+
         public static AccountModel Find(string uuid)
         {
             if (uuid == null)

+ 1 - 0
Pages/Blockchains.razor

@@ -392,6 +392,7 @@
     protected override async Task OnInitializedAsync()
     {
         account = AccountModel.Current;
+        Console.WriteLine($"Blockchains OnInitializedAsync");
     }
 
     //private async Task GetBlockChain()

+ 8 - 5
Pages/WebAPI.razor

@@ -6,26 +6,29 @@
 
     @code
 {
-        protected override async Task OnInitializedAsync()
+        protected override async Task OnInitializedAsync()
         {
-
+            Console.WriteLine($"WebAPI OnInitializedAsync {Smart}");
         }
 
         protected override async Task OnParametersSetAsync()
         {
+            //Console.WriteLine($"WebAPI OnParametersSetAsync {Smart}");
             await Transfer50();
         }
 
         private async Task Transfer50()
         {
-            var acc = AccountModel.Find("5bb2a8ba-ed92-4eff-9eca-985483568b77");
+            //var acc = AccountModel.Find("5bb2a8ba-ed92-4eff-9eca-985483568b77");
+            var acc = AccountModel.FindByMail("valafar@mail.ru");
             if (acc != null)
             {
-                Console.WriteLine("acc found ");
+                AccountModel.Current = acc;
+                Console.WriteLine("acc found "+acc.Name);
                 var bc = Blockchain.GetMain();
                 if (bc != null)
                 {
-                    Console.WriteLine("bc found, Smart "+ Smart);
+                    //Console.WriteLine("bc found, Smart "+ Smart);
                     var addr = await acc.GetOrCreateActualAddress(bc);
                     var res = await bc.SendTransaction(Blockchain.GetMain().address, addr, Smart);
                 }

+ 2 - 2
Pages/_Host.cshtml

@@ -4,7 +4,7 @@
 @addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
 @{
     Layout = null;
-    HyperCube.Models.AccountModel.InitializeAccounts();
+//    HyperCube.Models.AccountModel.InitializeAccounts();
 }
 
 
@@ -19,7 +19,7 @@
     <link rel="stylesheet" href="css/style.min.css">
 </head>
 <body>
-    <component type="typeof(App)" render-mode="ServerPrerendered" />
+    <component type="typeof(App)" render-mode="Server" />
 
     @*<div id="blazor-error-ui">
         <environment include="Staging,Production">

+ 1 - 0
Startup.cs

@@ -23,6 +23,7 @@ namespace HyperCube
         public Startup(IConfiguration configuration)
         {
             Configuration = configuration;
+            Models.AccountModel.InitializeAccounts();
         }
 
         public IConfiguration Configuration { get; }