private void InitComponents( string title, List <MenuItem> menuItems) { _mpc = new MpcClient(); Text = title; ClientSize = new Size(800, 438); Padding = new Padding(2, 2, 2, 2); CenterToScreen(); _list = new ListPane(menuItems); _searchBox = new SearchBox(); _searchBox.KeyUp += (sender, e) => Search(sender, e, _searchBox.Text); _button = new SearchButton(); _button.KeyDown += (sender, e) => Search(sender, e, _searchBox.Text); _button.Click += (sender, e) => Search(sender, e, _searchBox.Text); AcceptButton = _button; CancelButton = _button; Controls.Add(_list); Controls.Add(_searchBox); Controls.Add(_button); _list.AutoResize(); _searchBox.AutoResize(); _searchBox.Focus(); _searchBox.Select(); _button.BringToFront(); GetPlaylist(); }
public AppContext() { Application.ApplicationExit += ApplicationExitHandler; _mpc = new MpcClient(); _mpc.Cmd(Command.status, out Status status); _tray = new NotifyIcon { Text = GetType().Namespace, Icon = status.GetIcon(), // investigate icon quality ContextMenuStrip = GetContextMenu(), Visible = true }; _tray.MouseDoubleClick += (sender, e) => MpcCommand(Command.toggle); _tray.MouseClick += (sender, e) => OnClick(sender, e); var refresh = new Thread(BackgroundRefresh); refresh.Start(); }