本文整理汇总了C#中ConnectionState.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# ConnectionState.ToString方法的具体用法?C# ConnectionState.ToString怎么用?C# ConnectionState.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ConnectionState
的用法示例。
在下文中一共展示了ConnectionState.ToString方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Handle
/// <summary>Executes behavior.</summary>
/// <param name="state">Connection state.</param>
public void Handle(ConnectionState state)
{
if (state == ConnectionState.Connected)
_viewModel.IsBusy = false;
else
ErrorManager.Error(state.ToString());
}
示例2: fireConnectStateChange
private void fireConnectStateChange(ConnectionState state, string message)
{
Trace.WriteLine("ConnectStateChange : " + state.ToString() + " " + message);
State = state;
if (ConnectionStateChanged != null)
{
ConnectionStateChangeEventArgs args = new ConnectionStateChangeEventArgs(State);
args.Message = message;
ConnectionStateChanged(this, args);
}
}
示例3: _pusher_ConnectionStateChanged
static void _pusher_ConnectionStateChanged(object sender, ConnectionState state)
{
Console.WriteLine("Connection state: " + state.ToString());
}
示例4: ConnectionStateMsg
static private string ConnectionStateMsg(ConnectionState state)
{
switch (state)
{
case (ConnectionState.Closed):
case (ConnectionState.Connecting | ConnectionState.Broken):
return Res.GetString(Res.ADP_ConnectionStateMsg_Closed);
case (ConnectionState.Connecting):
return Res.GetString(Res.ADP_ConnectionStateMsg_Connecting);
case (ConnectionState.Open):
return Res.GetString(Res.ADP_ConnectionStateMsg_Open);
case (ConnectionState.Open | ConnectionState.Executing):
return Res.GetString(Res.ADP_ConnectionStateMsg_OpenExecuting);
case (ConnectionState.Open | ConnectionState.Fetching):
return Res.GetString(Res.ADP_ConnectionStateMsg_OpenFetching);
default:
return Res.GetString(Res.ADP_ConnectionStateMsg, state.ToString());
}
}
示例5: _pusher_ConnectionStateChanged
private void _pusher_ConnectionStateChanged(object sender, ConnectionState state)
{
ConsoleWriteLine("Connection state: " + state.ToString());
if (state == ConnectionState.Disconnected)
{
RunOnUiThread(() =>
{
_pusher.ConnectionStateChanged -= _pusher_ConnectionStateChanged;
Toast.MakeText(this, GetString(Resource.String.ToastDisconnected), ToastLength.Short).Show();
SetViewAndChildrenEnabled(_layoutConnectDisconnect, true);
SetViewAndChildrenEnabled(_layoutSendMessage, false);
_buttonStart.Text = GetString(Resource.String.ButtonConnect);
_editMessage.Hint = "";
});
}
}
示例6: RefreshConnectText
private void RefreshConnectText(ConnectionState newState)
{
switch (newState)
{
case ConnectionState.Connected:
UpdateNetworkStatus(false, newState.ToString());
_connectedToServer = true;
break;
case ConnectionState.Disconnected:
UpdateNetworkStatus(false, newState.ToString());
_connectedToServer = false;
break;
default:
UpdateNetworkStatus(null, newState.ToString());
break;
}
_settingsPage.RefreshIsConnected(_connectedToServer);
}
示例7: ConnectionStateMsg
private static string ConnectionStateMsg(ConnectionState state)
{
switch (state)
{
case ConnectionState.Closed:
case (ConnectionState.Broken | ConnectionState.Connecting):
return System.Data.Res.GetString("ADP_ConnectionStateMsg_Closed");
case ConnectionState.Open:
return System.Data.Res.GetString("ADP_ConnectionStateMsg_Open");
case ConnectionState.Connecting:
return System.Data.Res.GetString("ADP_ConnectionStateMsg_Connecting");
case (ConnectionState.Executing | ConnectionState.Open):
return System.Data.Res.GetString("ADP_ConnectionStateMsg_OpenExecuting");
case (ConnectionState.Fetching | ConnectionState.Open):
return System.Data.Res.GetString("ADP_ConnectionStateMsg_OpenFetching");
}
return System.Data.Res.GetString("ADP_ConnectionStateMsg", new object[] { state.ToString() });
}
示例8: _pusher_ConnectionStateChanged
private void _pusher_ConnectionStateChanged(object sender, ConnectionState state)
{
ConsoleWriteLine("Connection state: " + state.ToString());
if (state == ConnectionState.Disconnected)
{
InvokeOnMainThread(() =>
{
_pusher.ConnectionStateChanged -= _pusher_ConnectionStateChanged;
Toast.MakeText("Disconnected! Please start over again.", Toast.LENGTH_SHORT).Show();
SetViewAndChildrenEnabled(this.LayoutConnectDisconnect, true);
SetViewAndChildrenEnabled(this.LayoutSendMessage, false);
this.ButtonStart.SetTitle("Connect :)", UIControlState.Normal);
this.EditMessage.Placeholder = "";
});
}
}
示例9: OpenConnectionRequired
internal static Exception OpenConnectionRequired(string method, ConnectionState state)
{
return InvalidOperation(System.Data.OracleClient.Res.GetString("ADP_OpenConnectionRequired", new object[] { method, "ConnectionState", state.ToString() }));
}
示例10: _pusher_ConnectionStateChanged
private void _pusher_ConnectionStateChanged(object sender, ConnectionState state)
{
ConsoleWriteLine("Connection state: " + state.ToString());
if (state == ConnectionState.Disconnected)
{
RunOnUiThread(() =>
{
_pusher.ConnectionStateChanged -= _pusher_ConnectionStateChanged;
ShowToast(GetString("StringToastDisconnected"), true);
SetViewAndChildrenEnabled(this.LayoutConnectDisconnect, true);
SetViewAndChildrenEnabled(this.LayoutSendMessage, false);
this.ButtonStart.Content = GetString("StringButtonConnect");
this.EditMessage.PlaceholderText = "";
});
}
}
示例11: ServerConnectionStateUpdate
private void ServerConnectionStateUpdate(ThreadPoolTimer source)
{
if (m_ServerConnectionState != m_Connection.ServerConnectionState)
{
m_ServerConnectionState = m_Connection.ServerConnectionState;
IAsyncAction result = Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal,
() =>
{
TextBlock_ServerConnectionState.Text = m_ServerConnectionState.ToString();
});
}
if (m_ConnectionState != m_Connection.State)
{
m_ConnectionState = m_Connection.State;
IAsyncAction result = Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal,
() =>
{
TextBlock_PM3ConnectionState.Text = m_ConnectionState.ToString();
});
}
}