Tôi muốn giảm thiểu ứng dụng vào khay hệ thống bằng cách sử dụng WPF. "NotifyIcon" là cách duy nhất để đạt được kết quả này? Nếu có, không gian tên nào là cần thiết để sử dụng "NotifyIcon" trong WPF?Tôi có thể sử dụng NotifyIcon trong WPF không?
Nếu có thể với "NotifyIcon", vui lòng cung cấp một số gợi ý, làm cách nào tôi có thể sử dụng điều đó trong Mainwindow của mình?
cửa sổ chính của tôi là,
public partial class MonthView : MetroWindow
{
public DateTime SelectedDate { get; set; }
public MonthView()
{
InitializeComponent();
calMain.DisplayDate = DateTime.Today;
Globals._globalController = new AppController();
Globals._globalController.appTaskManager.setupLocal();
Globals._globalController.setMonthViewWindow(this);
}
public void calItemSelectedDate(object sender, SelectionChangedEventArgs e)
{
DateTime d;
if (sender is DateTime)
{
d = (DateTime)sender;
}
else
{
DateTime.TryParse(sender.ToString(), out d);
}
SelectedDate = d;
ShowActivity(d);
}
public void ShowActivity(DateTime date)
{
DayView Activity = new DayView(date);
Activity.Show();
this.Hide();
}
private void SetButton_Click(object sender, RoutedEventArgs e)
{
SettingsView set = new SettingsView();
set.Show();
this.Hide();
}
}
Tôi nghĩ đây là một bản sao http://stackoverflow.com/questions/10230579/easiest-way-to-have-a-program-minimize-itself-to-the-system-tray-using-net-4 – Swift