Exemplo n.º 1
0
        // This is the event handler for a left click on the icon
        private void ContextMenuStrip_Opening(object sender, System.ComponentModel.CancelEventArgs e)
        {
            e.Cancel = false;
            notifyIcon.ContextMenuStrip.Items.Clear();
            notifyIcon.ContextMenuStrip.Items.Add(UiUtils.GenerateItem("&Open",
                                                                       (o, args) => GwupeClientAppContext.CurrentAppContext.UIManager.Show()));
            ToolStripMenuItem logoutItem = UiUtils.GenerateItem("&Logout", (o, args) => _appContext.LoginManager.Logout());

            if (!_appContext.LoginManager.IsLoggedIn)
            {
                logoutItem.Enabled = false;
            }
            notifyIcon.ContextMenuStrip.Items.Add(logoutItem);
            notifyIcon.ContextMenuStrip.Items.Add(UiUtils.GenerateItem("&Exit", exitItem_Click));
        }