本文整理汇总了C#中ICommand类的典型用法代码示例。如果您正苦于以下问题:C# ICommand类的具体用法?C# ICommand怎么用?C# ICommand使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ICommand类属于命名空间,在下文中一共展示了ICommand类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: insert
/// <summary>
/// ��Ʈw�s�W��k
/// </summary>
/// <param name="insert"></param>
public void insert(ICommand insert)
{
string myCmd = insert.getCommand();
try
{
cmd = new OdbcCommand(myCmd, GetConn());
//cmd = new IBM.Data.DB2.DB2Command(myCmd, GetConn());
cmd.ExecuteNonQuery();
}
catch (OdbcException dobcEx)
{
if (dobcEx.ErrorCode == -2146232009)
{
return;
}
try
{
lock (typeof(OdbcConnection))
{
//cmd = new IBM.Data.DB2.DB2Command(myCmd, GetConn());
cmd = new OdbcCommand(myCmd, GetConn());
cmd.ExecuteNonQuery();
}
}
catch (Exception ex)
{
throw new Exception(ex.Message);
}
}
}
开发者ID:ufjl0683,项目名称:Center,代码行数:35,代码来源:A_OdbcConnect.cs
示例2: Handle
public override void Handle(IntentsDataFlowData obj)
{
if (obj != null) {
IEnumerable<ICommand> intentStates = EvaluateIntentStates(obj.Value);
_commandResult = CombineCommands(intentStates);
}
}
开发者ID:stewmc,项目名称:vixen,代码行数:7,代码来源:DataFlowDataDispatchingDataPolicy.cs
示例3: Unwrap
public static ICommand Unwrap(ICommand command) {
CommandWrapper w = command as CommandWrapper;
if (w != null)
return w.wrappedCommand;
else
return command;
}
开发者ID:arkanoid1,项目名称:dnSpy,代码行数:7,代码来源:CommandWrapper.cs
示例4: Setup
public void Setup()
{
_testCommand = A.Fake<ICommand>();
_publisher = A.Fake<IPublisher>();
_compositeApp = A.Fake<ICompositeApp>();
_registry = A.Fake<ICommandRegistry>();
_formatter = A.Fake<IResponseFormatter>();
_publicationRecord = A.Fake<ICommandPublicationRecord>();
_jsonSerializer = new DefaultJsonSerializer();
_xmlSerializer = new DefaultXmlSerializer();
A.CallTo(() => _testCommand.Created).Returns(DateTime.MaxValue);
A.CallTo(() => _testCommand.CreatedBy).Returns(new Guid("ba5f18dc-e287-4d9e-ae71-c6989b10d778"));
A.CallTo(() => _testCommand.Identifier).Returns(new Guid("ba5f18dc-e287-4d9e-ae71-c6989b10d778"));
A.CallTo(() => _formatter.Serializers).Returns(new List<ISerializer> { _jsonSerializer, _xmlSerializer });
A.CallTo(() => _publicationRecord.Dispatched).Returns(true);
A.CallTo(() => _publicationRecord.Error).Returns(false);
A.CallTo(() => _publicationRecord.Completed).Returns(true);
A.CallTo(() => _publicationRecord.Created).Returns(DateTime.MinValue);
A.CallTo(() => _publicationRecord.MessageLocation).Returns(new Uri("http://localhost/fake/message"));
A.CallTo(() => _publicationRecord.MessageType).Returns(typeof(IPublicationRecord));
A.CallTo(() => _publicationRecord.CreatedBy).Returns(Guid.Empty);
A.CallTo(() => _compositeApp.GetCommandForInputModel(A.Dummy<IInputModel>())).Returns(_testCommand);
A.CallTo(() => _publisher.PublishMessage(A.Fake<ICommand>())).Returns(_publicationId);
A.CallTo(() => _registry.GetPublicationRecord(_publicationId)).Returns(_publicationRecord);
_euclidApi = new ApiModule(_compositeApp, _registry, _publisher);
}
开发者ID:smhinsey,项目名称:Euclid,代码行数:29,代码来源:CompositeInspectorApiTests.cs
示例5: Execute
public void Execute(ICommand command)
{
command.Execute();
undoStack.Push(command);
redoStack.Clear();
}
开发者ID:shootdaj,项目名称:MIDIator,代码行数:7,代码来源:UndoManager.cs
示例6: ForEachCommand
public ForEachCommand(string name, IExpression expression, ICommand command, bool localvar)
{
this.name = name;
this.expression = expression;
this.command = command;
this.localvar = localvar;
}
开发者ID:ajlopez,项目名称:AjSharp,代码行数:7,代码来源:ForEachCommand.cs
示例7: Handle
public async Task Handle(ICommand<CreateSale> command)
{
var cmd = command.Payload;
await repository.CreateOrUpdate(cmd.SaleId,
s => s.Create(cmd.SellerId, cmd.Item, cmd.Price, cmd.Stock));
}
开发者ID:jamesholcomb,项目名称:NDomain,代码行数:7,代码来源:SaleCommandHandler.cs
示例8: RegisterCommand
/// <summary>
/// Adds a command to the collection and signs up for the <see cref="ICommand.CanExecuteChanged"/> event of it.
/// </summary>
/// <remarks>
/// If this command is set to monitor command activity, and <paramref name="command"/>
/// implements the <see cref="IActiveAware"/> interface, this method will subscribe to its
/// <see cref="IActiveAware.IsActiveChanged"/> event.
/// </remarks>
/// <param name="command">The command to register.</param>
public virtual void RegisterCommand(ICommand command)
{
if (command == this)
{
throw new ArgumentException(Resources.CannotRegisterCompositeCommandInItself);
}
lock (this.registeredCommands)
{
if (this.registeredCommands.Contains(command))
{
throw new InvalidOperationException(Resources.CannotRegisterSameCommandTwice);
}
this.registeredCommands.Add(command);
}
command.CanExecuteChanged += this.onRegisteredCommandCanExecuteChangedHandler;
this.OnCanExecuteChanged();
if (this.monitorCommandActivity)
{
var activeAwareCommand = command as IActiveAware;
if (activeAwareCommand != null)
{
activeAwareCommand.IsActiveChanged += this.Command_IsActiveChanged;
}
}
}
开发者ID:eslahi,项目名称:prism,代码行数:37,代码来源:CompositeCommand.cs
示例9: GetAttribute
//private static void UpdateCheckedState(StopAstConversion stopCode)
//{
// // this does not work.
// foreach (MenuItem item in MainWindow.Instance.GetMainMenuItems())
// {
// if (!(item.Command is StopMenuCommand))
// continue;
// var attr = GetAttribute(item.Command);
// if (attr.StopCode == stopCode)
// {
// item.IsCheckable = true;
// item.IsChecked = true;
// }
// else
// {
// item.IsChecked = false;
// }
// }
//}
private static StopRLMenuCommandAttribute GetAttribute(ICommand command)
{
var attr = command.GetType().GetCustomAttributes(typeof(StopRLMenuCommandAttribute), true)
.Cast<StopRLMenuCommandAttribute>()
.FirstOrDefault();
return attr;
}
开发者ID:jakesays,项目名称:dot42,代码行数:28,代码来源:MenuRLLanguage.cs
示例10: Execute
public void Execute(ICommand command)
{
var commandHandler = _commandHandleProvider.GetInternalCommandHandle(command.GetType());
var commandContext = new CommandContext(_repository);
commandHandler(commandContext, command);
var aggregateRoots = commandContext.AggregateRoots;
if (aggregateRoots.Count > 1)
throw new Exception("one command handler can change just only one aggregateRoot.");
var aggregateRoot = aggregateRoots.First().Value;
var domainEvents = aggregateRoot.GetUnCommitEvents();
var eventStream = BuildEventStream(aggregateRoot, command.CommandId);
_eventStore.AppendAsync(eventStream);
if (aggregateRoot.Version % 3 == 0)
_snapshotStorage.Create(new SnapshotRecord(aggregateRoot.AggregateRootId, aggregateRoot.Version,
_binarySerializer.Serialize(aggregateRoot)));
_eventPublisher.PublishAsync(domainEvents);
aggregateRoot.Clear();
Console.WriteLine(aggregateRoot.ToString());
Console.WriteLine("DomainEvents count is {0}", domainEvents.Count);
}
开发者ID:liuxiqin,项目名称:Sevens,代码行数:33,代码来源:DefaultCommandProssor.cs
示例11: UpdateState
public override void UpdateState(int chainIndex, ICommand[] outputStates)
{
int chan = 0; // Current channel being processed.
byte[] buf = new byte[2]; // The serial data buffer.
if (serialPortIsValid && _serialPort.IsOpen)
{
for (char port = 'A'; port <= 'C'; ++port)
{
buf[0] = (byte)port;
buf[1] = 0;
for (int bit = 0; (bit < 8 && chan < outputStates.Length && IsRunning); ++bit, ++chan)
{
_commandHandler.Reset();
ICommand command = outputStates[chan];
if (command != null)
{
command.Dispatch(_commandHandler);
}
buf[1] |= (byte)(((_commandHandler.Value > _minIntensity) ? 0x01 : 0x00) << bit);
}
_serialPort.Write(buf, 0, 2);
}
}
}
开发者ID:stewmc,项目名称:vixen,代码行数:25,代码来源:ElexolUSBModule.cs
示例12: CreateCommand
void CreateCommand()
{
try {
string link = codon.Properties["link"];
string command = codon.Properties["command"];
if (link != null && link.Length > 0) {
var callback = LinkCommandCreator;
if (callback == null)
throw new NotSupportedException("MenuCommand.LinkCommandCreator is not set, cannot create LinkCommands.");
menuCommand = callback(link);
} else if (command != null && command.Length > 0) {
var callback = KnownCommandCreator;
if (callback == null)
throw new NotSupportedException("MenuCommand.KnownCommandCreator is not set, cannot create commands.");
menuCommand = callback(codon.AddIn, command);
} else {
menuCommand = (ICommand)codon.AddIn.CreateObject(codon.Properties["class"]);
}
if (menuCommand != null) {
menuCommand.Owner = caller;
}
} catch (Exception e) {
MessageService.ShowException(e, "Can't create menu command : " + codon.Id);
}
}
开发者ID:lisiynos,项目名称:pascalabcnet,代码行数:25,代码来源:MenuCommand.cs
示例13: ButtonCommandBinding
public ButtonCommandBinding(ICommand command, Button item)
{
this.command = command;
this.item = item;
this.Bind();
this.command.Refresh();
}
开发者ID:Waltervondehans,项目名称:NBi,代码行数:7,代码来源:ButtonCommandBinding.cs
示例14: SendAsync
public static Task SendAsync(this ICommandBus commandBus, ICommand command)
{
if (commandBus == null) throw new ArgumentNullException(nameof(commandBus));
if (command == null) throw new ArgumentNullException(nameof(command));
return commandBus.SendAsync(new Envelope<ICommand>(command));
}
开发者ID:fvilers,项目名称:Darjeel,代码行数:7,代码来源:CommandBusExtensions.cs
示例15: DM_Dialog
public DM_Dialog(ICommand command)
{
InitializeComponent();
_commands = command;
}
开发者ID:wshanshan,项目名称:DDD,代码行数:7,代码来源:DM_Dialog.cs
示例16: SetCommand
/// <summary>
/// Sets a command into the attached property.
/// </summary>
/// <param name="dependencyObject">The dependency object to assign the command.</param>
/// <param name="value">The command to attach.</param>
public static void SetCommand(DependencyObject dependencyObject, ICommand value)
{
if (dependencyObject != null)
{
dependencyObject.SetValue(CommandProperty, value);
}
}
开发者ID:ridomin,项目名称:waslibs,代码行数:12,代码来源:ItemClickCommand.cs
示例17: ResourceViewModel
public ResourceViewModel(Resource resource, ICommand openJsonWindowCommand)
{
this.Resource = resource;
this.References = resource.References.Select(m => new Views.ReferenceListItem(m, Views.ReferenceListItem.Display.NoMod, resource)).ToList();
this.ReferredBy = resource.ReferredBy.Select(m => new Views.ReferenceListItem(m, Views.ReferenceListItem.Display.SourcedNoMod, resource)).ToList();
this.OpenJsonWindowCommand = openJsonWindowCommand;
}
开发者ID:Quit,项目名称:Jofferson,代码行数:7,代码来源:ResourceViewModel.cs
示例18: AbstractMenuItem
public AbstractMenuItem(string header, int priority, ImageSource icon = null, ICommand command = null,
KeyGesture gesture = null, bool isCheckable = false)
{
Priority = priority;
IsSeparator = false;
Header = header;
Key = header;
Command = command;
IsCheckable = isCheckable;
Icon = icon;
if (gesture != null && command != null)
{
Application.Current.MainWindow.InputBindings.Add(new KeyBinding(command, gesture));
InputGestureText = gesture.DisplayString;
}
if (isCheckable)
{
IsChecked = false;
}
if (Header == "SEP")
{
Key = "SEP" + sepCount.ToString();
Header = "";
sepCount++;
IsSeparator = true;
}
}
开发者ID:vinodj,项目名称:Wide,代码行数:27,代码来源:AbstractMenuItem.cs
示例19: EventsViewModel
public EventsViewModel(INavigationController navigationController)
{
Title = AppResources.EventsTitle;
EventActivatedCommand = ControllerUtil.MakeShowCourseEventCommand(navigationController);
Index = 8;
}
开发者ID:banjoh,项目名称:noppawp8,代码行数:7,代码来源:EventsViewModel.cs
示例20: ArticleViewModel
public ArticleViewModel(INewsFeedService newsFeedService, IRegionManager regionManager, IEventAggregator eventAggregator)
{
if (newsFeedService == null)
{
throw new ArgumentNullException("newsFeedService");
}
if (regionManager == null)
{
throw new ArgumentNullException("regionManager");
}
if (eventAggregator == null)
{
throw new ArgumentNullException("eventAggregator");
}
this.newsFeedService = newsFeedService;
this.regionManager = regionManager;
this.showArticleListCommand = new DelegateCommand(this.ShowArticleList);
this.showNewsReaderViewCommand = new DelegateCommand(this.ShowNewsReaderView);
eventAggregator.GetEvent<TickerSymbolSelectedEvent>().Subscribe(OnTickerSymbolSelected, ThreadOption.UIThread);
}
开发者ID:CarlosVV,项目名称:mediavf,代码行数:25,代码来源:ArticleViewModel.cs
注:本文中的ICommand类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论