当前位置: 首页>>代码示例>>C#>>正文


C# RelayCommand.Execute方法代码示例

本文整理汇总了C#中RelayCommand.Execute方法的典型用法代码示例。如果您正苦于以下问题:C# RelayCommand.Execute方法的具体用法?C# RelayCommand.Execute怎么用?C# RelayCommand.Execute使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在RelayCommand的用法示例。


在下文中一共展示了RelayCommand.Execute方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CorrectStringCanBeParsedToEnumType

        public void CorrectStringCanBeParsedToEnumType()
        {
            _enumRelayCommand = new RelayCommand<DummyEnum>(ExecuteFunction, CanExecuteFunction);

            _enumRelayCommand.Execute("AnotherValue");

            Assert.AreEqual(DummyEnum.AnotherValue, _enumArgument);
        }
开发者ID:MadCowDevelopment,项目名称:Sudoku,代码行数:8,代码来源:GenericRelayCommandTest.cs

示例2: CorrectArgumentIsSent

        public void CorrectArgumentIsSent()
        {
            _intRelayCommand = new RelayCommand<int>(ExecuteFunction, CanExecuteFunction);

            _intRelayCommand.Execute(1);

            Assert.AreEqual(1, _intArgument);
        }
开发者ID:MadCowDevelopment,项目名称:Sudoku,代码行数:8,代码来源:GenericRelayCommandTest.cs

示例3: CommandIsExecuted

        public void CommandIsExecuted()
        {
            _relayCommand = new RelayCommand(OnActionCalled);

            _relayCommand.Execute(null);

            Assert.AreEqual(true, _actionHasBeenCalled);
        }
开发者ID:MadCowDevelopment,项目名称:Sudoku,代码行数:8,代码来源:RelayCommandTest.cs

示例4: CarInfoCollection

 public CarInfoCollection()
 {
     Cars = new ObservableCollection<CarInfoViewModel>();
     UpdateEntryList = new RelayCommand("Refresh", (p) =>
     {
         ReloadEntryList();
     });
     UpdateEntryList.Execute(null);
 }
开发者ID:flitzi,项目名称:acplugins,代码行数:9,代码来源:CarInfoCollection.cs

示例5: RelayCommand_Construction_WithoutCanExecuteCanActuallyExecute

		public void RelayCommand_Construction_WithoutCanExecuteCanActuallyExecute()
		{
			var count = 0;
			var cmd = new RelayCommand(o => count = (int) o);

			if (cmd.CanExecute())
				cmd.Execute(15);

			Assert.AreEqual(15, count);
		}
开发者ID:BosslandGmbH,项目名称:Buddy.UI,代码行数:10,代码来源:RelayCommandTests.cs

示例6: ExecuteExecutesTheAction

        public void ExecuteExecutesTheAction()
        {
            var run = false;

            var command = new RelayCommand(o => { run = true; });

            command.Execute(null);

            run.Should().BeTrue();
        }
开发者ID:jimbobbennett,项目名称:JimLib,代码行数:10,代码来源:RelayCommandTest.cs

示例7: ExecuteDoesNotExecuteTheActionIfCanExecuteIsFalse

        public void ExecuteDoesNotExecuteTheActionIfCanExecuteIsFalse()
        {
            var run = false;

            var command = new RelayCommand(o => { run = true; }, o => false);

            command.Execute(null);

            run.Should().BeFalse();
        }
开发者ID:jimbobbennett,项目名称:JimLib,代码行数:10,代码来源:RelayCommandTest.cs

示例8: WrongTypeThrowsException

        public void WrongTypeThrowsException()
        {
            _intRelayCommand = new RelayCommand<int>(ExecuteFunction, CanExecuteFunction);

            _intRelayCommand.Execute(0.0);
        }
开发者ID:MadCowDevelopment,项目名称:Sudoku,代码行数:6,代码来源:GenericRelayCommandTest.cs

示例9: IncorrectStringThrowsException

        public void IncorrectStringThrowsException()
        {
            _enumRelayCommand = new RelayCommand<DummyEnum>(ExecuteFunction, CanExecuteFunction);

            _enumRelayCommand.Execute("InvalidValue");
        }
开发者ID:MadCowDevelopment,项目名称:Sudoku,代码行数:6,代码来源:GenericRelayCommandTest.cs

示例10: AddCommandToService

        private void AddCommandToService(OleMenuCommandService service, Guid cmdSet, int cmdId, RelayCommand relayCommand)
        {
            var commandId = new CommandID(cmdSet, cmdId);
            var menuCommand = new OleMenuCommand((sender, args) =>
            {
                relayCommand.Execute(null);
            }, commandId);

            menuCommand.BeforeQueryStatus += (sender, args) =>
            {
                menuCommand.Enabled = relayCommand.CanExecute(null);
            };

            service.AddCommand(menuCommand);
        }
开发者ID:MBulli,项目名称:SmartCommandlineArgs,代码行数:15,代码来源:Commands.cs


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