/// <summary> /// Process an individual request. /// </summary> /// <param name="context"></param> /// <returns></returns> public Task Invoke(HttpContext context) { if (!_options.Path.HasValue || _options.Path == context.Request.Path) { var page = new DiagnosticsPage(); page.Execute(context); return(Task.FromResult(0)); } return(_next(context)); }
/// <summary> /// Process an individual request. /// </summary> /// <param name="environment"></param> /// <returns></returns> public Task Invoke(IDictionary <string, object> environment) { IOwinContext context = new OwinContext(environment); if (!_options.Path.HasValue || _options.Path == context.Request.Path) { var page = new DiagnosticsPage(); page.Execute(context); return(Task.FromResult(0)); } return(_next(environment)); }
/// <summary> /// Process an individual request. /// </summary> /// <param name="context"></param> /// <returns></returns> public override Task Invoke(IOwinContext context) { if (context == null) { throw new ArgumentNullException("context"); } if (!_options.Path.HasValue || _options.Path == context.Request.Path) { var page = new DiagnosticsPage(); page.Execute(context); return(CompletedTask()); } return(Next.Invoke(context)); }
public async Task Login_Diagnostics_SubjectValidated() { // Arrange await Task.Delay(TimeSpan.FromSeconds(5)); using IdentityApp app = _testContext.CreateApp <IdentityApp>(); // Act LoginPage page = app.Open <LoginPage>($"{app.TestContext.HostUrl}Diagnostics"); page.Login("alice", "alice"); DiagnosticsPage diag = app.WaitForPage <DiagnosticsPage>(); var subject = diag.SubjectClaimValue.Text; // Assert subject.Should().Be("818727"); OpenQA.Selenium.Screenshot ss = app.Driver.TakeScreenshot(); ss.SaveAsFile(@$ "c:\temp\magic-media.png"); }
public MainForm(string[] arguments) { m_loading = true; Visible = false; m_prefences = new Preferences(getPreferencesPath); Localization.SetCulture(m_prefences.General.Culture); InitializeComponent(); m_Port_ECU_Status = new MainForm.UltraStatusBarEx(m_statusPortECU); this.Icon = OCTech.OBD2.Applications.Properties.Resources.Application; this.Text = MainForm.ApplicationName; string titleBarCompany = Localization.GetTitleBarCompany(m_prefences.General.Culture); if (!string.IsNullOrEmpty(titleBarCompany)) Text = string.Format("{0} - {1}", Text, titleBarCompany); m_statusErrorECU = Localization.GetStatusBarBanner(m_prefences.General.Culture); m_mainForm = (Form)this; processCommandOptions(arguments); this.Disposed += new EventHandler(mainForm_Disposed); Version version = m_scanTool.GetType().Assembly.GetName().Version; int unlock = version.Major ^ version.Minor ^ version.Build ^ version.Revision; m_scanTool.Unlock(unlock); FileUtility.PathResolverReplacements.Add("[ApplicationName]", MainForm.ApplicationName); LoggableItem.RegisterLoggableItem( typeof(PIDLoggableItem), new LoggableItemXmlReader(PIDLoggableItem.FromXml) ); LoggableItem.RegisterLoggableItem( typeof(FuelLoggableItem), new LoggableItemXmlReader(FuelLoggableItem.FromXml) ); LoggableItem.RegisterLoggableItem( typeof(UserPIDLoggableItem), new LoggableItemXmlReader(UserPIDLoggableItem.FromXml) ); LoggableItem.RegisterLoggableItem( typeof(PIDPluginLoggableItem), new LoggableItemXmlReader(PIDPluginLoggableItem.FromXml) ); if (m_prefences.Layout.TouchScreenSize) { customListView.ItemSpacing = ListViewItemSpacing.Small; toolStripContainer.TopToolStripPanelVisible = false; } customListView.Add( OCTech.OBD2.Applications.Properties.Resources.SetupPageName, "Setup", OCTech.OBD2.Applications.Properties.Resources.p000075 ); customListView.Add( OCTech.OBD2.Applications.Properties.Resources.DiagPageName, "Diagnostics", OCTech.OBD2.Applications.Properties.Resources.p000026 ); customListView.Add( OCTech.OBD2.Applications.Properties.Resources.MonitorsPageName, "Monitors", OCTech.OBD2.Applications.Properties.Resources.p000045 ); customListView.Add( OCTech.OBD2.Applications.Properties.Resources.DashboardPageName, "Dashboard", OCTech.OBD2.Applications.Properties.Resources.p000015 ); customListView.Add( OCTech.OBD2.Applications.Properties.Resources.LogsPageName, "Logs", OCTech.OBD2.Applications.Properties.Resources.p000043 ); customListView.Add( OCTech.OBD2.Applications.Properties.Resources.ExitText, "Exit", OCTech.OBD2.Applications.Properties.Resources.p000032, true ); customListView.ItemSelected += new EventHandler<CustomListViewItemSelectedEventArgs>(customListView_ItemSelected); customListView.Font = this.Font; CurrentOperationStatus = OCTech.OBD2.Applications.Properties.Resources.SystemReadyText; ConnectedStatus = ConnectionStatus.NotConnected; if (m_prefences.Layout.SelectedPageKey == "Exit" || !m_prefences.Layout.RememberLastPageOnStartup || string.IsNullOrEmpty(m_prefences.Layout.SelectedPageKey) ) m_prefences.Layout.SelectedPageKey = "Setup"; m_scanTool.CommunicationErrorOccurred += new EventHandler<MessageEventArgs>(m_scanTool_CommunicationErrorOccurred); m_scanTool.SelectECU += new EventHandler<SelectedECUEventArgs>(m_scanTool_SelectECU); m_scanTool.ConnectionChanged += new EventHandler(m_scanTool_ConnectionChanged); m_scanTool.ConnectionStatusChanged += new EventHandler<ConnectionStatusChangedEventArgs>(m_scanTool_ConnectionStatusChanged); m_pidMonitor = new PIDMonitor(m_scanTool); m_pidMonitor.SetCulture(m_prefences.General.Culture); m_pidMonitor.ErrorOccurred += new EventHandler<OCTech.Utilities.ExceptionEventArgs>(utilities_ErrorOccurred); m_pidMonitor.NewPIDResponseArrived += new EventHandler<PIDResponseEventArgs>(m_pidMonitor_NewPIDResponseArrived); m_pidMonitor.NewPIDTimingAvailable += new EventHandler<PIDMonitorTimingEventArgs>(m_pidMonitor_NewPIDTimingAvailable); m_pidMonitor.Playback.RecordedPlaybackChanged += new EventHandler<RecordedDataPlayBackEventArgs>(m_pidMonitor_RecordedPlaybackChanged); FuelCalculator fuelCalculator = new FuelCalculator(m_pidMonitor, m_scanTool); fuelCalculator.ErrorOccurred += new EventHandler<OCTech.Utilities.ExceptionEventArgs>(utilities_ErrorOccurred); vehicleManagement = new VehicleManagement(this, m_scanTool, m_pidMonitor, fuelCalculator, this, MainForm.MyDocumentsPath); m_context = new AppContext(m_prefences, this, m_scanTool, m_pidMonitor, fuelCalculator, MainForm.MyDocumentsPath, MainForm.ApplicationDataDirectory, m_messageDispatcher, this, this, vehicleManagement); MainForm.m_StaticContext = m_context; TripManager.Initialize(m_context.ScanTool, m_context.PidMonitor, m_context.FuelCalculator, MainForm.ApplicationDataDirectory); TripManager.ErrorOccurred += new EventHandler<OCTech.Utilities.ExceptionEventArgs>(utilities_ErrorOccurred); pluginInitialize(); sensorCalibration = new SensorCalibration(); sensorCalibration.Initialize(m_context); DispatchPID.Initialize(m_context); m_setupPage = new SetupPage(m_context); m_setupPage.ColorModeChanged += new EventHandler<ColorModeChangedEventArgs>(m_setupPage_ColorModeChanged); m_diagnostic = new DiagnosticsPage(m_context); m_monitors = new MonitorsPage(m_context); m_dashboard = new CustomDashboard(m_context); m_logs = new LogsPage(m_context); m_TabPages.Add("Setup", m_setupPage); m_TabPages.Add("Diagnostics", m_diagnostic); m_TabPages.Add("Monitors", m_monitors); m_TabPages.Add("Dashboard", m_dashboard); m_TabPages.Add("Logs", m_logs); pagePanel.SuspendLayout(); addPageToPanel(m_setupPage); addPageToPanel(m_diagnostic); addPageToPanel(m_monitors); addPageToPanel(m_dashboard); addPageToPanel(m_logs); pagePanel.ResumeLayout(); m_StripMenus.Add("Setup", setupToolStripMenuItem); m_StripMenus.Add("Diagnostics", diagnosticsToolStripMenuItem); m_StripMenus.Add("Monitors", monitorsToolStripMenuItem); m_StripMenus.Add("Dashboard", dashboardToolStripMenuItem); m_StripMenus.Add("Logs", logsToolStripMenuItem); setControlsText(); setConnectButtonState(); loadOCTechPlugins(); if (m_PluginsInfo.Plugins.Count == 0 && !PIDPluginController.AreAnyPIDPluginAssembliesLoaded) pluginManagerToolStripMenuItem.Visible = false; if (!m_TabPages.ContainsKey(m_prefences.Layout.SelectedPageKey)) m_prefences.Layout.SelectedPageKey = "Setup"; switchPageByName(m_prefences.Layout.SelectedPageKey); customListView.SelectItem(m_prefences.Layout.SelectedPageKey); loadDataDashboard(getDataPath); try { m_pidMonitor.LoadSettings(MainForm.ApplicationDataDirectory); } catch { } m_setupPage.m001d9a(m_PluginsInfo); setColorTheme(ActiveTheme); m_scanTool.DebugEnabled = true; Gauge.ErrorOccurred += new EventHandler<Controls.ExceptionEventArgs>(controls_ErrorOccurred); PowerBar.ErrorOccurred += new EventHandler<Controls.ExceptionEventArgs>(controls_ErrorOccurred); RoundedLabel.ErrorOccurred += new EventHandler<Controls.ExceptionEventArgs>(controls_ErrorOccurred); LinearGauge.ErrorOccurred += new EventHandler<Controls.ExceptionEventArgs>(controls_ErrorOccurred); }