Plugin API
DieThe Serverinstallationserver desinstallation of the SCCM ManagersManager liefertprovides einean Schnittstelleinterface zurfor Eigenentwicklungself-development vonof Pluginsplugins. mit.This Dazurequires wird einean IDE (z.B.e.g. Visual Studio) zurfor Entwicklungthe vondevelopment of C-Sharp-AnwendungenSharp mitapplications demwith Grafikframeworkthe WPFgraphics benötigt.framework DesWPF. weiteren wirdFurthermore, .NET Framework 4.6.1 vorausgesetzt.is required.
EntwicklungDevelopment
EinA neunewly erstelltescreated Pluginplugin mussmust alsbe Klassenbibliothekcompiled as a class library (DLL-Datei)DLL kompiliertfile) werdenand undimplement dasthe InterfaceIActionPlugin IActionPlugininterface. implementieren.The Dasinterface Interfaceis befindet sichlocated in derthe Klassenbibliothekclass library ActionPanel.PluginBase.dll. ZusätzlichIn wirdaddition, nochthe dieclass Klassenbibliotheklibrary ActionPanel.Common.dll mitgeliefert.is Darinalso sindsupplied. einigeIt nützlichecontains Helferklassensome enthalten.useful helper classes.
ZurTo Einbindungintegrate desthe neunewly entwickeltendeveloped Pluginsplugin, musssimply lediglichcopy diethe entsprechendecorresponding DLL-DateiDLL infile dasinto Pluginverzeichnisthe desplugin directory of the SCCM Managers kopiert werden:Manager:
{Installationsverzechnis}installation path}\Web\SCCMManager\Resources\Assemblies\
DanachAfter mussthat diethe Startmenüverknüpfungstart menu shortcut "Update Plugin Versions" ausgeführthas werden,to damitbe dasexecuted, neueso Plugin,that zurthe Konfigurationnew plugin is available for configuration in derthe Administrationsoberflächeadministration desinterface of the SCCM Managers, zur Verfügung steht.Manager.
Interface IActionPlugin
FolgendThe wirdfollowing dasis Interfacethe interface IActionPlugin erläutert.explains.
Eigenschaften
Features
Name | |||
Title | string | ||
Argument | string | Argument |
|
SelectedComputers | ObservableCollection<IComputerItem> | ||
IsSingleton | bool | Singleton |
|
ApplicationVariables | IApplicationVariables | ||
ActionPanelControl | IActionPanel | ||
LanguageTranslater | ILanguageTranslater | ||
PluginContainer | IPluginContainer | ||
SelectedComputerType | SelectedComputerType (Enum) | ||
SingletonBehavior | SingletonBehavior (Enum) | ||
PluginType | PluginTypes (Enum) | ||
ContentControl | UserControl |
Methods
Name | |||
Initialize | bool | ||
OnApplicationExit | void | Event |
|
UpdateArgument | void | string argument | |
InvokeFunction | bool | string function, string[] parameters |
ImplementierungImplementation
using System.Collections.ObjectModel;
using System.Linq;
using System.Windows.Controls;
using ActionPanel.PluginBase;
using ActionPanel.PluginBase.Enums;
using ActionPanel.PluginBase.Interfaces;
using ClientActionsPlugin.View;
using FuncLib;
namespace ClientActionsPlugin
{
class ActionPanelPlugin : IActionPlugin
{
private ActionUserControl m_control;
public string Title { get; set; }
public bool IsSingleton { get; set; }
public string Argument { get; set; }
public ObservableCollection<IComputerItem> SelectedComputers { get; set; }
public SelectedComputersType SelectedComputerType { get; set; } = SelectedComputersType.Single;
public SingletonBehavior SingletonBehavior { get; } = SingletonBehavior.UpdateArgument;
public PluginTypes PluginType { get; } = PluginTypes.ExecuterUserControl;
public UserControl ContentControl => m_control;
public bool Initialize()
{
m_control = new ActionUserControl(this);
if (m_control != null)
{
m_control.Title = Title;
m_control.SelectedComputer = SelectedComputers?.FirstOrDefault()?.Name;
m_control.Init();
}
return true;
}
public void OnApplicationExit()
{
}
public void UpdateArgument(string argument)
{
Argument = argument;
m_control.SelectedComputer = SelectedComputers?.FirstOrDefault()?.Name;
m_control.Init();
}
public bool InvokeFunction(string function, string[] parameters)
{
bool force = (parameters != null && FLibCMD.CheckForCommandLineKey(parameters, "force", false));
if (function == Functions.SHUTDOWN)
{
return m_control.ShutdownComputer(force);
}
else if (function == Functions.RESTART)
{
return m_control.RestartComputer(force);
}
else if (function == Functions.WAKEUP)
{
return m_control.WakeUpComputer();
}
else
{
return false;
}
}
public IApplicationVariables ApplicationVariables { get; set; }
public IActionPanel ActionPanelControl { get; set; }
public ILanguageTranslater LanguageTranslater { get; set; }
public IPluginContainer PluginContainer { get; set; }
}
}