e79aa3c0ed
Former-commit-id: a2155e9bd80020e49e72e86c44da02a8ac0e57a4
51 lines
1.7 KiB
C#
51 lines
1.7 KiB
C#
//-----------------------------------------------------------------------------
|
|
// Copyright (c) Microsoft Corporation. All rights reserved.
|
|
//-----------------------------------------------------------------------------
|
|
|
|
namespace Microsoft.VisualBasic.Activities
|
|
{
|
|
using System;
|
|
using System.Activities;
|
|
using System.Diagnostics.CodeAnalysis;
|
|
using System.Runtime;
|
|
using System.Xaml;
|
|
|
|
[SuppressMessage(FxCop.Category.Naming, FxCop.Rule.TypeNamesShouldNotMatchNamespaces,
|
|
Justification = "Approved name")]
|
|
public static class VisualBasic
|
|
{
|
|
static AttachableMemberIdentifier settingsPropertyID = new AttachableMemberIdentifier(typeof(VisualBasic), "Settings");
|
|
|
|
public static void SetSettings(object target, VisualBasicSettings value)
|
|
{
|
|
AttachablePropertyServices.SetProperty(target, settingsPropertyID, value);
|
|
}
|
|
|
|
public static VisualBasicSettings GetSettings(object target)
|
|
{
|
|
VisualBasicSettings value;
|
|
return AttachablePropertyServices.TryGetProperty(target, settingsPropertyID, out value) ? value : null;
|
|
}
|
|
|
|
public static void SetSettingsForImplementation(object target, VisualBasicSettings value)
|
|
{
|
|
if (value != null)
|
|
{
|
|
value.SuppressXamlSerialization = true;
|
|
}
|
|
SetSettings(target, value);
|
|
}
|
|
|
|
public static bool ShouldSerializeSettings(object target)
|
|
{
|
|
VisualBasicSettings settings = VisualBasic.GetSettings(target);
|
|
|
|
if (settings != null && settings.SuppressXamlSerialization && target is Activity)
|
|
{
|
|
return false;
|
|
}
|
|
return true;
|
|
}
|
|
}
|
|
}
|