public MainWindow() { InitializeComponent(); m_notifyIcon = MyNotifyIcon; m_openCommand = new RelayCommand(x => { if (WindowState == WindowState.Minimized) { WindowState = WindowState.Normal; ShowInTaskbar = true; } else if (WindowState == WindowState.Normal) { Activate(); } }, x => WindowState == WindowState.Minimized || WindowState == WindowState.Normal); m_notifyIcon.DoubleClickCommand = m_openCommand; m_notifyIcon.TrayBalloonTipClicked += TrayBalloonTipClicked; DataContext = Model = new AppModel(m_notifyIcon, TaskbarItemInfo); Loaded += OnLoaded; }