// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IWebHostEnvironment env) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } else { app.UseExceptionHandler("/Error"); app.UseHsts(); } BackgroundQuery.QueryActivityAPI(); BackgroundQuery.InitAPIBackgroundQuery(); app.UseHttpsRedirection(); app.UseStaticFiles(); app.UseRouting(); app.UseAuthorization(); //app.UseRouter(BuildRouter(app)); app.UseEndpoints(endpoints => { endpoints.MapControllers(); endpoints.MapBlazorHub(); endpoints.MapFallbackToPage("/_Host"); }); }
public List <Activity> Get() { var holder = BackgroundQuery.GetHubActivities(); holder.AddRange(GetOwn()); return(holder); }
public Activity Get(string actId) { var entry = BackgroundQuery.GetHubActivities().Find(x => x.Codeacti == actId); if (entry == null) { entry = GetOwn(actId); } return(entry); }
private void TimerOnTick(object sender, EventArgs e) { UpdateStepStatus(); if (Workspace != null && _runningBackgroundQuery == null) { if (_completedBackgroundQuery == null || _completedBackgroundQuery.IsStale()) { _runningBackgroundQuery = new BackgroundQuery(this); _runningBackgroundQuery.RunQuery(); } } }
protected override void UpdateStepStatus() { if (null == Workspace) { _totalResults = _totalChromatograms = 0; _completedResults = _completedChromatograms = 0; } else { _totalChromatograms = Workspace.PeptideAnalyses.Select(peptideAnalysis => peptideAnalysis.FileAnalyses.Count).Sum(); _completedChromatograms = Workspace.PeptideAnalyses .Select(peptideAnalysis => peptideAnalysis.FileAnalyses.Count( fileAnalysis => fileAnalysis.ChromatogramSetId.HasValue)) .Sum(); _totalResults = _totalChromatograms; _completedResults = Workspace.PeptideAnalyses .Select(peptideAnalysis => peptideAnalysis.FileAnalyses.Count( fileAnalysis => fileAnalysis.PeakData.IsCalculated)) .Sum(); } if (null != _completedBackgroundQuery && !_completedBackgroundQuery.IsWorkspace(Workspace)) { _workspaceOpenTime = null; _completedBackgroundQuery.Dispose(); _completedBackgroundQuery = null; } if (null != _runningBackgroundQuery) { if (!_runningBackgroundQuery.IsWorkspace(Workspace)) { _runningBackgroundQuery.Dispose(); _runningBackgroundQuery = null; } else if (!_runningBackgroundQuery.IsRunning) { _completedBackgroundQuery = _runningBackgroundQuery; _runningBackgroundQuery = null; } } if (null == Workspace || !Workspace.IsLoaded) { if (null == Workspace) { lblResultsStatus.Text = lblChromatogramStatus.Text = "No workspace is open"; } else { lblResultsStatus.Text = lblChromatogramStatus.Text = "Waiting for workspace to load"; } SetProgressBarValue(progressBarChromatograms, 0); SetProgressBarValue(progressBarResults, 0); } if (0 == _totalChromatograms) { lblChromatogramStatus.Text = "No chromatograms need to be calculated in this workspace. Choose some peptides to analyze."; SetProgressBarValue(progressBarChromatograms, 0); } else { lblChromatogramStatus.Text = string.Format("{0} of {1} chromatograms generated.", _completedChromatograms, _totalChromatograms); SetProgressBarValue(progressBarChromatograms, 100 * _completedChromatograms / _totalChromatograms); } if (0 == _totalResults || 0 == _totalChromatograms) { lblResultsStatus.Text = "No results need to be calculated in this workspace. Choose some peptides to analyze."; SetProgressBarValue(progressBarResults, 0); } else { lblResultsStatus.Text = string.Format("{0} of {1} results calculated.", _completedResults, _totalResults); SetProgressBarValue(progressBarResults, 100 * _completedResults / _totalResults); } if (null != _completedBackgroundQuery) { if (_workspaceOpenTime == null) { _firstSeenLockTime.Clear(); } foreach (var lockId in _completedBackgroundQuery.ForeignLockIds) { if (!_firstSeenLockTime.ContainsKey(lockId)) { _firstSeenLockTime.Add(lockId, DateTime.Now); } } foreach (var lockId in _firstSeenLockTime.Keys.ToArray().Except(_completedBackgroundQuery.ForeignLockIds)) { _firstSeenLockTime.Remove(lockId); } if (_workspaceOpenTime == null) { _workspaceOpenTime = DateTime.Now; } DateTime staleTime = new DateTime(Math.Min(DateTime.Now.AddMinutes(-ExistingForeignLockStaleTimeMinutes).Ticks, Math.Max(_workspaceOpenTime.Value.Ticks, DateTime.Now.AddMinutes(-NewForeignLockStaleTimeMinutes).Ticks))); int staleForeignLockCount = _firstSeenLockTime.Values.Count(time => staleTime.CompareTo(time) > 0); if (0 == staleForeignLockCount) { panelForeignLocks.Visible = false; } else { lblForeignLocks.Text = string.Format( "The database says that there are {0} tasks being performed by other instances of Topograph", staleForeignLockCount); panelForeignLocks.Visible = true; } } base.UpdateStepStatus(); }
public List <Activity> Search(string search) => _activities.Find(x => x.ActiTitle.ToLower().Contains(search.ToLower())) .ToList() .Concat( BackgroundQuery.GetHubActivities().FindAll(x => x.ActiTitle.ToLower().Contains(search.ToLower())) ).ToList();