Beispielcode für benutzerdefinierte Eigenschaften hinzufügen
Code: Select all
public static void RegisterCustomStates(StorageProviderSyncRootInfo syncRootInfo)
{
var definitions = syncRootInfo.StorageProviderItemPropertyDefinitions;
foreach (var state in CustomState.Values)
{
var def = new StorageProviderItemPropertyDefinition
{
DisplayNameResource = state.Name,
Id = state.Id
};
if (!definitions.Contains(def)) definitions.Add(def);
}
}
public class CustomState
{
public static readonly CustomState SyncStatus = new(1, "Status", "shell32.dll,-259");
public static readonly CustomState CheckOutFlag = new(2, "CheckOut", "shell32.dll,-259");
public static IEnumerable Values
{
get
{
yield return SyncStatus;
yield return CheckOutFlag;
}
}
#region definitions
public int Id { get; }
public string Name { get; }
public string IconResource { get; }
private CustomState(int id, string name, string iconResource)
{
Id = id;
Name = name;
IconResource = iconResource;
}
#endregion
}
Ziel
Aktuelles Ist-Bild
aktuell
Die aktuelle Situation erfordert, dass Benutzer sie manuell über die Option „Mehr“ auswählen. Wie kann dies in C++ oder C# erreicht werden?
Referenz
Die Implementierung basiert auf dem offiziellen StorageProviderSync-Beispiel von Microsoft. Bei Bedarf können Sie sich den Beispielcode ansehen.