/// <summary> /// Load the data for this class /// </summary> private void LoadData() { List <AlignmentModel> Alignments; Alignments = AlignmentModel.GetAll(); AlignmentNames = new List <string>(); Alignment = new SortedDictionary <Guid, string>(); AlignmentbyName = new SortedDictionary <string, Guid>(); foreach (AlignmentModel newModel in Alignments) { AlignmentNames.Add(newModel.Name); Alignment.Add(newModel.Id, newModel.Name); AlignmentbyName.Add(newModel.Name, newModel.Id); } }
private void OnAlignmentEditButtonClick(object sender, EventArgs e) { List <AlignmentModel> alignments; //set up the window AlignmentEditWindow = new CheckedListBoxEditWindow(); AlignmentEditWindow.SetSaveEvent(OnAlignmentEditSaveButtonClick); AlignmentEditWindow.SetCancelEvent(OnAlignmentEditCancelButtonClick); alignments = AlignmentModel.GetAll(); foreach (AlignmentModel alignment in alignments) { AlignmentEditWindow.AddCheckbox(alignment.Name, AlignmentsAllowedListBox.Items.Contains(alignment.Name)); } AlignmentEditWindow.Show(this); AlignmentEditWindow.Left = this.Left + ChildWindowLocation.X; AlignmentEditWindow.Top = this.Top + ChildWindowLocation.Y; }
private void OnAlignmentEditSaveButtonClick(object sender, EventArgs e) { List <AlignmentModel> alignments; alignments = AlignmentModel.GetAll(); Model.AllowedAlignments = new List <AlignmentModel>(); for (int i = 0; i < alignments.Count; i++) { if (AlignmentEditWindow.GetCheckboxStatus(i) == true) { Model.AllowedAlignments.Add(alignments[i]); } } //update the allowed allignments list box AlignmentsAllowedListBox.Items.Clear(); foreach (AlignmentModel alignment in Model.AllowedAlignments) { AlignmentsAllowedListBox.Items.Add(alignment.Name); } DataHasChanged = true; AlignmentEditWindow.Close(); }