Example #1
0
        public void Read(XmlReader xR)
        {
            // ------------------------------------------------------------
            WERROR.writeLog(ClassName + ".Read Folie: " + FoilNr);

            while (xR.Read()) {
                if (xR.NodeType == XmlNodeType.EndElement) break;
                if (xR.NodeType == XmlNodeType.Element) {
                    switch (xR.Name) {
                        case "foilname": if (xR.MoveToContent() != XmlNodeType.None) FoilName = xR.ReadString(); break;
                        case "duration": if (xR.MoveToContent() != XmlNodeType.None) {
                                DurationSec = Convert.ToInt32(xR.ReadString());
                                if (DurationSec == WCONST.NONUMBER) DurationSec = 0;
                            }
                            break;
                        case "delay": if (xR.MoveToContent() != XmlNodeType.None) {
                                Delay = Convert.ToInt32(xR.ReadString());
                                if (Delay == WCONST.NONUMBER) Delay = 0;
                            }
                            break;
                        case "speachtime": if (xR.MoveToContent() != XmlNodeType.None) {
                                SpeachTime = Convert.ToInt32(xR.ReadString());
                                if (SpeachTime == WCONST.NONUMBER) SpeachTime = 0;
                            }
                            break;
                        case "noticefile": if (xR.MoveToContent() != XmlNodeType.None) { String dummy = xR.ReadString(); } break;
                        case "note":
                            if (xR.MoveToContent() != XmlNodeType.None) {
                                String note = xR.ReadString();
                                if (note == WCONST.UNKNOWN) note = " ";
                                RichTextBox rtb = new RichTextBox();
                                WRICHTEXT.SetTextAndFonts(note, rtb, FoilsNoteFont);
                                NoteRtf = WRICHTEXT.RtfToString(rtb.Document);
                            }
                            break;
                        case "notertf": xR.Read(); if (xR.MoveToContent() == XmlNodeType.CDATA) { NoteRtf = xR.ReadString(); } break;
                        case "handouttext":
                            if (xR.MoveToContent() != XmlNodeType.None) {
                                String note = xR.ReadString();
                                if (note == WCONST.UNKNOWN) note = " ";
                                RichTextBox rtb = new RichTextBox();
                                WRICHTEXT.SetTextAndFonts(note, rtb, HandoutNoteFont);
                                HandoutNoteRtf = WRICHTEXT.RtfToString(rtb.Document);
                            }
                            break;
                        case "notekeys": if (xR.MoveToContent() != XmlNodeType.None) { String dummy = xR.ReadString(); } break;
                        case "notematerial": if (xR.MoveToContent() != XmlNodeType.None) { String dummy = xR.ReadString(); } break;
                        case "handoutfile": if (xR.MoveToContent() != XmlNodeType.None) { String dummy = xR.ReadString(); } break;
                        case "handoutnotertf": xR.Read(); if (xR.MoveToContent() == XmlNodeType.CDATA) { HandoutNoteRtf = xR.ReadString(); } break;

                        // Folientext
                        case "foilsfont": FoilsFont.ReadFont(xR); break;
                        case "foilstext": FoilsFont.ReadText(xR); break;

                        // Foliennotizen
                        case "foilsnotefont": FoilsNoteFont.ReadFont(xR); break;
                        case "foilsnotetext": FoilsNoteFont.ReadText(xR); break;

                        // Handout
                        case "handoutnotefont": HandoutNoteFont.ReadFont(xR); break;
                        case "handoutnotetext": HandoutNoteFont.ReadText(xR); break;

                        case "active": if (xR.MoveToContent() != XmlNodeType.None) Active = Convert.ToBoolean(xR.ReadString()); break;
                        case "isshowlegend": if (xR.MoveToContent() != XmlNodeType.None) IsShowLegend = Convert.ToBoolean(xR.ReadString()); break;
                        case "autoplay": if (xR.MoveToContent() != XmlNodeType.None) AutoPlay  = Convert.ToBoolean(xR.ReadString()); break;
                        case "isprintable": if (xR.MoveToContent() != XmlNodeType.None) IsPrintable = Convert.ToBoolean(xR.ReadString()); break;
                        case "isprintfoils": if (xR.MoveToContent() != XmlNodeType.None) IsPrintFoils = Convert.ToBoolean(xR.ReadString()); break;
                        case "isprintnotes": if (xR.MoveToContent() != XmlNodeType.None) IsPrintNotes = Convert.ToBoolean(xR.ReadString()); break;
                        case "isprinthandouts": if (xR.MoveToContent() != XmlNodeType.None) IsPrintHandouts = Convert.ToBoolean(xR.ReadString()); break;
                        case "layer":
                            Layer tmpLayer = new Layer();
                            tmpLayer.LayNr = Layers.Count;
                            tmpLayer.Read(xR);
                            tmpLayer.ChangeLayerName();
                            // rtf-Text in Text umwandeln
                            if (WSGLOBAL.ActShow.ShowKind != "book" && tmpLayer.LayText == null) {
                                if (tmpLayer.LayKind == "rtftext") {
                                    FlowDocument fd = WRICHTEXT.StringToRtf(tmpLayer.LayRtfText);
                                    TextRange ttr = new TextRange(fd.ContentStart, fd.ContentEnd);
                                    tmpLayer.LayText = ttr.Text;
                                    tmpLayer.LayKind = "text";
                                }
                            }
                            Layers.Add(tmpLayer);
                            break;
                        case "properties":
                            Active = false; IsShowLegend = false; AutoPlay = false;
                            if (xR.MoveToContent() != XmlNodeType.None) {
                                if (xR.HasAttributes) {
                                    while (xR.MoveToNextAttribute()) {
                                        switch (xR.Name) {
                                            case "duration": DurationSec = Convert.ToInt32(xR.Value);
                                                if (DurationSec == WCONST.NONUMBER) DurationSec = 0;
                                                break;
                                            case "delay": Delay = Convert.ToInt32(xR.Value);
                                                if (Delay == WCONST.NONUMBER) Delay = 0;
                                                break;
                                            case "speachtime": SpeachTime = Convert.ToInt32(xR.Value);
                                                if (SpeachTime == WCONST.NONUMBER) SpeachTime = 0;
                                                break;
                                            case "active": Active = Convert.ToBoolean(xR.Value); break;
                                            case "isshowlegend": IsShowLegend = Convert.ToBoolean(xR.Value); break;
                                            case "autoplay": AutoPlay = Convert.ToBoolean(xR.Value); break;
                                        }
                                    }
                                }
                            }
                            break;
                        case "print":
                            IsPrintFoils = false; IsPrintNotes = false; IsPrintHandouts = false;
                            if (xR.MoveToContent() != XmlNodeType.None) {
                                if (xR.HasAttributes) {
                                    while (xR.MoveToNextAttribute()) {
                                        switch (xR.Name) {
                                            case "isprintfoils": IsPrintFoils = Convert.ToBoolean(xR.Value); break;
                                            case "isprintnotes": IsPrintNotes = Convert.ToBoolean(xR.Value); break;
                                            case "isprinthandouts": IsPrintHandouts = Convert.ToBoolean(xR.Value); break;
                                        }
                                    }
                                }
                            }
                            break;
                        default:
                            if (xR.MoveToContent() != XmlNodeType.None)  {
                                if (xR.Name != "Foil")
                                    WERROR.writeLog("Falsche XML-Zeile in Foile: " + xR.Name + " : " + xR.ReadString(), 0);
                            }
                            break;
                    }
                }
            }
        }