public static IUIControl TryParseControl(Notes.BaseControl.CreateParams parentParams, XmlReader reader) { // either create/parse a new control, or return null. if (Paragraph.ElementTagMatches(reader.Name)) { #if __WIN__ return(new EditableParagraph(parentParams, reader)); #else return(new Paragraph(parentParams, reader)); #endif } else if (Canvas.ElementTagMatches(reader.Name)) { return(new Canvas(parentParams, reader)); } else if (StackPanel.ElementTagMatches(reader.Name)) { return(new StackPanel(parentParams, reader)); } else if (List.ElementTagMatches(reader.Name)) { return(new List(parentParams, reader)); } else if (ListItem.ElementTagMatches(reader.Name)) { return(new ListItem(parentParams, reader)); } else if (RevealBox.ElementTagMatches(reader.Name)) { #if __WIN__ return(new EditableRevealBox(parentParams, reader)); #else return(new RevealBox(parentParams, reader)); #endif } else if (Quote.ElementTagMatches(reader.Name)) { #if __WIN__ return(new EditableQuote(parentParams, reader)); #else return(new Quote(parentParams, reader)); #endif } else if (TextInput.ElementTagMatches(reader.Name)) { #if __WIN__ return(new EditableTextInput(parentParams, reader)); #else return(new TextInput(parentParams, reader)); #endif } else if (Header.ElementTagMatches(reader.Name)) { #if __WIN__ return(new EditableHeader(parentParams, reader)); #else return(new Header(parentParams, reader)); #endif } else if (NoteText.ElementTagMatches(reader.Name)) { #if __WIN__ return(new EditableNoteText(parentParams, reader)); #else return(new NoteText(parentParams, reader)); #endif } throw new Exception(String.Format("Control of type {0} does not exist.", reader.Name)); }