Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/262.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 为什么在Windows 10周年纪念日(1607年)toast通知中两次出现BalloodTiptItle_C#_.net_Windows - Fatal编程技术网

C# 为什么在Windows 10周年纪念日(1607年)toast通知中两次出现BalloodTiptItle

C# 为什么在Windows 10周年纪念日(1607年)toast通知中两次出现BalloodTiptItle,c#,.net,windows,C#,.net,Windows,刚刚注意到,在我正在构建的一个C#应用程序中,标题现在显示在祝酒词的顶部和底部。还有人看到同样的东西吗?在纪念日前的Windows 10中,气球标题只出现在祝酒词的顶部。 没什么大不了的,但看起来很傻。 我还不能发布照片,但如果我得到任何回复,我会上传庆祝活动前后的照片 我想我被否决了,因为这不是一个真正的问题。因此,我将重新措辞: Windows 10周年纪念将气球标题放在顶部,并将AssemblyInfo.cs中的assembly:AssemblyTitle放在祝酒词的底部 在不同版本的Wi

刚刚注意到,在我正在构建的一个C#应用程序中,标题现在显示在祝酒词的顶部和底部。还有人看到同样的东西吗?在纪念日前的Windows 10中,气球标题只出现在祝酒词的顶部。 没什么大不了的,但看起来很傻。 我还不能发布照片,但如果我得到任何回复,我会上传庆祝活动前后的照片

我想我被否决了,因为这不是一个真正的问题。因此,我将重新措辞:

Windows 10周年纪念将气球标题放在顶部,并将AssemblyInfo.cs中的assembly:AssemblyTitle放在祝酒词的底部

在不同版本的Windows 10和Windows 7中管理此问题的最佳方法是什么?我想让我的用户知道是我的应用程序导致了这场土司,但我不想重复信息

下面是Windows窗体应用程序中的一些快速代码,说明了我的意思。如果更改BalloodTiptTitle以匹配您的解决方案名称,您将看到多余的标题:

    static void Main()
    {
        NotifyIcon myNotifyIcon = new NotifyIcon();
        myNotifyIcon.BalloonTipIcon = ToolTipIcon.Warning;
        myNotifyIcon.BalloonTipText = "This is a test toast";
        myNotifyIcon.BalloonTipTitle = "Toast Title";
        myNotifyIcon.Icon = Icon.ExtractAssociatedIcon(Assembly.GetExecutingAssembly().Location);
        myNotifyIcon.Visible = true;
        myNotifyIcon.ShowBalloonTip(10000);

        ContextMenuStrip contextMenu = new ContextMenuStrip();
        ToolStripMenuItem menuItemExit = new ToolStripMenuItem();
        menuItemExit.Text = "Exit";
        contextMenu.Items.Add(menuItemExit);
        menuItemExit.Click += delegate { myNotifyIcon.Visible = false; Application.Exit(); };

        myNotifyIcon.ContextMenuStrip = contextMenu;

        System.Timers.Timer myTimer = new System.Timers.Timer();
        myTimer.Interval = 20000;
        myTimer.Enabled = true;
        myTimer.Elapsed += delegate { myNotifyIcon.ShowBalloonTip(10000); };

        Application.Run();
    }

在检查Windows 10后,决定检查CurrentBuild注册表项。任何大于或等于14393(周年纪念日)的建筑,我将省略气球

    bool AppNameInBaloon = false;

    string BuildString = ReadHKLMValue(@"SOFTWARE\Microsoft\Windows NT\CurrentVersion", "CurrentBuild");

    int CurrentBuild;

    bool WasParsed = Int32.TryParse(BuildString, out CurrentBuild);

    if (WasParsed)
    {
        if (CurrentBuild >= 14393)
        {
            AppNameInBaloon = true;
        }
    }


private static string ReadHKLMValue(string regPath, string value)
    {
        RegistryKey localKey;

        if (Environment.Is64BitOperatingSystem)
        {
            localKey = RegistryKey.OpenBaseKey(RegistryHive.LocalMachine, RegistryView.Registry64);
        }
        else
        {
            localKey = RegistryKey.OpenBaseKey(RegistryHive.LocalMachine, RegistryView.Registry32);
        }

        string keyValue;

        try
        {
            keyValue = localKey.OpenSubKey(regPath).GetValue(value).ToString();
            return keyValue;
        }
        catch
        {
            keyValue = "";
        }

        return keyValue;
    }

代码怎么样?现在听起来,这是一个操作系统的问题,这是离题的。