示例#1
0
        private static bool CommandCanHandle(IInput input, ITcxEditorCommand c)
        {
            var interfaces = c.GetType().GetInterfaces();

            return(interfaces[0]
                   .GenericTypeArguments[0].Name
                   .Equals(input.GetType().Name));
        }
示例#2
0
 private static IOutput Run(ITcxEditorCommand command, IInput input)
 {
     try
     {
         return((IOutput)Enumerable
                .First(command.GetType().GetMethods(), m => m.Name.Equals(nameof(ITcxEditorCommand <IInput, IOutput> .Execute)))
                .Invoke(command, new[] { input }));
     }
     catch (TargetInvocationException e)
     {
         if (e.InnerException is TcxCoreException)
         {
             throw e.InnerException;
         }
         else
         {
             throw;
         }
     }
 }