async void StandardClient_KeepAlive(Session sender, KeepAliveEventArgs e)
{
if (!Dispatcher.HasThreadAccess)
{
await Dispatcher.RunAsync(
CoreDispatcherPriority.Normal,
() =>
{
StandardClient_KeepAlive( sender, e);
});
return;
}
if (sender != null && sender.Endpoint != null)
{
ServerUrlTB.Text = Utils.Format(
"{0} ({1}) {2}",
sender.Endpoint.EndpointUrl,
sender.Endpoint.SecurityMode,
(sender.EndpointConfiguration.UseBinaryEncoding) ? "UABinary" : "XML");
}
else
{
ServerUrlTB.Text = "None";
}
if (e != null && m_session != null)
{
SessionsCTRL.UpdateSessionNode(m_session);
if (ServiceResult.IsGood(e.Status))
{
ServerStatusTB.Text = Utils.Format(
"Server Status: {0} {1:yyyy-MM-dd HH:mm:ss} {2}/{3}",
e.CurrentState,
e.CurrentTime.ToLocalTime(),
m_session.OutstandingRequestCount,
m_session.DefunctRequestCount);
ServerStatusTB.Foreground = new SolidColorBrush(Colors.Black);
ServerStatusTB.FontWeight = FontWeights.Normal;
}
else
{
ServerStatusTB.Text = String.Format(
"{0} {1}/{2}", e.Status,
m_session.OutstandingRequestCount,
m_session.DefunctRequestCount);
ServerStatusTB.Foreground = new SolidColorBrush(Colors.Red);
ServerStatusTB.FontWeight = FontWeights.Bold;
}
}
}