Пример #1
0
        public void loadFridges()
        {
            XmlTextReader xmlr = new XmlTextReader(FridgesFile);
            XmlSerializer xs   = new XmlSerializer(typeof(FridgeList));

            fridgeList = (FridgeList)xs.Deserialize(xmlr);
        }
Пример #2
0
        public void getFridgeList()
        {
            try
            {
                //  if (cookie == null)
                //    if (!login())
                //      return;
                HttpWebRequest req = (HttpWebRequest)WebRequest.Create(config.Current.serverAddress + "/containers.xml?user="******"Cookie"]         = cookie;
                req.AllowWriteStreamBuffering = true;
                req.KeepAlive = true;
                req.Method    = "Get";
                HttpWebResponse HttpWResp = (HttpWebResponse)req.GetResponse();
                XmlTextReader   xmltr     = new XmlTextReader(HttpWResp.GetResponseStream());
                FridgeList      list      = new FridgeList();
                list.Deserialize(xmltr);
                HttpWResp.Close();

                //mutex.WaitOne(5000, true);
                fridgeList = list;
                //mutex.ReleaseMutex();
            }
            catch (WebException ee)
            {
                /*
                 * WebResponse resp = ee.Response;
                 *
                 * StreamReader sr=new StreamReader(resp.GetResponseStream());
                 * string allresp=sr.ReadToEnd();
                 * string respmes = ee.Message;
                 *
                 */
                MessageBox.Show(ee.Message);
            }
        }
Пример #3
0
        public void Deserialize(XmlReader xmlr)
        {
            XmlSerializer xs   = new XmlSerializer(typeof(FridgeList));
            FridgeList    list = (FridgeList)xs.Deserialize(xmlr);

            this.containers = list.containers;
        }
Пример #4
0
 public void loadFridges()
 {
     XmlTextReader xmlr = new XmlTextReader(FridgesFile);
     XmlSerializer xs = new XmlSerializer(typeof(FridgeList));
     fridgeList = (FridgeList)xs.Deserialize(xmlr);
 }
Пример #5
0
        public void getFridgeList()
        {
            try
            {
                //  if (cookie == null)
                //    if (!login())
                //      return;
                HttpWebRequest req = (HttpWebRequest)WebRequest.Create(config.Current.serverAddress + "/containers.xml?user="******"Cookie"] = cookie;
                req.AllowWriteStreamBuffering = true;
                req.KeepAlive = true;
                req.Method = "Get";
                HttpWebResponse HttpWResp = (HttpWebResponse)req.GetResponse();
                XmlTextReader xmltr = new XmlTextReader(HttpWResp.GetResponseStream());
                FridgeList list = new FridgeList();
                list.Deserialize(xmltr);
                HttpWResp.Close();

                //mutex.WaitOne(5000, true);
                fridgeList = list;
                //mutex.ReleaseMutex();
            }
            catch (WebException ee)
            {
                /*
                WebResponse resp = ee.Response;

                StreamReader sr=new StreamReader(resp.GetResponseStream());
                string allresp=sr.ReadToEnd();
                string respmes = ee.Message;

                 */
                MessageBox.Show(ee.Message);
            }
        }