public SellViewModel(IOwnedItemsStore ownedItemsStore, IPriceService priceService) { _ownedItemsStore = ownedItemsStore; _priceService = priceService; CalculatePriceCommand = new CallbackCommand(CalculatePrice, () => CanCalculatePrice); SellCommand = new CallbackCommand(Sell, () => IsValidSell); _ownedItemsStore.OwnedItemsChanged += OwnedItemsStore_OwnedItemsChanged; }
public ResDictDocControl(object context, string id) { _Context = context; _DocumentId = id; AddDrawingCommand = new CallbackCommand(AddDrawing_Execute); // make sure resources where instanciated for sure var dummy = ResDictDocResources.Instance; InitializeComponent(); }
internal void InvokeCallbacks(InteractionMessage message) { if (CallbackCommand != null) { if (CallbackCommand.CanExecute(message)) { CallbackCommand.Execute(message); } } if (CallbackMethodTarget != null && CallbackMethodName != null) { _callbackMethod.Invoke(CallbackMethodTarget, CallbackMethodName, message); } }
/// <inheritdoc /> public EditAppViewModel(ApplicationConfigService appConfigService, ApplicationViewModel model) { Application = model.ApplicationTuple; AppConfigService = appConfigService; DeleteApplicationCommand = new CallbackCommand(new DeleteApplicationCommand(Application), AfterDeleteApplication); PropertyChanged += OnApplicationChanged; // Build Package Provider Configurations foreach (var provider in PackageProviderFactory.All) { var result = ProviderFactoryConfiguration.TryCreate(provider, Application); if (result != null) { PackageProviders.Add(result); } } RefreshCommands(); }
internal void InvokeCallbacks([NotNull] InteractionMessage message) { if (message == null) { throw new ArgumentNullException(nameof(message)); } if (CallbackCommand != null) { if (CallbackCommand.CanExecute(message)) { CallbackCommand.Execute(message); } } if (CallbackMethodTarget != null && CallbackMethodName != null) { _callbackMethod.Invoke(CallbackMethodTarget, CallbackMethodName, message); } }
private static Int32 formatCallBack(CallbackCommand callBackCommand, int subActionCommand, IntPtr action) { switch (callBackCommand) { case CallbackCommand.DISKLOCKEDFORACCESS: break; case CallbackCommand.PROGRESS: string percent = Convert.ToString(action); break; case CallbackCommand.OUTPUT: string output = Convert.ToString(action); break; case CallbackCommand.DONE: string status = Convert.ToString(action); break; } return(1); }