本文整理汇总了C#中System.Windows.Controls.CheckBox.HasUserInteracted方法的典型用法代码示例。如果您正苦于以下问题:C# CheckBox.HasUserInteracted方法的具体用法?C# CheckBox.HasUserInteracted怎么用?C# CheckBox.HasUserInteracted使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Controls.CheckBox
的用法示例。
在下文中一共展示了CheckBox.HasUserInteracted方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SetStringValue
/// <summary>
/// Sets the value of <paramref name="keyName"/> in <paramref name="registryKey"/> to '1' (REG_SZ) if
/// <paramref name="chk"/>'s IsChecked is equal to true, otherwise sets it to '0' (REG_SZ).
/// This behaviour is reversed if <paramref name="inverse"/> is set to true.
/// Each <paramref name="chk" /> has a tag associated with it, which when set to 1 (HasUserInteracted)
/// will then be saved to registry, otherwise it'll be ignored.
/// </summary>
/// <param name="registryKey"></param>
/// <param name="chk"></param>
/// <param name="keyName"></param>
/// <param name="inverse"></param>
public static void SetStringValue(this RegistryKey registryKey, CheckBox chk, string keyName,
bool inverse = false)
{
if (chk.HasUserInteracted()) {
string val = inverse ? Utils.ReversedBoolToString(chk.IsChecked) : Utils.BoolToString(chk.IsChecked);
registryKey.SetValue(keyName, val);
}
}
示例2: SetValue
/// <summary>
/// Sets the value of <paramref name="keyName"/> in <paramref name="registryKey"/> to 1 (REG_DWORD) if
/// <paramref name="chk"/>'s IsChecked is equal to true, otherwise sets it to 0 (REG_DWORD).
/// This behaviour is reversed if <paramref name="inverse"/> is set to true.
/// Each <paramref name="chk" /> has a tag associated with it, which when set to 1 (HasUserInteracted)
/// will then be saved to registry, otherwise it'll be ignored.
/// </summary>
/// <param name="registryKey"></param>
/// <param name="chk"></param>
/// <param name="keyName"></param>
/// <param name="inverse"></param>
internal static void SetValue(this RegistryKey registryKey, CheckBox chk, string keyName, bool inverse = false)
{
if (chk.HasUserInteracted()) {
registryKey.SetValue(keyName, chk.IsChecked, inverse);
}
}
示例3: SetSubKey
/// <summary>
/// Creates a sub-key with name (if it doesn't exists) <paramref name="keyName"/> under <paramref name="registryKey"/> if
/// <paramref name="chk"/>'s IsChecked is equal to true, otherwise it deletes it (if present).
/// Each <paramref name="chk" /> has a tag associated with it, which when set to 1 (HasUserInteracted)
/// will then be saved to registry, otherwise it'll be ignored.
/// </summary>
/// <param name="registryKey"></param>
/// <param name="chk"></param>
/// <param name="keyName"></param>
internal static void SetSubKey(this RegistryKey registryKey, CheckBox chk, string keyName)
{
if (chk.HasUserInteracted()) {
registryKey.SetSubKey(keyName, chk.IsChecked);
}
}