Ihr wollte eine eigene Registerkarte in der EPLAN Artikeldatenbank? Kein Problem, zumindest per API.
Die Funktionen hier sind von EPLAN nicht offiziell Freigegeben und werden nicht supported. Dennoch gibt es eine kleine Beschreibung in der API-Hilfe.

Die Implementierung ist nicht ganz so einfach, da hier mit manuellen Events gearbeitet wird und diese muss man dann erst in der Action senden und im UserControl registrieren.

Addin:

using System.IO;
using System.Reflection;
using Eplan.EplApi.ApplicationFramework;
using Eplan.EplApi.MasterData;
using Eplan.EplSDK.WPF;
using Eplan.EplSDK.WPF.DB;

namespace Suplanus.Example.EplAddIn.PartsManagementExtensionExample
{
    class Addin : IEplAddIn
    {
        public string TabsheetName => nameof(PartsManagementExtensionContent);
        public string ItemType => "eplan.part";

        public string AddinName
        {
            get
            {
                string addinName = typeof(Addin).Assembly.CodeBase;
                addinName = Path.GetFileNameWithoutExtension(addinName);
                return addinName;
            }
        }        

        public bool OnRegister(ref bool isLoadingOnStart)
        {
            isLoadingOnStart = true;
            return true;
        }

        public bool OnUnregister()
        {
            var partsManagement = new MDPartsManagement();
            partsManagement.UnregisterAddin(AddinName);
            partsManagement.UnregisterItem(ItemType);
            partsManagement.UnregisterTabsheet(TabsheetName);

            return true;
        }

        public bool OnInit()
        {
            return true;
        }

        public bool OnInitGui()
        {
            var partsManagement = new MDPartsManagement();
            string actionName = nameof(PartsManagementExtensionExampleAction);

            partsManagement.RegisterAddin(AddinName, actionName);            
            partsManagement.RegisterItem(AddinName, ItemType);
            partsManagement.RegisterTabsheet(AddinName, ItemType, TabsheetName);
            DialogFactoryDB dialogBarFactory = new DialogFactoryDB(TabsheetName,
                typeof(PartsManagementExtensionContent));
            PartsManagementExtensionExampleAction.TabsheetName = TabsheetName;

            return true;
        }

        public bool OnExit()
        {
            return true;
        }
    }
}

 

Action:

using Eplan.EplApi.ApplicationFramework;
using Eplan.EplSDK.WPF.EEvent;

namespace Suplanus.Example.EplAddIn.PartsManagementExtensionExample
{
    class PartsManagementExtensionExampleAction : IEplAction
    {
        public static string TabsheetName = null;

        public void GetActionProperties(ref ActionProperties actionProperties) { }

        public bool OnRegister(ref string name, ref int ordinal)
        {
            name = nameof(PartsManagementExtensionExampleAction);
            return true;
        }

        public bool Execute(ActionCallingContext actionCallingContext)
        {
            // Sent events to WPF control from base action
            string itemType = string.Empty;
            string action = string.Empty;
            string key = string.Empty;
            actionCallingContext.GetParameter("itemtype", ref itemType);
            actionCallingContext.GetParameter("action", ref action);
            actionCallingContext.GetParameter("key", ref key);

            WPFDialogEventManager wpfDialogEventManager = new WPFDialogEventManager();

            switch (action)
            {
                case "SelectItem":
                case "SaveItem":
                case "PreShowTab":
                case "OpenDatabase":
                case "CreateDatabase":
                    wpfDialogEventManager.send("XPartsManagementDialog", action, key);
                    break;
            }

            return true;
        }
    }
}

 

XAML: CodeBehind

using Eplan.EplApi.MasterData;
using Eplan.EplSDK.WPF.EEvent;
using Eplan.EplSDK.WPF.Interfaces.DialogServices;

namespace Suplanus.Example.EplAddIn.PartsManagementExtensionExample
{
    public partial class PartsManagementExtensionContent : IDialog
    {
        public string Caption => nameof(PartsManagementExtensionContent);
        public bool IsTabsheet => true;
        public ViewModel ViewModel { get; set; } 

        private readonly MDPartsManagement _partsManagement = new MDPartsManagement();

        public PartsManagementExtensionContent()
        {
            InitializeComponent();

            ViewModel = new ViewModel();
            DataContext = ViewModel;

            ViewModel.IsReadOnly = _partsManagement.SelectedPartsDatabase.IsReadOnly;

            // Events, called from Action of this Tab
            WPFDialogEventManager dialogEventManager = new WPFDialogEventManager();
            dialogEventManager.getOnWPFNotifyEvent("XPartsManagementDialog", "SelectItem").Notify += SelectItem;
            dialogEventManager.getOnWPFNotifyEvent("XPartsManagementDialog", "SaveItem").Notify += SaveItem;
            dialogEventManager.getOnWPFNotifyEvent("XPartsManagementDialog", "PreShowTab").Notify += PreShowTab;
            dialogEventManager.getOnWPFNotifyEvent("XPartsManagementDialog", "OpenDatabase").Notify += OpenDatabase;
            dialogEventManager.getOnWPFNotifyEvent("XPartsManagementDialog", "CreateDatabase").Notify += CreateDatabase;
        }

        private void CreateDatabase(string data)
        {
            
        }

        private void OpenDatabase(string data)
        {
            
        }

        private void PreShowTab(string data)
        {
            
        }

        private void SelectItem(string data)
        {
            
        }

        private void SaveItem(string data)
        {
            
        }

    }
}

 

XAML: UserControl

<UserControl
    x:Class="Suplanus.Example.EplAddIn.PartsManagementExtensionExample.PartsManagementExtensionContent"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    d:DesignHeight="300"
    d:DesignWidth="300"
    DataContext="{Binding RelativeSource={RelativeSource Self}, Path=ViewModel}"
    mc:Ignorable="d">
    <Grid Margin="10">
        <Viewbox>
            <TextBox
                IsEnabled="{Binding IsEnabled}"
                Text="Hello PartsManagementExtension!"
                TextWrapping="Wrap" />
        </Viewbox>
    </Grid>
</UserControl>

 

ViewModel:

using System;
using System.ComponentModel;
using System.Runtime.CompilerServices;

namespace Suplanus.Example.EplAddIn.PartsManagementExtensionExample
{
    public class ViewModel : INotifyPropertyChanged
    {
        private bool _isReadonly;
        public bool IsReadOnly
        {
            get { return _isReadonly; }
            set
            {
                if (value == _isReadonly) return;
                _isReadonly = value;
                OnPropertyChanged();
            }
        }

        public event PropertyChangedEventHandler PropertyChanged;
        protected virtual void OnPropertyChanged([CallerMemberName] String propertyName = "")
        {
            PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
        }
    }
}

 

Natürlich findet Ihr das wie gewohnt auf GitHub!