Example #1
0
        /// <summary>
        /// Handler when the user has added a risk to the project.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void addRiskToProject(object sender, AddRiskToProjectEvent e)
        {
            if (e.projectID != this.projectID)
            {
                return;
            }
            ARA_ListItem clickedText = (ARA_ListItem)sender;

            if (clickedText != null)
            {
                //Is the risk already in the project?
                if (clickedText.BackgroundColor == ARA_Colors.ARA_Green)
                {
                    //Change its color and remove it from the database.
                    clickedText.BackgroundColor = Color.White;
                    this.queriesTableAdapter1.Delete_From_ProjectRisks(e.projectID, e.riskID);
                }
                else
                {
                    //Change its color and add a new risk to the database.
                    clickedText.BackgroundColor = ARA_Colors.ARA_Green;
                    this.queriesTableAdapter1.Insert_In_ProjectRisks(e.projectID, e.riskID);
                }
                //Update the text.
                clickedText.Invalidate();
            }

            //Let the application know we added a risk.
            ARA_Events.triggerRiskAddedToProjectEvent(this.projectID);
        }