/// <summary> /// Add style for the listItems. /// </summary> /// <param name="listParent"></param> /// <param name="listItem"></param> private void styleListItemAsRisk(ARA_ListGroup listParent, ARA_ListItem listItem) { listItem.Font = new System.Drawing.Font(ARA_Globals.ARA_Font, ARA_Globals.ARA_BaseFontSize - 4F); listItem.HorizontalAlignment = System.Drawing.StringAlignment.Near; listItem.Location = new System.Drawing.Point(111, 65); listItem.Margin = new System.Windows.Forms.Padding(0); listItem.Size = new System.Drawing.Size(750, 24); listItem.Name = "addRisksToProjectTextID"; listItem.ListParent = listParent; listParent.addChild(listItem); listParent.addControlToDropDownButton(listItem); listItem.Scale(new SizeF(ARA_Globals.ARA_BaseFontSize / ARA_Constants.noScaleFontSize, ARA_Globals.ARA_BaseFontSize / ARA_Constants.noScaleFontSize)); }
/// <summary> /// Adds component types to a component group. /// </summary> /// <param name="parentGroup"></param> public void addTypeControlsToGroupControl(ARA_ListGroup parentGroup) { if (parentGroup.ARA_ListGroupDropDownButton.ConnectedPanel.Controls.Count != 0) { return; } foreach (DataRow datarow in this.get_TypeNames_In_GroupTableAdapter.GetData(parentGroup.DropDownButtonText).Rows) { ARA_ListGroup listType = new ARA_ListGroup(); styleListGroupAsType(parentGroup, listType); listType.DropDownButtonText = datarow["TypeName"].ToString(); //Add functions. listType.addFunction(delegate() { DataRow risksInTypeDataRow = this.get_Risks_In_Project_TypeTableAdapter.GetData(this.projectID, parentGroup.DropDownButtonText, datarow["TypeName"].ToString()).Rows[0]; listType.LabelText = risksInTypeDataRow["RisksInProjectGroup"] + "/" + risksInTypeDataRow["RisksInGroup"]; }); listType.updateControl(); listType.addFunction(delegate() { this.addRiskControlsToTypeControl(parentGroup, listType); }); //Add click handler for mass insert/delete risks in project on doubleclick. listType.DoubleClick += delegate(object o, EventArgs e) { DataRow risksInTypeDataRow = this.get_Risks_In_Project_TypeTableAdapter.GetData(this.projectID, parentGroup.DropDownButtonText, datarow["TypeName"].ToString()).Rows[0]; //Execute procedure to add or remove risks from a specific type in the project. this.queriesTableAdapter1.Insert_Risks_From_Type_Into_Project ( this.projectID, parentGroup.DropDownButtonText, datarow["TypeName"].ToString(), risksInTypeDataRow["RisksInProjectGroup"].ToString() != risksInTypeDataRow["RisksInGroup"].ToString() ); //Let the application know we added a risk. ARA_Events.triggerRiskAddedToProjectEvent(this.projectID); }; } }
/// <summary> /// Style the listGroup as a component group control. /// </summary> /// <param name="listGroup"></param> private void styleListGroupAsGroup(ARA_ListGroup listGroup) { listGroup.ARA_ListGroupDropDownButton.Font = this.Font; listGroup.ARA_ListGroupDropDownButton.Padding = new Padding(0); listGroup.ARA_ListGroupText.Font = this.Font; listGroup.BackColor = System.Drawing.SystemColors.Control; listGroup.BackgroundColor = ARA_Colors.ARA_Gray1; listGroup.DropDownButtonFirstTrianglePadding = -1; listGroup.DropDownButtonSecondTrianglePadding = -1; listGroup.DropDownButtonSize = new System.Drawing.Size(656, 37); listGroup.HoverColor = ARA_Colors.ARA_Gray2; listGroup.ImeMode = System.Windows.Forms.ImeMode.On; listGroup.ListParent = null; listGroup.Location = new System.Drawing.Point(31, 9); listGroup.Margin = new System.Windows.Forms.Padding(0); listGroup.Name = "arA_ListGroup1"; listGroup.SelectedColor = ARA_Colors.ARA_Blue6; listGroup.Size = new System.Drawing.Size(750, 415); listGroup.TextSize = new System.Drawing.Size(94, 37); listGroup.Scale(new SizeF(ARA_Globals.ARA_BaseFontSize / ARA_Constants.noScaleFontSize, ARA_Globals.ARA_BaseFontSize / ARA_Constants.noScaleFontSize)); }
private void onRiskProjectOverviewLoad() { //Set scaling. this.Font = new System.Drawing.Font(ARA_Globals.ARA_Font, ARA_Globals.ARA_BaseFontSize); foreach (DataRow datarow in this.tbl_Component_GroupTableAdapter.GetData().Rows) { ARA_ListGroup listGroup = new ARA_ListGroup(); styleListGroupAsGroup(listGroup); //Set button text. listGroup.DropDownButtonText = datarow["GroupName"].ToString(); //Add functions. listGroup.addFunction(delegate() { DataRow risksInGroupDataRow = this.get_Risks_In_Project_GroupTableAdapter.GetData(this.projectID, datarow["GroupName"].ToString()).Rows[0]; listGroup.LabelText = risksInGroupDataRow["RisksInProjectGroup"] + "/" + risksInGroupDataRow["RisksInGroup"]; }); listGroup.updateControl(); listGroup.addFunction(delegate() { this.addTypeControlsToGroupControl(listGroup); }); //Add listGroup to addRiskToProjectPanel. this.addRiskToProjectPanelContent.Controls.Add(listGroup); } }
/// <summary> /// Style a component type listGroup as a componentType listgroup. /// </summary> /// <param name="listParent"></param> /// <param name="listGroup"></param> private void styleListGroupAsType(ARA_ListGroup listParent, ARA_ListGroup listGroup) { listGroup.ARA_ListGroupDropDownButton.Font = new System.Drawing.Font(ARA_Globals.ARA_Font, ARA_Globals.ARA_BaseFontSize); listGroup.ARA_ListGroupText.Font = new System.Drawing.Font(ARA_Globals.ARA_Font, ARA_Globals.ARA_BaseFontSize); listGroup.BackColor = Color.White; listGroup.BackgroundColor = Color.White; listGroup.DropDownButtonFirstTrianglePadding = 5; listGroup.DropDownButtonSecondTrianglePadding = -1; listGroup.DropDownButtonSize = new System.Drawing.Size(656, 28); listGroup.HoverColor = ARA_Colors.ARA_Blue4; listGroup.ImeMode = System.Windows.Forms.ImeMode.On; listGroup.ListParent = listParent; listGroup.Location = new System.Drawing.Point(31, 9); listGroup.Margin = new System.Windows.Forms.Padding(0); listGroup.Name = "arA_ListGroup1"; listGroup.SelectedColor = System.Drawing.Color.FromArgb(((int)(((byte)(76)))), ((int)(((byte)(160)))), ((int)(((byte)(198))))); listGroup.Size = new System.Drawing.Size(750, 415); listGroup.TextSize = new System.Drawing.Size(94, 28); listGroup.TextColor = Color.Black; listParent.addChild(listGroup); listParent.addControlToDropDownButton(listGroup); listGroup.Scale(new SizeF(ARA_Globals.ARA_BaseFontSize / ARA_Constants.noScaleFontSize, ARA_Globals.ARA_BaseFontSize / ARA_Constants.noScaleFontSize)); }
/// <summary> /// Add risks in component type into the component type listGroup. /// </summary> /// <param name="parentGroup"></param> /// <param name="parentType"></param> public void addRiskControlsToTypeControl(ARA_ListGroup parentGroup, ARA_ListGroup parentType) { //Did we already create the controls? if (parentType.ARA_ListGroupDropDownButton.ConnectedPanel.Controls.Count != 0) { return; } //Execute querye and loop through the results. foreach (DataRow datarow in this.get_Risks_In_ProjectGroupTypeTableAdapter.GetData(this.projectID, parentGroup.DropDownButtonText, parentType.DropDownButtonText).Rows) { ARA_ListItem listItem = new ARA_ListItem(); styleListItemAsRisk(parentType, listItem); if (datarow["FileObject"].ToString() != "") { var data = (Byte[])(datarow["FileObject"]); var stream = new MemoryStream(data); listItem.Tag = Image.FromStream(stream); } //Set text of listItem. listItem.TextFirstControl = "ID " + datarow["RiskID"].ToString(); listItem.TextSecondControl = datarow["HazardSituation"].ToString(); listItem.BackgroundColor = datarow["InProject"].ToString() == "1" ? ARA_Colors.ARA_Green : System.Drawing.Color.White; //Add let it execute an event on click. listItem.Click += delegate(object o, System.EventArgs e) { ARA_Events.triggerAddRiskToProjectEvent(o, this.projectID, Int32.Parse(datarow["RiskID"].ToString())); }; listItem.addFunction(delegate() { listItem.BackgroundColor = this.is_Risk_In_ProjectTableAdapter.GetData(this.projectID, Int32.Parse(datarow["RiskID"].ToString())).Rows[0]["InProject"].ToString() == "1" ? ARA_Colors.ARA_Green : Color.White; }); } }