using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace NotifyIconControl
{
	public partial class Form1 : Form
	{
		public Form1()
		{
			InitializeComponent();
			InitInstance();
		}

		private void InitInstance()
		{
			ContextMenu ctx = new ContextMenu();
			ctx.MenuItems.Add(new MenuItem("열기"));
			ctx.MenuItems.Add(new MenuItem("실행"));
			ctx.MenuItems.Add(new MenuItem("-"));
			ctx.MenuItems.Add(new MenuItem("종료", new EventHandler((sender, ex) => this.Close())));

			notifyIcon.ContextMenu = ctx;
		}

		private void notifyIcon_MouseDoubleClick(object sender, MouseEventArgs e)
		{
			if (this.WindowState == FormWindowState.Minimized)
				this.WindowState = FormWindowState.Normal;

			this.Activate();
		}
	}
}
