public Compiler(HttpClient client) { Current = this; async Task InitializeInternal() { try { var response = await client.GetJsonAsync <AssemblyLoadInfo[]>("/assemblies.json"); //await AssemblyCache.Current.LoadAssemblies(client, response); await Task.WhenAll(response.Select(x => AssemblyCache.Current.LoadAssembly(client, x))); //await Task.WhenAll(GetLocalAssembliesLoadInfo().Select(x => AssemblyCache.Current.LoadAssembly(client, x))); await AssemblyCache.Current.LoadAssembly(client, new AssemblyLoadInfo(null, "remlib/Microsoft.CodeAnalysis.CSharp.Features.dll")); await AssemblyCache.Current.LoadAssembly(client, new AssemblyLoadInfo(null, "remlib/WonkaBre.dll")); await AssemblyCache.Current.LoadAssembly(client, new AssemblyLoadInfo(null, "remlib/WonkaEth.dll")); await AssemblyCache.Current.LoadAssembly(client, new AssemblyLoadInfo(null, "remlib/WonkaPrd.dll")); await AssemblyCache.Current.LoadAssembly(client, new AssemblyLoadInfo(null, "remlib/WonkaRef.dll")); await AssemblyCache.Current.LoadAssembly(client, new AssemblyLoadInfo(null, "remlib/Nethereum.StandardTokenEIP20.dll")); await AssemblyCache.Current.LoadAssembly(client, new AssemblyLoadInfo(null, "remlib/Nethereum.Quorum.dll")); //await AssemblyCache.Current.LoadAssembly(client, // new AssemblyLoadInfo(null, "Microsoft.AspNetCore.Components.dll")); //await AssemblyCache.Current.LoadAssembly(client, // new AssemblyLoadInfo(null, "Microsoft.AspNetCore.Components.Web.dll")); ProjectEditorInitialiser.InitialiseProjectsFirstInit(); } catch (Exception ex) { Console.WriteLine("Error:" + ex.Message); } } InitializationTask = InitializeInternal(); }
protected override async Task OnInitializedAsync() { loadFileModel = new LoadFileModel(); loadFileModel.AllowedExtension = GetAllowedExtension(); loadFileModel.ContentLoaded += FileLoaded; savesAsFileModel = new SaveAsFileModel(); savesAsFileModel.SaveFileAs += SaveAsAsyncCallBack; SelectedCodeSample = 0; abiCodeGenerateModel = new AbiCodeGenerateModel(); abiCodeGenerateModel.CodeGenerate += AbiCodeGenerateCallBack; Task.Run(() => ProjectEditorInitialiser.InitialiseProject(GetEditorLanguage())); }
/// <summary> /// Super workaround: /// Storage is not available until we have rendered, /// We can then load User code samples stored in storage /// But if we call StateHasChanged then the Editor is duplicated /// So to avoid this a timer is set to run only one which will call StateHasChanged after /// 1 second /// </summary> /// <returns></returns> protected override async Task OnAfterRenderAsync() { ProjectEditorInitialiser.InitialiseProject(GetEditorLanguage()); if (!CodeSampleRepository.LoadedUserSamples) { await LoadSavedAsync(); //waiting a second to do a state has changed to display the items // and avoid confusion with the editor. _timer = new Timer(new TimerCallback(_ => { StateHasChanged(); _timer.Dispose(); }), null, 1000, 1000); } }