Exemplo n.º 1
0
        private void btnXmlLoad_Click(object sender, EventArgs e)
        {
            var xmlTV = new XmlTV();

            Cursor.Current = Cursors.WaitCursor;

            xmlTV.AddChannel("Channel01", new XmlLangText[] { new XmlLangText("en", "Channel 001"), new XmlLangText("ro", "Kanel Una") }, "http://channel1.com", "http://icons.com/c1.png");
            xmlTV.AddChannel("Channel02", new XmlLangText[] { new XmlLangText("en", "Channel 002") }, "http://channel2.com", null);
            xmlTV.AddProgramme("20161201225000 +0000", "20161201230000 +0000", "Channel01", new XmlLangText("en", "Test program"), null,
                               new XmlLangText("en", "The test program"), new XmlLangText[] { new XmlLangText("en", "Test category"),
                                                                                              new XmlLangText("en", "Second Category") }, null, null);
            xmlTV.SaveXmlTV("F:\\SchedulesDirect\\SD-Demo1.xml");
            Cursor.Current = Cursors.Default;
            ShowXmlTVErrors(ref xmlTV);
        }
Exemplo n.º 2
0
        private void ShowXmlTVErrors(ref XmlTV xmlTV)
        {
            var errorLine = string.Empty;

            foreach (var thisError in xmlTV.GetRawErrors())
            {
                errorLine += $"{thisError.message} ({thisError.code.ToString()})\r\n";
                if (thisError.description != string.Empty)
                {
                    errorLine += $"{thisError.description}\r\n";
                }
            }

            if (errorLine != string.Empty)
            {
                MessageBox.Show(this, errorLine, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }

            xmlTV.ClearErrors();
        }