Esempio n. 1
0
 private void campaignSelector_SelectedIndexChanged(object sender, EventArgs e)
 {
     // Only perform this function IF:
     // * the newly selected index is not the default "Active campaign" text
     // * the newly selected index is not the current campaign or there is no active campaign
     if (campaignSelector.SelectedItem.ToString() == "No Campaign")
     {
         currentCalendar.activeCampaign = null;
     }
     else if (currentCalendar.activeCampaign != null && campaignSelector.SelectedItem.ToString() == currentCalendar.activeCampaign.Tag)
     {
         return;
     }
     else
     {
         foreach (Campaign c in currentCalendar.CampaignList)
         {
             if (c.Tag == campaignSelector.SelectedItem.ToString())
             {
                 MessageBox.Show("Successufully activated " + c.Name, "Success", MessageBoxButtons.OK, MessageBoxIcon.Information);
                 currentCalendar.setActiveCampaign(c);
                 updateCampaignList();
                 return;
             }
         }
         MessageBox.Show("Error: Could not activate campaign.", null, MessageBoxButtons.OK, MessageBoxIcon.Error);
         campaignSelector.SelectedIndex = 0;
         return;
     }
 }
Esempio n. 2
0
        private void makeActiveButton_Click(object sender, EventArgs e)
        {
            Campaign selectedCampaign = returnSelectedCampaign();

            if (selectedCampaign != null)
            {
                if (selectedCampaign.isEnded())
                {
                    if (MessageBox.Show("This campaign has ended, activating it will start it again, continue?", "Campaign has ended", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation) == DialogResult.No)
                    {
                        return;
                    }
                    else
                    {
                        selectedCampaign.toggleEnded();
                    }
                }

                MessageBox.Show("Successufully activated " + selectedCampaign.Name, "Success", MessageBoxButtons.OK, MessageBoxIcon.Information);
                currentCalendar.setActiveCampaign(selectedCampaign);
            }
            else
            {
                MessageBox.Show("Error: Could not activate campaign.", null, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            UpdateTree();
        }