Пример #1
0
        public void ricarica()
        {
            var xml = XmlReader.Create("eventi.xml");

            File.Copy("eventi.xml", "eventitemp.xml", true);
            var fs = new FileStream("eventitemp.xml", FileMode.Open, FileAccess.ReadWrite, FileShare.ReadWrite);

            try
            {
                ds = new DataSet();
                ds.ReadXml(xml);
                xml.Close();
                XmlSerializer x = new XmlSerializer(typeof(Eventii));
                eviii = (Eventii)x.Deserialize(fs);
                dataGridView1.DataSource = ds.Tables[1];
            }
            catch (Exception)
            { }
            finally
            {
                dataGridView1.Size     = new Size(772, 454);
                dataGridView1.Location = new Point(334, 80);
                dataGridView1.Refresh();
                fs.Close();
                xml.Close();
            }
        }
Пример #2
0
        public static Eventii XMLFTP()
        {
            //FileStream file = File.Create("eventi.xml");
            XmlSerializer xmlSerializer = new XmlSerializer(typeof(Eventii));
            Eventii       ev            = null;

            try
            {
                FtpWebRequest request = (FtpWebRequest)WebRequest.Create("ftp://www.teatrotse.com/teatrotse.com/Evento/evento.xml");
                request.Method      = WebRequestMethods.Ftp.DownloadFile;
                request.Credentials = new NetworkCredential("*****@*****.**", "Teatro09127");
                FtpWebResponse response       = (FtpWebResponse)request.GetResponse();
                Stream         responseStream = response.GetResponseStream();
                StreamReader   reader         = new StreamReader(responseStream);
                File.WriteAllText("eventi.xml", reader.ReadToEnd());
                using (FileStream file = new FileStream("eventi.xml", FileMode.OpenOrCreate, FileAccess.ReadWrite, FileShare.ReadWrite))
                {
                    ev = (Eventii)xmlSerializer.Deserialize(file);
                }

                foreach (var img in ev.EventiTeatroDelSegno)
                {
                    EventoSingolo.GetImg(img.imgPath);
                }
            }
            catch (Exception)
            {
            }
            return(ev);
        }
Пример #3
0
        public FormTDS()
        {
            InitializeComponent();
            eviii.EventiTeatroDelSegno = new List <EventoSingolo>(1);
            grab();
            Controls.Add(dataGridView1);
            var evTemp = Eventii.XMLFTP();

            if (evTemp != null)
            {
                eviii = evTemp;
            }
            ricarica();
            dataGridView1.ReadOnly            = true;
            dataGridView1.Click              += DataGridView1_Click;
            dataGridView1.CurrentCellChanged += DataGridView1_CurrentCellChanged;
            dataGridView1.BackgroundColor     = Color.AliceBlue;
        }