/
WMS Einstellung: IWmsActivitySetting
WMS Einstellung: IWmsActivitySetting
Beschreibung
Mit dem Interface „IWmsActivitySetting“ kann der WMS-Benutzer genau eine Einstellung hinterlegen. Verwenden Sie das Interface „IWmsActivitySetting“ z.B. zur Konfiguration von API-Verbindungen. Auch die [accantum] DMS Verbindungseinstellung nutzen dieses Interface.
Häufige Anwendungsfälle:
Angabe von API-Einstellungen (Url zu einem Dienst bzw. einer Rest-API)
Angabe von Authentifizierung-Daten (Benutzername und Passwort oder ein Lizenzschlüssel)
Aufbau des Interface IWmsActivitySetting
Eigenschaft / Methode | Beschreibung |
---|---|
Identifier | Immer gleicher, eindeutiger Identifier dieser Einstellung! |
Title | Titel der Einstellung, wird als Name des Menüs verwendet. |
TitleToolTip | Tooltip für das Menü bzw. die Schaltfläche. |
Beispiel
Implementierung IWmsActivitySetting
Beispiel IWmsActivitySetting
using System;
using System.ComponentModel;
using System.Windows.Controls;
using Accantum.Wms.ActivityContracts.Settings;
namespace HelloWorld.Settings
{
public class HelloWorldSetting: IWmsActivitySetting
{
public HelloWorldSetting()
{
}
public static Guid SettingUId = new Guid("2ee56307-e8b5-448e-90c4-476f01f3e5a2");
public Guid Identifier => SettingUId;
public string Title => Resources.HelloWorldSetting;
public string TitleTooltip => Resources.HelloWorldSetting_Desc;
public event PropertyChangedEventHandler PropertyChanged;
public bool Initialise(string a_sSettings, bool a_bIsWorkflowDefSetting)
{
Content = new HelloWorldControl(a_sSettings);
if (Content?.DataContext is HelloWorldControlViewModel oViewModel)
{
//PropertyChanged weiterleiten
oViewModel.PropertyChanged += (a_oSender, a_oArgs) =>
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(a_oArgs.PropertyName));
};
}
return true;
}
public string GetSettings()
{
if (!(Content?.DataContext is HelloWorldControlViewModel oViewModel))
return string.Empty;
return oViewModel.GetSettings();
}
public void RestoreSettings(string a_settings)
{
if (Content?.DataContext is HelloWorldControlViewModeloViewModel viewModel)
viewModel.RestoreSettings(a_settings);
}
public UserControl Content { get; private set; }
}
}
Implementierung ViewModel
Beispiel Setting-ViewModel
using System.ComponentModel;
using System.Runtime.CompilerServices;
namespace HelloWorld.Settings
{
public class HelloWorldControlViewModel: INotifyPropertyChanged
{
private string m_sText;
public HelloWorldControlViewModel(HelloWorldSetting a_sSetting)
{
}
public string Text { get; set; }
public string GetSettings()
{
// return serialized setting
}
public void RestoreSettings(string a_sSettings)
{
// restore settings
}
private void SetSettings(HelloWorldSettingData a_oSettings)
{
Text = a_oSettings.Text
}
// Implementierung von INotfiyPropertyChanged
public event PropertyChangedEventHandler PropertyChanged;
protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null)
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
}
}
Implementierung Oberfläche
Beispiel Setting Control
<UserControl x:Class="HelloWorldSetting.HelloWorldControl"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:properties="clr-namespace:HelloWorld.Properties"
xmlns:mySetting="clr-namespace:HelloWorld.Settings"
mc:Ignorable="d"
d:DesignHeight="200" d:DesignWidth="400"
d:DataContext="{d:DesignInstance {x:Type mySetting:HelloWorldControlViewModel}}">
<Grid Margin="4" MaxWidth="500" HorizontalAlignment="Left">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*" MinWidth="300"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Label Grid.Row="0" Grid.Column="0" Content="{x:Static properties:Resource.Text}" Margin="4"/>
<TextBox Grid.Row="0" Grid.Column="1" Margin="4" Text="{Binding Text, UpdateSourceTrigger=PropertyChanged}"/>
<!-- weitere Controls ...-->
</Grid>
</UserControl>
Verwendung in der Aktivität
Beispiel zur Verwendung in der Aktivität
, multiple selections available,
Related content
WMS Einstellung: IWmsActivitySettingList
WMS Einstellung: IWmsActivitySettingList
More like this
WMS Einstellung: IWmsActivitySettingWithMapping
WMS Einstellung: IWmsActivitySettingWithMapping
More like this
WMS Einstellung
WMS Einstellung
More like this
WmsSettingMapping
WmsSettingMapping
More like this
(3) WMS Funktionalität nutzen (WmsActivityContracts.dll)
(3) WMS Funktionalität nutzen (WmsActivityContracts.dll)
More like this
WmsDataSourceItemMapping
WmsDataSourceItemMapping
More like this