本文整理汇总了C#中System.Action.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# Action.ToString方法的具体用法?C# Action.ToString怎么用?C# Action.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Action
的用法示例。
在下文中一共展示了Action.ToString方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Pacote
public Pacote(Action act, string target, string nick)
{
this.users = new List<Amigo>();
this.action = act.ToString();
this.target = target;
this.nickname = nick;
}
示例2: PostAction
private static bool PostAction(Proxy p, Server server, Action action)
{
var instance = p.Instance;
// if we can't issue any commands, bomb out
if (instance.AdminUser.IsNullOrEmpty() || instance.AdminPassword.IsNullOrEmpty()) return false;
var loginInfo = $"{instance.AdminUser}:{instance.AdminPassword}";
var haproxyUri = new Uri(instance.Url);
var requestBody = $"s={server.Name}&action={action.ToString().ToLower()}&b={p.Name}";
var requestHeader = $"POST {haproxyUri.AbsolutePath} HTTP/1.1\r\nHost: {haproxyUri.Host}\r\nContent-Length: {Encoding.GetEncoding("ISO-8859-1").GetBytes(requestBody).Length}\r\nAuthorization: Basic {Convert.ToBase64String(Encoding.Default.GetBytes(loginInfo))}\r\n\r\n";
try
{
var socket = new System.Net.Sockets.Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
socket.Connect(haproxyUri.Host, haproxyUri.Port);
socket.Send(Encoding.UTF8.GetBytes(requestHeader + requestBody));
var responseBytes = new byte[socket.ReceiveBufferSize];
socket.Receive(responseBytes);
var response = Encoding.UTF8.GetString(responseBytes);
instance.PurgeCache();
return response.StartsWith("HTTP/1.0 303") || response.StartsWith("HTTP/1.1 303");
}
catch (Exception e)
{
Current.LogException(e);
return false;
}
}
示例3: EditClassDialog
public EditClassDialog(List<Class> classList, Action action)
{
InitializeComponent();
this.Text = action + " class";
bEditClass.Text = action.ToString();
foreach (Class c in classList)
{
cmbClassList.Items.Add(c);
}
cmbClassList.SelectedIndex = -1;
}
示例4: Execute
public void Execute(Action command)
{
executionCount.AtomicIncrementAndGet();
if (!ignoreExecution.ReadFullFence())
{
var th = new Thread(() => command());
th.Name = command.ToString();
th.IsBackground = true;
threads.Add(th);
th.Start();
}
}
示例5: EditStudentDialog
public EditStudentDialog(List<Class> classList, AbstractHelper helper, Action action)
{
InitializeComponent();
this._helper = helper;
this.Text = action + " student";
bEditStud.Text = action.ToString();
foreach (Class c in classList)
{
cmbClassList.Items.Add(c);
cmbEditStudClass.Items.Add(c);
}
cmbClassList.SelectedIndex = -1;
}
示例6: RunAction
protected void RunAction (Action<TextEditorData> action)
{
HideMouseCursor ();
try {
Document.BeginAtomicUndo ();
action (this.textEditorData);
if (Document != null) // action may have closed the document.
Document.EndAtomicUndo ();
} catch (Exception e) {
Console.WriteLine ("Error while executing action " + action.ToString () + " :" + e);
}
}
示例7: RunAction
protected void RunAction (Action<TextEditorData> action)
{
HideMouseCursor ();
try {
action (this.textEditorData);
} catch (Exception e) {
Console.WriteLine ("Error while executing action " + action.ToString () + " :" + e);
}
}
示例8: CheckCopyPalette
void CheckCopyPalette(MainForm form, DataEntry[] de, Action<IWICPalette> method)
{
IWICImagingFactory factory = (IWICImagingFactory)new WICImagingFactory();
IWICPalette palette = factory.CreatePalette();
try
{
method(palette);
try
{
if (palette.GetColorCount() == 0)
{
form.Add(this, method.ToString(Resources._0_ZeroColorPalette), de);
}
}
catch (Exception e)
{
form.Add(this, method.ToString(Resources._0_IncorrectStatePalette), de, new DataEntry(e));
}
}
catch (Exception e)
{
form.CheckHRESULT(this, WinCodecError.WINCODEC_ERR_PALETTEUNAVAILABLE, e, de);
}
finally
{
palette.ReleaseComObject();
factory.ReleaseComObject();
}
}
示例9: UnsubscribeFunction
//Unsubscribes a Function member from everything
public static void UnsubscribeFunction(Action<object> func){
if (func == null)
return;
foreach (var eventName in subscribedMembers.Keys){
foreach (var member in subscribedMembers[eventName].ToArray()){
if (member.subscribedFunction != null && member.subscribedFunction.ToString() == func.ToString())
subscribedMembers[eventName].Remove(member);
}
}
if (logEvents)
Debug.Log("XXX " + func.ToString() + " Unsubscribed from everything");
}
示例10: StandardLoopThread
public StandardLoopThread(Action method, string threadName, Priority priority, int cycleTimeMS = 0)
: base(method, threadName, priority, cycleTimeMS)
{
UnityEngine.Debug.Log("StandardLoopThread Created " + method.ToString() + " " + threadName + " " + priority + " " + cycleTimeMS);
}
示例11: MakeActionException
private static WikiException MakeActionException(Action action, string error)
{
string message = action.ToString() + " failed with error '" + error + "'.";
switch (action)
{
case Action.Edit:
return new EditException(message);
case Action.Login:
return new LoginException(message);
case Action.Move:
return new MoveException(message);
default:
return new WikiException(message);
}
}
示例12: RemoveListener
/// <summary>
/// Removes the listener for the specified sensor
/// </summary>
public void RemoveListener(Sensor sensor, Action<Sensor> listener)
{
if (Logger.DUMP) Logger.dump("SensorRegistry", "RemoveListener "+ sensor.ID + " " + listener.ToString());
lock(sync_listener)
{
if (!activeSensors.ContainsKey(sensor))
return; // TODO: handle errors?
SensorListener sl = activeSensors[sensor];
var removed = sl.listeners.RemoveAll((g) => {return g == listener;});
if (removed > 0)
sensor.NotifyRemoveListener(listener);
if(sl.listeners.Count == 0)
activeSensors.Remove(sensor);
activeSensors_array = null;
}
}
示例13: SendDeleteMessages
//SEND MESSAGE TO QUEUE - REQUEST to delete thumbnails & posters
public void SendDeleteMessages(Action act, string blobUrl = "", string thumbUrl = "")
{
// Create message, passing a string message for the body.
BrokeredMessage message = new BrokeredMessage(AppConfiguration.ApplicationId);
// Set some additional custom app-specific properties.
message.Properties["Action"] = act.ToString();
message.Properties["ImageUrl"] = blobUrl;
message.Properties["ThumbURL"] = thumbUrl;
// Send message to the queue.
QClient.Send(message);
}
示例14: agentActed
public void agentActed(Agent agent, Action action, EnvironmentState resultingState)
{
System.Console.WriteLine("Agent acted: " + action.ToString());
}
示例15: Invoke
//The Invoke action for the interface
//Provides Run to Gui mechanism
public void Invoke(Action action)
{
var handler = new Handler(Looper.MainLooper);
Log.Info("SharpXmppDemo", ".MultiDebug: " + "Invoke was called for action: " + action.ToString());
if (handler != null)
{
handler.Post(action);
}
else
{
throw new InvalidOperationException("No handler for the main thread was created");
}
}