private void UpdateControls() { // special case if our entry is null MathBoxLogEntry entry = this.entry; if (entry == null) { recordNumberLabel.Content = string.Empty; entry = new MathBoxLogEntry(); } else { recordNumberLabel.Content = this.recordNumber; } pc.Field = entry.GetAttribute("PC"); addressIn.Field = entry.GetAttribute("AddressIn"); dataIn.Field = entry.GetAttribute("DataIn"); begin.Field = entry.GetAttribute("BEGIN"); j.Field = entry.GetAttribute("J"); pcen.Field = entry.GetAttribute("PCEN"); s.Field = entry.GetAttribute("S"); s0.Field = entry.GetAttribute("S0"); s1.Field = entry.GetAttribute("S1"); jumpLatch.Field = entry.GetAttribute("JumpLatch"); aluE.LogEntry = entry.GetALU("E"); aluF.LogEntry = entry.GetALU("F"); aluJ.LogEntry = entry.GetALU("J"); aluK.LogEntry = entry.GetALU("K"); }
/// <summary> /// Constructs an instance from the given XML element /// </summary> /// <param name="element">the XML element</param> /// <returns>the resulting instance</returns> public static MathBoxLogEntry FromElement(XmlElement element) { MathBoxLogEntry result = new MathBoxLogEntry(); // parse all the child elements // parse all the entries for (int i = 0; i < element.ChildNodes.Count; ++i) { XmlElement child = element.ChildNodes[i] as XmlElement; if (child == null) { continue; } switch (child.Name) { case "ALU": result.alu.Add(ALULogEntry.FromXML(child)); break; default: result.attributes[child.Name] = child.GetAttribute("value"); break; } } return(result); }