本文整理汇总了C#中Commands类的典型用法代码示例。如果您正苦于以下问题:C# Commands类的具体用法?C# Commands怎么用?C# Commands使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Commands类属于命名空间,在下文中一共展示了Commands类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnCommandCanceled
internal void OnCommandCanceled(Commands.BaseCommand command, string reason)
{
if (!m_sendNotifications)
{
return;
}
var castSpell = command as Commands.CastSpell;
if (castSpell != null)
{
new Interactions.NotifySpellEvent(Game, "OnSpellCastCanceled", castSpell.Spell as Behaviors.ICastableSpell, reason).Run();
}
var moveCard = command as Commands.InitiativeMoveCard;
if (moveCard != null && moveCard.FromZone == SystemZone.Hand && moveCard.ToZone == SystemZone.Battlefield
&& moveCard.Cause is Game)
{
new Interactions.NotifyCardEvent(Game, "OnCardPlayCanceled", moveCard.Subject, reason).Run();
}
if (command is Commands.IInitiativeCommand)
{
new Interactions.NotifyGameEvent(Game, "OnInitiativeCommandCanceled", null).Run();
}
}
示例2: QueueCommand
internal void QueueCommand(Commands.BaseCommand command)
{
if (command == null)
{
throw new ArgumentNullException("command");
}
// check whether a new command can be queued at this timing
if (RunningCommand != null)
{
Debug.Assert(RunningCommand.ExecutionPhase != Commands.CommandPhase.Pending);
if (RunningCommand.ExecutionPhase == Commands.CommandPhase.Prerequisite)
{
throw new InvalidOperationException("Command can't be queued in Prerequisite phase.");
}
}
InitializeCommand(command);
command.ValidateOnIssue();
if (RunningCommand != null && RunningCommand.ExecutionPhase == Commands.CommandPhase.Prolog)
{
Debug.Assert(m_timingGroupHead != null && m_timingGroupTail != null);
command.Next = m_timingGroupTail.Next;
m_timingGroupTail.Next = command;
m_timingGroupTail = command;
}
else
{
CommandQueue.PushTail(command, ref m_commandQueueHead, ref m_commandQueueTail);
}
}
示例3: RegisterAll
public static void RegisterAll(Commands system)
{
// Entity Events
system.RegisterEvent(new AnimalDamagedScriptEvent(system));
system.RegisterEvent(new AnimalDeathScriptEvent(system));
system.RegisterEvent(new BarricadeDamagedScriptEvent(system));
system.RegisterEvent(new BarricadeDestroyedScriptEvent(system));
system.RegisterEvent(new EntityDamagedScriptEvent(system));
system.RegisterEvent(new EntityDeathScriptEvent(system));
system.RegisterEvent(new EntityDestroyedScriptEvent(system));
system.RegisterEvent(new ResourceDamagedScriptEvent(system));
system.RegisterEvent(new ResourceDestroyedScriptEvent(system));
system.RegisterEvent(new StructureDamagedScriptEvent(system));
system.RegisterEvent(new StructureDestroyedScriptEvent(system));
system.RegisterEvent(new VehicleDamagedScriptEvent(system));
system.RegisterEvent(new VehicleDestroyedScriptEvent(system));
system.RegisterEvent(new ZombieDamagedScriptEvent(system));
system.RegisterEvent(new ZombieDeathScriptEvent(system));
// Player Events
system.RegisterEvent(new PlayerChatScriptEvent(system));
system.RegisterEvent(new PlayerConnectingScriptEvent(system));
system.RegisterEvent(new PlayerConnectedScriptEvent(system));
system.RegisterEvent(new PlayerDamagedScriptEvent(system));
system.RegisterEvent(new PlayerDeathScriptEvent(system));
system.RegisterEvent(new PlayerDisconnectedScriptEvent(system));
system.RegisterEvent(new PlayerShootScriptEvent(system));
}
示例4: sendData
public void sendData(Commands cmd)
{
if (port.IsOpen)
{
port.Write(new byte[] { (byte)cmd }, 0, 1);
}
}
示例5: Send
public async Task<Response> Send(Commands.Command command)
{
int id = commandsSent;
var mes = command.GetMessage(id);
commandsSent++;
bool hasResponse = false;
if (socket.State != WebSocketState.Open)
{
if (socket.State == WebSocketState.None || socket.State == WebSocketState.Closed)
{
socket.Open();
while (socket.State == WebSocketState.Connecting)
await Task.Delay(100);
if (socket.State != WebSocketState.Open)
throw new Exception("Socket could not be opened.");
}
}
socket.Send(mes);
while (!hasResponse)
{
await Task.Delay(10).ConfigureAwait(false);
lock (responses)
{
hasResponse = responses.ContainsKey(id);
}
}
var response = responses[id];
removeResponse(id);
return response;
}
示例6: CreateNavigationCommands
void CreateNavigationCommands(Commands commands)
{
var previousCmd = commands.AddNamedCommand(
m_addIn,
"GotoPrevious",
"goto previous location",
"Goto the previous location in the current navigation list.",
false,
0,
vsCommandDisabledFlagsValue:
(int) vsCommandStatus.vsCommandStatusEnabled
| (int) vsCommandStatus.vsCommandStatusSupported
);
previousCmd.Bindings = "Global::Alt+Left Arrow";
var nextCmd = commands.AddNamedCommand(
m_addIn,
"GotoNext",
"goto next location",
"Goto the next location in the current navigation list.",
false,
0,
vsCommandDisabledFlagsValue:
(int) vsCommandStatus.vsCommandStatusEnabled
| (int) vsCommandStatus.vsCommandStatusSupported
);
nextCmd.Bindings = "Global::Alt+Right Arrow";
}
示例7: Query
/// <summary>
/// Simple constructor that initializes all
/// the fields.
/// </summary>
/// <param name="command"></param>
/// <param name="key"></param>
/// <param name="argument"></param>
public Query(Commands command, string key, string argument)
{
this.Command = command;
this.Key = key;
this.Argument = argument;
ExecutionDate = DateTime.Now;
}
示例8: AudioChangedEventArgs
public AudioChangedEventArgs(Commands command, string audioFile, double? leftVolume = null, double? rightVolume = null)
{
this.Command = command;
this.AudioFile = audioFile;
this.LeftVolume = leftVolume;
this.RightVolume = rightVolume;
}
示例9: RunCommand
private void RunCommand(Commands cmd)
{
if (CurrentNode.DataItem is ProjectFile) {
ProjectFile file = (ProjectFile)CurrentNode.DataItem;
Project prj = file.Project;
ProjectFileCollection pfc = prj.Files;
int currIndex = pfc.IndexOf(file);
try {
switch (cmd) {
case Commands.MoveUp:
if (currIndex > 0) {
pfc.RemoveAt(currIndex);
pfc.Insert(currIndex-1, file);
}
break;
case Commands.MoveDown:
if (currIndex < pfc.Count-1 ) {
pfc.RemoveAt(currIndex);
pfc.Insert(currIndex+1, file);
}
break;
}
using (IProgressMonitor monitor = GetStatusMonitor()){
prj.Save(monitor);
}
}
catch (Exception ex) {
LoggingService.LogError (ex.ToString ());
}
}
}
示例10: BinaryPacketFormatter
public BinaryPacketFormatter(Commands command, params object[] args)
: this()
{
this.Add(command);
foreach (var obj in args)
{
if (obj is Byte) this.Add((Byte)obj);
if (obj is Int16) this.Add((Int16)obj);
if (obj is UInt16) this.Add((UInt16)obj);
if (obj is Int32) this.Add((Int32)obj);
if (obj is UInt32) this.Add((UInt32)obj);
if (obj is Int64) this.Add((Int64)obj);
if (obj is UInt64) this.Add((UInt64)obj);
if (obj is byte[]) this.Add((byte[])obj);
if (obj is List<byte>) this.Add((List<byte>)obj);
if (obj is string) this.Add((string)obj);
if (obj is float) this.Add((float)obj);
if (obj is Vector3) this.Add((Vector3)obj);
if (obj is Vector4) this.Add((Vector4)obj);
if (obj is Quaternion) this.Add((Quaternion)obj);
}
}
示例11: Create
public static Usuario Create(Commands.NovoUsuarioCompletoCommand cmd)
{
var telefone = new AparelhoTelefone(cmd.Numero, cmd.UUID, cmd.SistemaOperacional);
var usuarioCompleto = new Usuario(cmd.Nome, cmd.Email, cmd.AceitoMkt, telefone);
return usuarioCompleto;
}
示例12: Delete
public ActionResult Delete(Commands.DeleteUserCommand command)
{
var service = new Commanding.SimpleTwitterCommandServiceClient();
service.DeleteUser(command);
return RedirectToAction("Index");
}
示例13: ParseCommand
private static void ParseCommand(string str, out Commands command, out Range range)
{
const string turnOffStr = "turn off";
const string turnOnStr = "turn on";
const string toggleStr = "toggle";
if (str.StartsWith(turnOffStr))
{
command = Commands.TurnOff;
}
else if (str.StartsWith(turnOnStr))
{
command = Commands.TurnOn;
}
else if (str.StartsWith(toggleStr))
{
command = Commands.Toggle;
}
else
{
throw new ArgumentException("unknown command");
}
var regex = new Regex(@"(\d+)\,(\d+)");
var matches = regex.Matches(str);
var x1 = int.Parse(matches[0].Groups[1].Value);
var y1 = int.Parse(matches[0].Groups[2].Value);
var x2 = int.Parse(matches[1].Groups[1].Value);
var y2 = int.Parse(matches[1].Groups[2].Value);
range = new Range(new Point(x1, y1), new Point(x2, y2));
}
示例14: BuildCommandsXls
//xls���ǂݍ��ݎ�
public void BuildCommandsXls(string xlsSchemaFile)
{
NDbUnit.Core.CreateXlsDs createXls = CreateXlsDs.GetInstance();
//_dataSet.ReadXmlSchema(xmlSchema);
// DataSet table rows RowState property is set to Added
// when read in from an xml file.
//_dataSet.AcceptChanges();
_dataSet = createXls.CreateDataSetToXls(xlsSchemaFile);
Hashtable ht = new Hashtable();
Commands commands;
foreach (DataTable dataTable in _dataSet.Tables)
{
// Virtual overrides.
commands = new Commands();
commands.SelectCommand = CreateSelectCommand(_dataSet, dataTable.TableName);
commands.InsertCommand = CreateInsertCommand(commands.SelectCommand, dataTable.TableName);
commands.InsertIdentityCommand = CreateInsertIdentityCommand(commands.SelectCommand, dataTable.TableName);
commands.DeleteCommand = CreateDeleteCommand(commands.SelectCommand, dataTable.TableName);
commands.DeleteAllCommand = CreateDeleteAllCommand(dataTable.TableName);
commands.UpdateCommand = CreateUpdateCommand(commands.SelectCommand, dataTable.TableName);
ht[dataTable.TableName] = commands;
}
_dbCommandColl = ht;
_initialized = true;
}
示例15: Init
/// <summary>
/// Prepares the command system, registering all base commands.
/// </summary>
public void Init(Outputter _output, Client tclient)
{
// General Init
TheClient = tclient;
CommandSystem = new Commands();
Output = _output;
CommandSystem.Output = Output;
CommandSystem.Init();
// UI Commands
CommandSystem.RegisterCommand(new AttackCommand(TheClient));
CommandSystem.RegisterCommand(new BackwardCommand(TheClient));
CommandSystem.RegisterCommand(new BindblockCommand(TheClient));
CommandSystem.RegisterCommand(new BindCommand(TheClient));
CommandSystem.RegisterCommand(new ForwardCommand(TheClient));
CommandSystem.RegisterCommand(new ItemdownCommand(TheClient));
CommandSystem.RegisterCommand(new ItemleftCommand(TheClient));
CommandSystem.RegisterCommand(new ItemrightCommand(TheClient));
CommandSystem.RegisterCommand(new ItemupCommand(TheClient));
CommandSystem.RegisterCommand(new LeftwardCommand(TheClient));
CommandSystem.RegisterCommand(new MovedownCommand(TheClient));
CommandSystem.RegisterCommand(new RightwardCommand(TheClient));
CommandSystem.RegisterCommand(new SecondaryCommand(TheClient));
CommandSystem.RegisterCommand(new SprintCommand(TheClient));
CommandSystem.RegisterCommand(new TalkCommand(TheClient));
CommandSystem.RegisterCommand(new UnbindCommand(TheClient));
CommandSystem.RegisterCommand(new UpwardCommand(TheClient));
CommandSystem.RegisterCommand(new UseCommand(TheClient));
CommandSystem.RegisterCommand(new WalkCommand(TheClient));
// Common Commands
CommandSystem.RegisterCommand(new CdevelCommand(TheClient));
CommandSystem.RegisterCommand(new ItemnextCommand(TheClient));
CommandSystem.RegisterCommand(new ItemprevCommand(TheClient));
CommandSystem.RegisterCommand(new ItemselCommand(TheClient));
CommandSystem.RegisterCommand(new PlayCommand(TheClient));
CommandSystem.RegisterCommand(new QuickItemCommand(TheClient));
CommandSystem.RegisterCommand(new QuitCommand(TheClient));
CommandSystem.RegisterCommand(new ReloadGameCommand(TheClient));
// Network Commands
CommandSystem.RegisterCommand(new ConnectCommand(TheClient));
CommandSystem.RegisterCommand(new DisconnectCommand(TheClient));
CommandSystem.RegisterCommand(new NetusageCommand(TheClient));
CommandSystem.RegisterCommand(new PingCommand(TheClient));
CommandSystem.RegisterCommand(new StartlocalserverCommand(TheClient));
// Game Commands
CommandSystem.RegisterCommand(new InventoryCommand(TheClient));
CommandSystem.RegisterCommand(new TesteffectCommand(TheClient));
// General Tags
CommandSystem.TagSystem.Register(new AudioTagBase(TheClient));
// Entity Tags
CommandSystem.TagSystem.Register(new PlayerTagBase(TheClient));
CommandSystem.PostInit();
}