void EndpointsCTRL_ConnectEndpoint(object sender, ConnectEndpointEventArgs e) { try { if (m_running) { throw new InvalidOperationException("Test is already running."); } if (m_testConfiguration.Coverage == 0) { m_testConfiguration.Coverage = 100; } SetRunning(true); EndpointTB.Text = e.Endpoint.EndpointUrl.ToString(); TestsCompletedTB.Text = "---"; IterationTB.Text = "---"; TestCaseTB.Text = "---"; TestCaseProgressCTRL.Value = 0; ResultsTB.Clear(); ThreadPool.QueueUserWorkItem(Run, e.Endpoint); } catch (Exception exception) { GuiUtils.HandleException(this.Text, MethodBase.GetCurrentMethod(), exception); e.UpdateControl = false; } }
private void EndpointSelectorCTRL_ConnectEndpoint(object sender, ConnectEndpointEventArgs e) { try { // check if a test is already running. lock (m_lock) { if (m_running) { throw new InvalidOperationException("A test is already running."); } } ConfiguredEndpoint endpoint = e.Endpoint; // start processing. OkBTN.Enabled = m_running = true; ThreadPool.QueueUserWorkItem(new WaitCallback(DoTest), endpoint); } catch (Exception exception) { GuiUtils.HandleException(this.Text, MethodBase.GetCurrentMethod(), exception); e.UpdateControl = false; } }
//-------------------------- // UI Event Handlers //-------------------------- /// <summary> /// On connect button clicked /// -- connects to a specified server endpoint, close current server connection if any /// </summary> private async Task EndpointSelectorCTRL_ConnectEndpoint(object sender, ConnectEndpointEventArgs e) { try { // disable Connect while connecting button EndpointSelectorCTRL.IsEnabled = false; // Connect CloseSessionView_OpcuaClient(); e.UpdateControl = await Connect(e.Endpoint); if (e.UpdateControl) { gridEndpointSelector.Visibility = Visibility.Visible; txtEndpointSelector.Text = m_design_session.Endpoint.EndpointUrl.ToString(); EndpointSelectorCTRL.Visibility = Visibility.Collapsed; BrowseCTRL.IsEnabled = true; SessionsCTRL.IsEnabled = true; EnableSessionOpButtons(true); } } catch (Exception exception) { GuiUtils.HandleException(String.Empty, GuiUtils.CallerName(), exception); e.UpdateControl = false; } finally { // enable Connect button EndpointSelectorCTRL.IsEnabled = !e.UpdateControl; progringConnection.IsActive = false; } }
void EndpointSelectorCTRL_ConnectEndpoint(object sender, ConnectEndpointEventArgs e) { try { Connect(e.Endpoint); } catch (Exception exception) { GuiUtils.HandleException(this.Text, MethodBase.GetCurrentMethod(), exception); e.UpdateControl = false; } }
void OpcEndpoints_ConnectEndpoint(object sender, ConnectEndpointEventArgs e) { try { OPCConnect(this.application, opcEndpoints.SelectedEndpoint); } catch (Exception exception) { GuiUtils.HandleException(this.Text, MethodBase.GetCurrentMethod(), exception); e.UpdateControl = false; } }
void EndpointSelectorCTRL_ConnectEndpoint(object sender, ConnectEndpointEventArgs e) { try { TestEventsCTRL.Clear(); Connect(e.Endpoint, Test_UseNativeStackMI.Checked, 1024); } catch (Exception exception) { GuiUtils.HandleException(this.Text, MethodBase.GetCurrentMethod(), exception); e.UpdateControl = false; } }
async Task EndpointSelectorCTRL_ConnectEndpoint(object sender, ConnectEndpointEventArgs e) { try { // disable Connect while connecting button EndpointSelectorCTRL.IsEnabled = false; // Connect e.UpdateControl = await Connect(e.Endpoint); } catch (Exception exception) { GuiUtils.HandleException(String.Empty, GuiUtils.CallerName(), exception); e.UpdateControl = false; } finally { // enable Connect button EndpointSelectorCTRL.IsEnabled = true; } }