【发布时间】:2016-09-28 08:57:11
【问题描述】:
我创建了一个 WPF 应用程序。它有一个窗口,它隐藏在关闭按钮上。但我想在通知栏中显示它。当用户点击它时,应该会显示窗口。
这是我的代码:
public MainWindow()
{
InitializeComponent();
System.Timers.Timer aTimer = new System.Timers.Timer();
aTimer.Elapsed += new ElapsedEventHandler(Timer_Elapsed);
aTimer.Interval = 3000;
aTimer.Enabled = true;
}
private void Timer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
{
lblProcess.Content = "Test Window"
}
// minimize to system tray when applicaiton is closed
protected override void OnClosing(CancelEventArgs e)
{
// setting cancel to true will cancel the close request
// so the application is not closed
e.Cancel = true;
this.Hide();
//this.Show();
base.OnClosing(e);
}
我已经读过这个:create-popup-toaster-notifications-in-windows-with-net
还有minimizing-application-to-system-tray-using-wpf-not-using-notifyicon
minimizing-closing-application-to-system-tray-using-wpf
但没明白我该怎么做?
任何帮助表示赞赏!
【问题讨论】:
-
@ManfredRadlwimmer,必须阅读我的问题吗?请先阅读。我想在通知中显示这个
-
是的,我读到了你的问题。您自己链接的帖子包含您需要的所有信息。如果您对已阅读的答案还有其他问题 - 您可以在原始答案中添加评论(当您有足够的声誉时)并要求澄清。由于您没有提供所需的minimal reproducible example,因此我们无法为您提供更多帮助。
-
@ManfredRadlwimmer,它即将隐藏窗口,我做到了,我想要通知
标签: c# wpf notification-bar