public static AuditPolicy GetFromWindow(MainWindow window) { // Create instance of policy storage AuditPolicy policy = new AuditPolicy(); // Enumerate every control in items control containing policy foreach (ControlSettingAudit control in window.itemsAuditPolicy.Items.Cast <ControlSettingAudit>()) { policy.HeaderSettingPairs[control.Header] = control.GetScoredItem(); } return(policy); }
public static AuditPolicy Parse(BinaryReader reader) { // Create instance of policy storage AuditPolicy policy = new AuditPolicy(); List <string> keys = policy.HeaderSettingPairs.Keys.ToList(); // Enumerate audits in dictionary storage foreach (string key in keys) { policy.HeaderSettingPairs[key] = ScoredItem <EAuditSettings> .ParseAuditSettings(reader); } return(policy); }