Esempio n. 1
0
        /// <summary>
        /// 为CommandModel指定ViewModel
        /// </summary>
        /// <typeparam name="TCommand">ICommand实例的具体类型</typeparam>
        /// <typeparam name="TResource">附加资源类型</typeparam>
        /// <param name="cmdModel">CommandModel具体实例</param>
        /// <param name="viewModel">ViewModel具体实例</param>
        /// <returns>CommandModel&lt;TCommand, TResource&gt;.</returns>
        public static CommandModel <TCommand, TResource> WithViewModel <TCommand, TResource>(this CommandModel <TCommand, TResource> cmdModel, BindableBase viewModel)
            where TCommand : ICommand
        {
            //cmdModel.
            var cmd2 = cmdModel.CommandCore as ICommandWithViewModel;

            if (cmd2 != null)
            {
                cmd2.ViewModel = viewModel;
            }
            return(cmdModel);
        }
Esempio n. 2
0
 /// <summary>
 ///
 /// </summary>
 /// <typeparam name="TReactiveCommand"></typeparam>
 /// <typeparam name="TResource"></typeparam>
 /// <param name="command"></param>
 /// <param name="parameter"></param>
 /// <returns></returns>
 public static async Task ExecuteAsync <TReactiveCommand, TResource>(this CommandModel <TReactiveCommand, TResource> command, object parameter)
     where TReactiveCommand : IReactiveCommand
 {
     await command.CommandCore.ExecuteAsync(parameter);
 }