Example #1
0
        private void InitializeNotifyIcon()
        {
            var contextMenu = new ContextMenu();

            contextMenu.AppendCommand("New Gist", new EventHandler(_notifyIcon_New));
            contextMenu.AppendCommand("Refresh Gists", new EventHandler(_notifyIcon_Refresh));
            contextMenu.AppendCommand("Check for Updates", new EventHandler(_notifyIcon_CheckUpdates));
            contextMenu.AppendSeparator();
            contextMenu.AppendCommand("Logout", new EventHandler(_notifyIcon_Logout));
            contextMenu.AppendSeparator();
            contextMenu.AppendCommand("Exit", new EventHandler(_notifyIcon_Exit));

            _notifyIcon              = new NotifyIcon();
            _notifyIcon.ContextMenu  = contextMenu;
            _notifyIcon.DoubleClick += _notifyIcon_DoubleClick;
            var iconStream = System.Windows.Application.GetResourceStream(new Uri("pack://application:,,,/GistInTime;component/cloud.ico")).Stream;

            _notifyIcon.Icon    = new Icon(iconStream);
            _notifyIcon.Text    = "GistInTime";
            _notifyIcon.Visible = true;
        }