private MenuItem[] CreateNotifyIconContextMenu() { var commands = new List <Tuple <string, ICommand> > { new Tuple <string, ICommand>("Start", _viewModel.StartCommand), new Tuple <string, ICommand>("Pause", _viewModel.PauseCommand), new Tuple <string, ICommand>("Stop", _viewModel.StopCommand), new Tuple <string, ICommand>("Skip", _viewModel.SkipCommand), new Tuple <string, ICommand>("Reset session", _viewModel.ResetCommand), new Tuple <string, ICommand>("Settings", _viewModel.ShowSettingsCommand), new Tuple <string, ICommand>("Minimize", _viewModel.MinimizeCommand), }; var menuItems = commands.Select(x => { var command = x.Item2; var item = new MenuItem { Text = x.Item1, Enabled = command.CanExecute(null) }; item.Click += (sender, args) => { if (command.CanExecute(null)) { command.Execute(null); } }; return(item); }); var close = new MenuItem { Text = @"Exit" }; close.Click += (o, s) => { _app.CloseApp(); }; return(menuItems.Union(new List <MenuItem> { close }).ToArray()); }