本文整理汇总了C#中ConfiguredEndpoint.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# ConfiguredEndpoint.ToString方法的具体用法?C# ConfiguredEndpoint.ToString怎么用?C# ConfiguredEndpoint.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ConfiguredEndpoint
的用法示例。
在下文中一共展示了ConfiguredEndpoint.ToString方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Connect
/// <summary>
/// Connects to a server.
/// </summary>
/// <param name="endpoint">The server endpoint</param>
/// <param name="oldlvi">null if a new connection. non-null if an existing disconnected connection</param>
public void Connect(ConfiguredEndpoint endpoint, ListViewItem oldlvi)
{
try
{
if (endpoint == null)
{
return;
}
if (ServerListView.Items.ContainsKey(endpoint.ToString()))
{
MessageBox.Show("endpoint already in use");
return;
}
ServerConnection connection = new ServerConnection(endpoint);
if (connection.m_Endpoint.UpdateBeforeConnect)
{
UpdateEndpoint(connection.m_Endpoint);
}
// create the channel.
connection.m_channel = SessionChannel.Create(
m_configuration,
connection.m_Endpoint.Description,
connection.m_Endpoint.Configuration,
m_bindingFactory,
m_configuration.SecurityConfiguration.ApplicationCertificate.Find(),
null);
connection.m_session = new Session(connection.m_channel, m_configuration, connection.m_Endpoint);
connection.m_session.ReturnDiagnostics = DiagnosticsMasks.All;
// Set up good defaults
connection.m_session.DefaultSubscription.PublishingInterval = 1000;
connection.m_session.DefaultSubscription.KeepAliveCount = 3;
connection.m_session.DefaultSubscription.Priority = 0;
connection.m_session.DefaultSubscription.PublishingEnabled = true;
connection.m_session.DefaultSubscription.DefaultItem.SamplingInterval = 1000;
if (new SessionOpenDlg().ShowDialog(connection.m_session, new List<string>()) == true)
{
NodeId ServerStartTimeNodeId = new NodeId(Variables.Server_ServerStatus_StartTime);
NodeId ServerCurrentTimeNodeId = new NodeId(Variables.Server_ServerStatus_CurrentTime);
NodeId ServerStateNodeId = new NodeId(Variables.Server_ServerStatus_State);
// Save in the map
m_Connections.Add(connection.m_Endpoint.Description.EndpointUrl.ToString(), connection);
// Add to list control
ListViewItem lvi = ServerListView.Items.Add(connection.m_session.SessionId.ToString(), "", -1);
lvi.SubItems.Add("").Name = ServerStartTimeNodeId.Identifier.ToString();
lvi.SubItems.Add("").Name = ServerCurrentTimeNodeId.Identifier.ToString();
lvi.SubItems.Add("").Name = ServerStateNodeId.Identifier.ToString();
lvi.SubItems.Add("");
lvi.SubItems.Add("");
lvi.SubItems.Add("");
lvi.SubItems.Add("");
lvi.Tag = connection;
if (oldlvi != null)
{
ServerListView.Items.Remove(oldlvi);
}
connection.m_session.KeepAlive += new KeepAliveEventHandler(StandardClient_KeepAlive);
connection.m_Subscription = new Subscription(connection.m_session.DefaultSubscription);
connection.m_Subscription.DisplayName = connection.m_session.ToString();
bool bResult = connection.m_session.AddSubscription(connection.m_Subscription);
connection.m_Subscription.Create();
MonitoredItem startTimeItem = new MonitoredItem(connection.m_Subscription.DefaultItem);
INode node = connection.m_session.NodeCache.Find(ServerStartTimeNodeId);
startTimeItem.DisplayName = connection.m_session.NodeCache.GetDisplayText(node);
startTimeItem.StartNodeId = ServerStartTimeNodeId;
startTimeItem.NodeClass = (NodeClass)node.NodeClass;
startTimeItem.AttributeId = Attributes.Value;
connection.m_Subscription.AddItem(startTimeItem);
startTimeItem.Notification += m_ItemNotification;
MonitoredItem currentTimeItem = new MonitoredItem(connection.m_Subscription.DefaultItem);
INode currentTimeNode = connection.m_session.NodeCache.Find(ServerCurrentTimeNodeId);
currentTimeItem.DisplayName = connection.m_session.NodeCache.GetDisplayText(currentTimeNode);
currentTimeItem.StartNodeId = ServerCurrentTimeNodeId;
currentTimeItem.NodeClass = (NodeClass)currentTimeNode.NodeClass;
currentTimeItem.AttributeId = Attributes.Value;
connection.m_Subscription.AddItem(currentTimeItem);
currentTimeItem.Notification += m_ItemNotification;
MonitoredItem stateItem = new MonitoredItem(connection.m_Subscription.DefaultItem);
INode stateNode = connection.m_session.NodeCache.Find(ServerStateNodeId);
stateItem.DisplayName = connection.m_session.NodeCache.GetDisplayText(stateNode);
stateItem.StartNodeId = ServerStateNodeId;
stateItem.NodeClass = (NodeClass)stateNode.NodeClass;
//.........这里部分代码省略.........
示例2: Connect
/// <summary>
/// Connects to a endpoint.
/// </summary>
private void Connect(ConfiguredEndpoint endpoint, bool useAnsiCStack, ushort keySize)
{
try
{
TestEvent e = new TestEvent();
e.Timestamp = DateTime.Now;
e.TestId = 0;
e.Iteration = 0;
e.EventType = TestEventType.Started;
e.Details = endpoint.ToString();
this.TestEventsCTRL.AddEvent(e);
CreateClient(useAnsiCStack, keySize);
m_client.BeginExecuteTestSequence(endpoint);
TestCancelMI.Enabled = true;
}
catch (Exception exception)
{
MessageBox.Show("Connect");
GuiUtils.HandleException(this.Text, MethodBase.GetCurrentMethod(), exception);
TestCancelMI.Enabled = false;
}
}