protected override async Task OnInitializedAsync()
        {
            var authState = await AuthenticationStateTask;

            var claimToken = authState.User.Claims.FirstOrDefault(it => it.Type == System.Security.Claims.ClaimTypes.Sid);

            var claimConnection = authState.User.Claims.FirstOrDefault(it => it.Type == System.Security.Claims.ClaimTypes.Uri);

            HyperStore = await NetStore.ConnectAsyncThrows(claimConnection.Value);

            HyperStore.DefaultAuthenticationInfo = new HyperAuthenticationInfo()
            {
                Auth = new HyperArgsAuthentication()
                {
                    Token = claimToken.Value
                }
            };

            try
            {
                // Verify connection is correct.
                await HyperStore.ExecuteAsyncThrows(new RetrieveAssetsIdsArgs()
                {
                    Limit = 1
                });
            }
            catch (Exception ex)
            {            // Handle failed login here.
            }

            await base.OnInitializedAsync();
        }
 public void InitStore(NetStore netStore)
 {
     if (netStore != null)
     {
         _netStore = netStore;
     }
 }
示例#3
0
        public async Task InitStoreAsync(
            HyperConnectionSettings connection)
        {
            if (connection == null)
            {
                throw new ArgumentException(nameof(connection));
            }
            if (string.IsNullOrWhiteSpace(connection.ConnectionUri))
            {
                throw new ArgumentException(nameof(connection.ConnectionUri));
            }

            _netStore = await NetStore.ConnectAsyncThrows(connection.ConnectionUri);

            _request = OwnerComponent?.GetObjectFromQueryString <CrossModuleVisualizationRequest>("request");

            if (_request != null)
            {
                _request.MissionIds = _request.MissionDocIds?.Select(t => t.Id).ToArray();
            }

            FilterVm.TimeRangeOptions       = GetTimeRangeOptions();
            FilterVm.MissionInstanceOptions = await GetMissionInstanceOptionsAsync();

            FilterVm.SelectedMissionInstance = _request?.MissionInstanceDocIds?.FirstOrDefault().Id ?? "0";
        }
示例#4
0
 public async Task InitAsync(string name, string connectionUrl)
 {
     try
     {
         this.Name = name;
         _netStore = await NetStore.ConnectAsyncThrows(connectionUrl);
     }
     catch (Exception ex)
     {
     }
 }
 public async Task InitStoreAsync(HyperConnectionSettings connection)
 {
     if (connection != null)
     {
         try
         {
             _netStore = await NetStore.ConnectAsyncThrows(connection.ConnectionUri);
         }
         catch (Exception ex)
         {
             Logger.Instance.Error("Cannot establish the specified connection", ex.Message);
         }
     }
 }
示例#6
0
        public async Task InitStoreAsync(HyperConnectionSettings connection)
        {
            if (connection == null)
            {
                throw new ArgumentException(nameof(connection));
            }
            if (string.IsNullOrWhiteSpace(connection.ConnectionUri))
            {
                throw new ArgumentException(nameof(connection.ConnectionUri));
            }

            ServerUri = connection.ConnectionUri;
            try
            {
                _netStore = await NetStore.ConnectAsyncThrows(ServerUri);
            }
            catch (Exception ex)
            {
                Logger.Instance.Error("Cannot establish the specified connection", ex.Message);
            }
        }