/// <summary> /// Loads the folder state i.e. SelectionState, UploadedMailCount, /// FailedMailCount, LastUploadedMailId. Then it recurses on the /// sub folders. /// </summary> void LoadFolderModelState(XmlElement folderXmlElement, FolderModel folderModel) { LKGStatePersistor.LoadSelectedState( folderXmlElement, folderModel); foreach (XmlNode childXmlNode in folderXmlElement.ChildNodes) { XmlElement childXmlElement = childXmlNode as XmlElement; if (childXmlElement == null) { continue; } if (childXmlElement.Name != LKGStatePersistor.MailElementName) { continue; } string mailId = childXmlElement.GetAttribute(LKGStatePersistor.MailIdAttrName); if (mailId == null || mailId.Length == 0) { continue; } string failureReason = childXmlElement.GetAttribute( LKGStatePersistor.FailureReasonAttrName); if (failureReason == null || failureReason.Length == 0) { folderModel.SuccessfullyUploaded(mailId); } else { FailedMailDatum failedMailDatum = new FailedMailDatum(childXmlElement.InnerText, failureReason); folderModel.FailedToUpload(mailId, failedMailDatum); } } this.LoadFolderModelsState( folderXmlElement.ChildNodes, folderModel.Children); }