本文整理汇总了C#中CommandBase类的典型用法代码示例。如果您正苦于以下问题:C# CommandBase类的具体用法?C# CommandBase怎么用?C# CommandBase使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
CommandBase类属于命名空间,在下文中一共展示了CommandBase类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: HandleEvent
public override bool HandleEvent(CommandBase command, ChannelInfo channel, UserInfo user, List<string> args)
{
if (command is Join)
{
if (!user.Invited.Contains(channel))
{
user.IrcDaemon.Replies.SendInviteOnlyChannel(user, channel);
return false;
}
user.Invited.Remove(channel);
}
if (command is Invite)
{
UserPerChannelInfo upci;
if (channel.UserPerChannelInfos.TryGetValue(user.Nick, out upci))
{
if (upci.Modes.Level < 30)
{
channel.IrcDaemon.Replies.SendChannelOpPrivilegesNeeded(user, channel);
return false;
}
}
else
{
channel.IrcDaemon.Replies.SendNotOnChannel(user, channel.Name);
return false;
}
}
return true;
}
示例2: UsuarioViewModel
public UsuarioViewModel()
{
if (IsInDesignMode) return;//por si acaso ?
_ServicioUsuario = new UsuarioServiceClient();
_ServicioDepartamento = new DepartamentoServiceClient();
_ServicioProyecto = new ProyectoServiceClient();
ListaUsuarios = new ObservableCollection<usuarioDTO>();
ItemUsuario = new usuarioDTO();
NuevoUsuarioCommand = new CommandBase(p => true, p => NuevoUsuarioCommandAccion()) { IsEnable = true };
GuardarUsuarioCommand = new CommandBase(p => true, p => GuardarUsuarioCommandAccion()) { IsEnable = true };
EliminarUsuarioCommand = new CommandBase(p => true, p => EliminarUsuarioCommandAccion()) { IsEnable = true };
NuevoProyectoCommand = new CommandBase(p => true, p => NuevoProyectoCommandAccion()) { IsEnable = true };
AgregarProyectoCommand = new CommandBase(p => true, p => AgregarProyectoCommandAccion()) { IsEnable = true };
EliminarProyectoCommand = new CommandBase(p => true, p => EliminarProyectoCommandAccion()) { IsEnable = true };
ListarUsuariosCommand = new CommandBase(p => true, p => ListarUsuariosCommandAction()) { IsEnable = true };
ListarUsuariosXNombreCommand = new CommandBase(p => true, p => ListarUsuariosXNombreCommandCommandAccion()) { IsEnable = true };
//lista los usuarios busqueda rapida
_ServicioUsuario.ListarUsuariosAsync();
_ServicioUsuario.ListarUsuariosCompleted += _ServicioUsuario_ListarUsuariosCompletedBusquedaRapida;
//lista los departamentos
_ServicioDepartamento.ListarDepartamentosAsync();
_ServicioDepartamento.ListarDepartamentosCompleted += _ServicioDepartamento_ListarDepartamentosCompleted;
ListarUsuariosCommandAction();
}
示例3: OnInfoCommand
public bool OnInfoCommand( CommandBase.CommandData cmdData )
{
if( EngineCmdExecuterProxy != null )
return EngineCmdExecuterProxy.OnInfoCommand( cmdData );
return true;
}
示例4: RegisterCommand
public void RegisterCommand(string commandName, CommandBase command)
{
if (commandName.IndexOf('.') >= 0)
throw new ArgumentException("Command name cannot contain dot symbol.", "commandName");
if (!_commands.ContainsKey(commandName))
_commands.Add(commandName, command);
}
示例5: HandleEvent
public override bool HandleEvent(CommandBase command, ChannelInfo channel, UserInfo user, List<string> args)
{
if (command is List)
{
// TODO
}
return true;
}
示例6: Save
private ExecutionResult Save(CommandBase command)
{
var user = ((SaveUserCommand)command).UserDto;
//Validate(user);
user.Id = Guid.NewGuid().ToString();
var id = UserDao.Save(user);
return new ExecutionResult { Data = UserDao.Get(id) };
}
示例7: ResponseEventArgs
/// <summary>
/// 构造函数,默认成功
/// </summary>
/// <param name="client">通讯的Socket/UdpClient/SerailPort</param>
/// <param name="param">通讯参数,IP地址或串口参数</param>
/// <param name="cmds">当前进行通讯的指令列表</param>
/// <param name="response">响应结果</param>
public ResponseEventArgs(object client, CommiTarget param, CommandBase[] cmds, byte[] response)
{
this.Client = client;
this.Commands = cmds;
this.Response = response;
this.ContentLen = response.Length;
this.Target = param;
}
示例8: SetConfigOption
public bool SetConfigOption( CommandBase.CommandData commandData )
{
bool bRet = false;
if( commandData.StrCmd == "id" ) {
CommandBase.CommandData subCmdData = commandData.QueueSubCmdData.Peek();
if( subCmdData != null && subCmdData.StrCmd == "name" ) {
Name = subCmdData.QueueStrValue.Peek();
bRet = true;
}
else if( subCmdData != null && subCmdData.StrCmd == "author" ) {
Authur = subCmdData.QueueStrValue.Peek();
bRet = true;
}
}
else if( commandData.StrCmd == "option" ) {
ChessEngineOption option = new ChessEngineOption();
foreach( CommandBase.CommandData subCmdData in commandData.QueueSubCmdData ) {
if( subCmdData != null ) {
if( subCmdData.StrCmd == "name" ) {
option.Name = subCmdData.QueueStrValue.Peek();
}
else if( subCmdData.StrCmd == "type" ) {
option.Type = subCmdData.QueueStrValue.Peek();
}
else if( subCmdData.StrCmd == "default" ) {
option.Default = subCmdData.QueueStrValue.Peek();
}
else if( subCmdData.StrCmd == "min" ) {
option.Min = subCmdData.QueueStrValue.Peek();
}
else if( subCmdData.StrCmd == "max" ) {
option.Max = subCmdData.QueueStrValue.Peek();
}
else if( subCmdData.StrCmd == "var" ) {
foreach( string strCurrVar in subCmdData.QueueStrValue )
option.queueVar.Enqueue( strCurrVar );
}
}
}
AddOption( option );
bRet = true;
}
return bRet;
}
示例9: AsyncCommand
/// <summary>
/// Инициализирует экземпляр класса <see cref="AsyncCommand"/> и
/// задает команду <paramref name="command"/>, которая будет провалидирована и
/// выполнена асинхронно.
/// </summary>
/// <param name="command"></param>
public AsyncCommand(CommandBase command)
{
if (command == null)
{
throw new ArgumentNullException("command");
}
Command = command;
}
示例10: MainWindowModel
public MainWindowModel(MainWindow v)
{
this.view = v;
_FindPathCommand = new CommandBase(FindPath);
_FindBadFilesCommand = new CommandBase(this.FindBadFiles, this.FindBadFilesCanExecute);
_ExecuteFileRenameCommand = new CommandBase(this.ExecuteFileRename, this.ExecuteFileRenameCanExecute);
_CancelActionCommand = new CommandBase(this.CancelAction, this.CancelActionCanExecute);
this.Pattern = ConfigurationManager.AppSettings["DefaultPattern"];
}
示例11: add_MenuItem
public static CommandBase add_MenuItem(this O2_VS_AddIn o2AddIn, string buttonText, string targetMenu, Action onExecute)
{
var newCommand = new CommandBase(o2AddIn)
{
ButtonText = buttonText,
TargetMenu = targetMenu,
Execute = onExecute
};
newCommand.create();
return newCommand;
}
示例12: HandleEvent
public override bool HandleEvent(CommandBase command, ChannelInfo channel, UserInfo user, List<string> args)
{
if (command is PrivateMessage || command is Notice)
{
if (!channel.UserPerChannelInfos.ContainsKey(user.Nick))
{
user.IrcDaemon.Replies.SendCannotSendToChannel(user, channel.Name);
return false;
}
}
return true;
}
示例13: OnInitStockfishCommand
// on Process Engine command
public bool OnInitStockfishCommand( CommandBase.CommandData cmdData )
{
// why can't i send first command????????
// 엔진에서 첫번째 명령 스트링을 초기화 안해서....
ChessEngineManager.Instance.Send( "\n" );
ChessEngineManager.Instance.Send( "uci" );
if( EngineCmdExecuterProxy != null )
return EngineCmdExecuterProxy.OnInitStockfishCommand( cmdData );
return true;
}
示例14: Add
/// <summary>
/// Adds a command to the manager.
/// </summary>
/// <param name="command">Reference to the command to add</param>
public void Add(CommandBase command)
{
Commands2 vsCommands = (Commands2)dte.Commands;
// Get full name how Visual Studio queries this command
string fullname = vsCommands.GetFullname(addIn, command.Name);
// Add to our own VsTortoise command management
commands[fullname] = command;
// Create the command inside Visual Studio permanently
Command vsCommand = vsCommands.CreateCommandButton(addIn, command);
}
示例15: HandleEvent
public override bool HandleEvent(CommandBase command, ChannelInfo channel, UserInfo user, List<string> args)
{
if (command is PrivateMessage || command is Notice)
{
UserPerChannelInfo upci;
if (!channel.UserPerChannelInfos.TryGetValue(user.Nick, out upci) || upci.Modes.Level < 10)
{
user.IrcDaemon.Replies.SendCannotSendToChannel(user, channel.Name);
return false;
}
}
return true;
}