Beispiel #1
0
        protected override void OnExecute(object parameter)
        {
            if (parameter is null)
            {
                return;
            }

            if (!(parameter is ValueTuple <string, ICodeExplorerNode> data))
            {
                return;
            }

            var(templateName, node) = data;

            if (string.IsNullOrWhiteSpace(templateName) || !(node is CodeExplorerItemViewModel model))
            {
                return;
            }

            var template   = GetTemplate(templateName);
            var moduleText = template.Read();

            if (string.IsNullOrWhiteSpace(moduleText))
            {
                _messageBox.NotifyWarn(string.Format(Resources.Templates.Menu_Warning_CannotFindTemplate_Message, template.Caption, template.Name + Template.TemplateExtension), Resources.Templates.Menu_Warning_CannotFindTemplate_Caption);
                return;
            }

            _addComponentService.AddComponentWithAttributes(model, ComponentType, moduleText);
        }
Beispiel #2
0
        protected override void OnExecute(object parameter)
        {
            if (parameter is null)
            {
                return;
            }

            if (!(parameter is System.ValueTuple <string, ICodeExplorerNode> data))
            {
                return;
            }

            var(templateName, node) = data;

            if (string.IsNullOrWhiteSpace(templateName) || !(node is CodeExplorerItemViewModel model))
            {
                return;
            }

            var moduleText = GetTemplate(templateName);

            _addComponentService.AddComponentWithAttributes(model, ComponentType, moduleText);
        }