예제 #1
0
        static void Main()
        {
            TrayAppContext appContext = new TrayAppContext();

            // Retrieve CircleToken on startup
            if (Properties.Settings.Default.CircleToken == "")
            {
                SetAPITokenForm form = new SetAPITokenForm(appContext);
                if (form.ShowDialog() != DialogResult.OK)
                {
                    appContext.Dispose(); return;
                }
            }

            // Set required user parameters on startup
            if (Properties.Settings.Default.Username == "" ||
                Properties.Settings.Default.ProjectName == "" ||
                Properties.Settings.Default.VCSType == "")
            {
                SetProjectDetailsForm form = new SetProjectDetailsForm(appContext, true);
                if (form.ShowDialog() != DialogResult.OK)
                {
                    appContext.Dispose(); return;
                }
            }

            // Populate tray icon if we have everything we need to do so.
            appContext.RefreshBuilds();
            appContext.RestartTimer();

            Application.Run(appContext);
        }
예제 #2
0
        // Events
        private void NumBuilds_OnClick(object source, EventArgs e)
        {
            Properties.Settings.Default.NumBuilds = int.Parse(((ToolStripItem)source).Text);
            Properties.Settings.Default.Save();
            appContext.NumBuilds = Properties.Settings.Default.NumBuilds;

            ToolStripMenuItem menu       = (ToolStripMenuItem)Items.Find(NUM_BUILDS_MENU_NAME, false)[0];
            ToolStripMenuItem sourceMenu = (ToolStripMenuItem)source;

            foreach (ToolStripMenuItem item in menu.DropDownItems)
            {
                if (item.Text != sourceMenu.Text)
                {
                    item.Checked = false;
                }
                else
                {
                    item.Checked = true;
                }
            }

            appContext.RefreshBuilds();
        }