public void loadFridges() { XmlTextReader xmlr = new XmlTextReader(FridgesFile); XmlSerializer xs = new XmlSerializer(typeof(FridgeList)); fridgeList = (FridgeList)xs.Deserialize(xmlr); }
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); } }
public void Deserialize(XmlReader xmlr) { XmlSerializer xs = new XmlSerializer(typeof(FridgeList)); FridgeList list = (FridgeList)xs.Deserialize(xmlr); this.containers = list.containers; }
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); } }