• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# CommandBase类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中CommandBase的典型用法代码示例。如果您正苦于以下问题:C# CommandBase类的具体用法?C# CommandBase怎么用?C# CommandBase使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



CommandBase类属于命名空间,在下文中一共展示了CommandBase类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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;
 }
开发者ID:autocar,项目名称:ircddotnet,代码行数:30,代码来源:ModeInvite.cs


示例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();
        }
开发者ID:Gsaico,项目名称:MasterDetails_LogisticaMVVM,代码行数:31,代码来源:UsuarioViewModel.cs


示例3: OnInfoCommand

    public bool OnInfoCommand( CommandBase.CommandData cmdData )
    {
        if( EngineCmdExecuterProxy != null )
            return EngineCmdExecuterProxy.OnInfoCommand( cmdData );

        return true;
    }
开发者ID:chichikov,项目名称:chichikov76,代码行数:7,代码来源:GameMain.cs


示例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);
 }
开发者ID:HuChundong,项目名称:gitextensions,代码行数:7,代码来源:Plugin.cs


示例5: HandleEvent

 public override bool HandleEvent(CommandBase command, ChannelInfo channel, UserInfo user, List<string> args)
 {
     if (command is List)
     {
         // TODO
     }
     return true;
 }
开发者ID:autocar,项目名称:ircddotnet,代码行数:8,代码来源:ModeSecret.cs


示例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) };
 }
开发者ID:Rei-li,项目名称:Dixiton,代码行数:8,代码来源:UserBlo.cs


示例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;
 }
开发者ID:thisisvoa,项目名称:GranityApp2.5,代码行数:15,代码来源:ResponseEventArgs.cs


示例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;
    }
开发者ID:chichikov,项目名称:chichikov76,代码行数:57,代码来源:ChessEngineConfig.cs


示例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;
        }
开发者ID:ChessOK,项目名称:ModelFramework,代码行数:15,代码来源:AsyncCommmand.cs


示例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"];
        }
开发者ID:smackey330,项目名称:UnFupFileNames,代码行数:10,代码来源:MainWindowModel.cs


示例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;
		}
开发者ID:SiGhTfOrbACQ,项目名称:O2.FluentSharp,代码行数:11,代码来源:CommandBase.cs


示例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;
 }
开发者ID:autocar,项目名称:ircddotnet,代码行数:12,代码来源:ModeNoExternal.cs


示例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;
    }
开发者ID:chichikov,项目名称:chichikov76,代码行数:13,代码来源:GameMain.cs


示例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);
        }
开发者ID:ptomasroos,项目名称:ivyvisual,代码行数:17,代码来源:CommandManager.cs


示例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;
 }
开发者ID:autocar,项目名称:ircddotnet,代码行数:13,代码来源:ModeModerated.cs


示例16: HandleEvent

        public override bool HandleEvent(CommandBase command, ChannelInfo channel, UserInfo user, List<string> args)
        {
            if (command is Join)
            {

                if (_limit <= channel.UserPerChannelInfos.Count)
                {
                    user.IrcDaemon.Replies.SendChannelIsFull(user, channel);
                    return false;
                }
            }
            return true;
        }
开发者ID:FreeApophis,项目名称:ircddotnet,代码行数:13,代码来源:ModeLimit.cs


示例17: Send

 public void Send(CommandBase command)
 {
     var handlers = this.GetCommandActions(command.GetType()).ToList();
     if (handlers.Any())
     {
         if (handlers.Count() != 1) throw new InvalidOperationException("cannot send to more than one handler");
         handlers.First().AsDynamic().Handle(command);
         ((IDisposable)handlers.First()).Dispose();
     }
     else
     {
         throw new InvalidOperationException("no handler registered");
     }
 }
开发者ID:BrunoMVPCosta,项目名称:cqrsSeed,代码行数:14,代码来源:InMemoryBus.cs


示例18: HandleEvent

        public override bool HandleEvent(CommandBase command, ChannelInfo channel, UserInfo user, List<string> args)
        {
            if (command is Join)
            {
                var keys = args.Count > 1 ? (IEnumerable<string>)CommandBase.GetSubArgument(args[1]) : new List<string>();

                if (keys.All(k => k != _key))
                {
                    user.IrcDaemon.Replies.SendBadChannelKey(user, channel);
                    return false;
                }
            }

            return true;
        }
开发者ID:FreeApophis,项目名称:ircddotnet,代码行数:15,代码来源:ModeKey.cs


示例19: ExecuteCommand

 public void ExecuteCommand(CommandBase command)
 {
     this.undoStack.Push(command);
     try
     {
         command.Execute();
     }
     catch (Exception e)
     {
         this.undoStack.Pop();
         if (this.ExceptionManager != null)
         {
             this.ExceptionManager.HandleException(e);
         }
     }
 }
开发者ID:NathanLaan,项目名称:NoteLiner,代码行数:16,代码来源:CommandManager.cs


示例20: ExcuteBestMoveCommand

    bool ExcuteBestMoveCommand( CommandBase.CommandData cmdData )
    {
        // best move string to rank/pile
        string strBestMove = cmdData.QueueStrValue.Peek();

        //UnityEngine.Debug.LogError( "ExcuteBestMoveCommand() - best move string = " + strBestMove );

        string strSrcPos = strBestMove.Substring(0, 2);
        string strTrgPos = strBestMove.Substring(2, 2);

        int nSrcRank, nSrcPile;
        ChessData.GetStringToRankPile( strSrcPos, out nSrcRank, out nSrcPile );
        if( ChessPosition.IsInvalidPositionIndex(nSrcRank, nSrcPile) ) {

            UnityEngine.Debug.LogError( "ExcuteBestMoveCommand() - Invalid src rank, pile" );
            return false;
        }

        int nTrgRank, nTrgPile;
        ChessData.GetStringToRankPile( strTrgPos, out nTrgRank, out nTrgPile );

        if( ChessPosition.IsInvalidPositionIndex(nTrgRank, nTrgPile) ) {

            UnityEngine.Debug.LogError( "ExcuteBestMoveCommand() - Invalid src rank, pile" );
            return false;
        }

        ChessBoardSquare srcSquare, trgSquare;
        srcSquare = board.aBoardSquare[nSrcPile, nSrcRank];
        trgSquare = board.aBoardSquare[nTrgPile, nTrgRank];

        //UnityEngine.Debug.LogError( "ExcuteBestMoveCommand() - src rank, pile " + nSrcRank + " , " + nSrcPile );
        //UnityEngine.Debug.LogError( "ExcuteBestMoveCommand() - trg rank, pile " + nTrgRank + " , " + nTrgPile );

        if( board.AIMoveTo( srcSquare, trgSquare ) )
        {
            // turn
            board.CurrTurn = ChessData.GetOppositeSide( board.CurrTurn );
            // invalidate ready state
            board.Ready = true;
            return true;
        }

        UnityEngine.Debug.LogError( "ExcuteBestMoveCommand() - Invalid src rank, pile" );

        return false;
    }
开发者ID:chichikov,项目名称:chichikov,代码行数:47,代码来源:BattleChessMain.cs



注:本文中的CommandBase类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# CommandBehavior类代码示例发布时间:2022-05-24
下一篇:
C# CommandBar类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap