コード例 #1
0
 public static async Task TryExecuteAsync(this IViewModelCommand command)
 {
     if (command != null && command.CanExecute())
     {
         await command.ExecuteAsync();
     }
 }
コード例 #2
0
 public static async Task TryExecuteAsync(this IViewModelCommand command, object arg)
 {
     if (command != null && command.CanExecute(arg))
     {
         await command.ExecuteAsync(arg);
     }
 }
コード例 #3
0
 public static void TryExecute(this IViewModelCommand command)
 {
     if (command != null && command.CanExecute())
     {
         command.Execute();
     }
 }
コード例 #4
0
 public static void TryExecute(this IViewModelCommand command, object arg)
 {
     if (command != null && command.CanExecute(arg))
     {
         command.Execute(arg);
     }
 }
コード例 #5
0
            /// <inheritdoc />
            public CommandEntry(string name, IViewModelCommand command)
            {
                Name    = name;
                Command = command;

                Command.CommandExecuting += OnCommandExecuting;
                Command.CommandExecuted  += OnCommandExecuted;
            }
コード例 #6
0
ファイル: SaveChanges.cs プロジェクト: qujck/MarkdownEditor
 public SaveChangesHandler(
     IViewModelCommand <TViewModelParameter> decorated,
     IViewModelQuery <CanSaveFile> canSaveFile,
     IViewModelCommand <SaveFile> saveFile)
 {
     this.decorated   = decorated;
     this.canSaveFile = canSaveFile;
     this.saveFile    = saveFile;
 }
コード例 #7
0
        public static void RedirectExecute <TViewModel, TEventArgs>(
            this IViewModelCommand <TViewModel, TEventArgs> @this,
            object viewModel,
            object eventArgs)
        {
            Contract.Requires(@this != null);
            Contract.Requires(viewModel != null);
            Contract.Requires(eventArgs != null);

            var(tViewModel, tEventArgs) = castHelper <TViewModel, TEventArgs>(viewModel, eventArgs, @this.getCommandName());
            @this.Execute(tViewModel, tEventArgs);
        }
コード例 #8
0
ファイル: BootStrapper.cs プロジェクト: qujck/MarkdownEditor
            private DependencyResolver RegisterViewModelCommands()
            {
                this.saveFileHandler = new SaveFileHandler();
                this.newFileHandler  = new SaveChangesHandler <NewFile>(
                    new NewFileHandler(), this.canSaveFileHandler, saveFileHandler);
                this.nextViewHandler = new NextViewHandler();
                this.openFileHandler = new SaveChangesHandler <OpenFile>(
                    new OpenFileHandler(this.loadWholeFileHandler), this.canSaveFileHandler, saveFileHandler);
                this.previousViewHandler = new PreviousViewHandler();
                this.shutdownHandler     = new ShutdownHandler();

                return(this);
            }
コード例 #9
0
        public UserAdminstrationService(IUserRepository userRepository, IRoleRepository roleRepository, UbikUserManager<UbikUser> userManager, UbikRoleManager<UbikRole> roleManager, IViewModelCommand<RoleSaveModel> roleCommand, IViewModelCommand<NewUserSaveModel> newUserCommand, IDbContextScopeFactory dbContextScopeFactory, IEnumerable<IResourceAuthProvider> authProviders, ICacheProvider cache, IViewModelCommand<UserSaveModel> userCommand)
        {
            _userRepo = userRepository;
            _roleRepo = roleRepository;
            _userManager = userManager;
            _roleManager = roleManager;
            _roleCommand = roleCommand;
            _newUserCommand = newUserCommand;
            _dbContextScopeFactory = dbContextScopeFactory;
            _authProviders = authProviders;
            _cache = cache;
            _userCommand = userCommand;

            _userBuilder = new UserViewModelBuilder(RoleViewModels);
            _newUserBuilder = new NewUserViewModelBuilder(RoleViewModels);
            _roleBuilder = new RoleViewModelBuilder(RoleViewModels);
        }
コード例 #10
0
 public static void SetViewModelCommand(DependencyObject dependencyObject, IViewModelCommand value)
 {
     dependencyObject.SetValue(ViewModelCommandProperty, value);
 }