public static T WithAvailabilityClass <T, TCommand>(
            [NotNull] this T buttonData,
            [NotNull] IRvtCommandProperties <TCommand> properties)
            where T : PushButtonData
            where TCommand : class, IRvtCommand
        {
            if (buttonData == null)
            {
                throw new ArgumentNullException(nameof(buttonData));
            }

            if (properties == null)
            {
                throw new ArgumentNullException(nameof(properties));
            }

            if (properties.CommandAvailability == null)
            {
                return(buttonData);
            }

            string buttonDataAvailabilityClassName = properties.CommandAvailability.GetType().FullName;

            return(buttonData.WithAvailabilityClass(buttonDataAvailabilityClassName));
        }
Beispiel #2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="RvtCommandBase{TCommand}"/> class.
        /// </summary>
        /// <param name="commandProperties">The command properties</param>
        protected RvtCommandBase([NotNull] IRvtCommandProperties <TCommand> commandProperties)
        {
            if (commandProperties == null)
            {
                throw new ArgumentNullException(nameof(commandProperties));
            }

            Name        = commandProperties.Name;
            DisplayName = commandProperties.DisplayName;
        }
Beispiel #3
0
 /// <summary>
 ///     Initializes a new instance of the <see cref="SampleCommand" /> class.
 /// </summary>
 /// <param name="sampleCommandProperties">The command properties</param>
 /// <param name="sheetRetriever">The sheet retriever</param>
 /// <param name="dataTableCreator">The data table creator</param>
 /// <param name="filePathSelector">The file path selector</param>
 /// <param name="dataWriter">The data writer</param>
 /// <param name="dialogService">The dialog service</param>
 public SampleCommand(
     [NotNull] IRvtCommandProperties <SampleCommand> sampleCommandProperties,
     [NotNull] IElementRetriever sheetRetriever,
     [NotNull] IDataTableCreator dataTableCreator,
     [NotNull] IFilePathSelector filePathSelector,
     [NotNull] IDataWriter dataWriter,
     [NotNull] IDialogService dialogService)
     : base(sampleCommandProperties)
 {
     _dialogService    = dialogService ?? throw new ArgumentNullException(nameof(dialogService));
     _filePathSelector = filePathSelector ?? throw new ArgumentNullException(nameof(filePathSelector));
     _dataWriter       = dataWriter ?? throw new ArgumentNullException(nameof(dataWriter));
     _dataTableCreator = dataTableCreator ?? throw new ArgumentNullException(nameof(dataTableCreator));
     _sheetRetriever   = sheetRetriever ?? throw new ArgumentNullException(nameof(sheetRetriever));
 }
        public static T WithToolTip <T, TCommand>([NotNull] this T ribbonItemData, [NotNull] IRvtCommandProperties <TCommand> properties)
            where T : RibbonItemData
            where TCommand : class, IRvtCommand
        {
            if (ribbonItemData == null)
            {
                throw new ArgumentNullException(nameof(ribbonItemData));
            }

            if (properties == null)
            {
                throw new ArgumentNullException(nameof(properties));
            }

            return(!properties.ToolTip.IsNullOrWhiteSpace() ? ribbonItemData.WithToolTip(properties.ToolTip) : ribbonItemData);
        }
        public static T SetAllPushButtonDataProperties <T, TCommand>(
            [NotNull] this T buttonData,
            [NotNull] IRvtCommandProperties <TCommand> properties)
            where T : PushButtonData
            where TCommand : class, IRvtCommand
        {
            if (buttonData == null)
            {
                throw new ArgumentNullException(nameof(buttonData));
            }

            if (properties == null)
            {
                throw new ArgumentNullException(nameof(properties));
            }

            return(buttonData.SetAllButtonProperties(properties).WithAvailabilityClass(properties));
        }
        public static T WithToolTipImage <T, TCommand>(
            [NotNull] this T ribbonItemData,
            [NotNull] IRvtCommandProperties <TCommand> properties)
            where T : RibbonItemData
            where TCommand : class, IRvtCommand
        {
            if (ribbonItemData == null)
            {
                throw new ArgumentNullException(nameof(ribbonItemData));
            }

            if (properties == null)
            {
                throw new ArgumentNullException(nameof(properties));
            }

            return(ribbonItemData.WithToolTipImage(properties.ToolTipImage));
        }
        public static T SetAllButtonProperties <T, TCommand>(
            [NotNull] this T buttonData,
            [NotNull] IRvtCommandProperties <TCommand> properties)
            where T : ButtonData
            where TCommand : class, IRvtCommand
        {
            if (buttonData == null)
            {
                throw new ArgumentNullException(nameof(buttonData));
            }

            if (properties == null)
            {
                throw new ArgumentNullException(nameof(properties));
            }

            return(buttonData.SetAllRibbonItemProperties(properties).WithImage(properties).WithLargeImage(properties));
        }
        public static T WithImage <T, TCommand>(
            [NotNull] this T buttonData,
            [NotNull] IRvtCommandProperties <TCommand> properties)
            where T : ButtonData
            where TCommand : class, IRvtCommand
        {
            if (buttonData == null)
            {
                throw new ArgumentNullException(nameof(buttonData));
            }

            if (properties == null)
            {
                throw new ArgumentNullException(nameof(properties));
            }

            return(properties.Image == null ? buttonData : buttonData.WithImage(properties.Image));
        }
        public static T SetAllRibbonItemProperties <T, TCommand>([NotNull] this T ribbonItemData, [NotNull] IRvtCommandProperties <TCommand> properties)
            where T : RibbonItemData
            where TCommand : class, IRvtCommand
        {
            if (ribbonItemData == null)
            {
                throw new ArgumentNullException(nameof(ribbonItemData));
            }

            if (properties == null)
            {
                throw new ArgumentNullException(nameof(properties));
            }

            return(ribbonItemData.WithToolTip(properties).WithToolTipImage(properties).WithContextualHelp(properties)
                   .WithLongDescription(properties));
        }
        public static T WithContextualHelp <T, TCommand>([NotNull] this T ribbonItemData, [NotNull] IRvtCommandProperties <TCommand> properties)
            where T : RibbonItemData
            where TCommand : class, IRvtCommand
        {
            if (ribbonItemData == null)
            {
                throw new ArgumentNullException(nameof(ribbonItemData));
            }

            if (properties == null)
            {
                throw new ArgumentNullException(nameof(properties));
            }

            return(properties.ContextualHelp != null?ribbonItemData.WithContextualHelp(properties.ContextualHelp) : ribbonItemData);
        }