我有一个需要许可证密钥才能注册的程序。菜单中并排有 2 个链接用于许可证。一种是“立即购买”,它将一个人带到一个网页以获取许可证密钥。然后用户单击另一个链接“输入许可证密钥”。验证许可证密钥后,菜单中不再显示“输入许可证密钥”链接。我无法弄清楚如何在验证许可证后使其他链接“立即购买”不可见。我知道“立即购买”链接名称需要在许可证密钥验证的代码中,并在许可证密钥 == True 时设置为可见 == false 但到目前为止它还没有工作。如果有人可以就如何使其工作提供建议,我将不胜感激。许可证功能代码如下所示。立即购买链接名称为:_BuyNowMenuLink
private void EnterLicenseKeyMenuItem_Click(object sender, RoutedEventArgs e)
{
LicenseKeyWindow window = new LicenseKeyWindow
{
Owner = this
};
if (window.ShowDialog() == true)
{
Title = Title.Replace(_UnregisteredText, null);
_BtnSave.IsEnabled = true;
_EnterLicenseKeyMenuItem.Visibility = Visibility.Collapsed;
MessageBox.Show(this,
"You version of the program was registered successfully.",
"Success",
MessageBoxButton.OK,
MessageBoxImage.Information);
}
}
<Menu Background="#dce0de" >
<MenuItem Name="_BuyNowMenuItem" />
<Hyperlink TextDecorations="None"
RequestNavigate="HandleRequestNavigate9" Name="h9"
NavigateUri=" http://www.background-magic-express.html ">
<Hyperlink.Style>
<Style TargetType="Hyperlink"
BasedOn="{StaticResource {x:Type Hyperlink}}">
<Setter Property="Foreground" Value="Black"/>
</Style>
</Hyperlink.Style>
Buy Now
</Hyperlink>
</Menu>