public DataManager() { /* * if (File.Exists(RecipesFile)) * { * StreamReader myReader = new StreamReader(RecipesFile); * recipesList = (RecipesList)recipesListSerializer.Deserialize(myReader); * myReader.Close(); * } * else * recipesList = new RecipesList(); * * if (File.Exists(FridgeFile)) * { * StreamReader myReader = new StreamReader(FridgeFile); * fridge = (Fridge)fridgeSerializer.Deserialize(myReader); * myReader.Close(); * } * else * fridge = new Fridge(); * * if (File.Exists(ProductsFile)) * { * StreamReader myReader = new StreamReader(ProductsFile); * productsList = (ProductsList)productsListSerializer.Deserialize(myReader); * myReader.Close(); * } * else * productsList = new ProductsList(); */ recipesList = new RecipesList(); fridge = new Fridge(); productsList = new ProductsList(); }
public void getProductsList() { try { // if (cookie == null) // if (!login()) // return; HttpWebRequest req = (HttpWebRequest)WebRequest.Create(config.Current.serverAddress + "/synchro/products_list"); req.Headers["Cookie"] = cookie; req.AllowWriteStreamBuffering = true; req.KeepAlive = true; req.Method = "Get"; HttpWebResponse HttpWResp = (HttpWebResponse)req.GetResponse(); XmlTextReader xmltr = new XmlTextReader(HttpWResp.GetResponseStream()); ProductsList list = new ProductsList(); list.Deserialize(xmltr); HttpWResp.Close(); //mutex.WaitOne(5000, true); productsList = 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 DataManager() { /* if (File.Exists(RecipesFile)) { StreamReader myReader = new StreamReader(RecipesFile); recipesList = (RecipesList)recipesListSerializer.Deserialize(myReader); myReader.Close(); } else recipesList = new RecipesList(); if (File.Exists(FridgeFile)) { StreamReader myReader = new StreamReader(FridgeFile); fridge = (Fridge)fridgeSerializer.Deserialize(myReader); myReader.Close(); } else fridge = new Fridge(); if (File.Exists(ProductsFile)) { StreamReader myReader = new StreamReader(ProductsFile); productsList = (ProductsList)productsListSerializer.Deserialize(myReader); myReader.Close(); } else productsList = new ProductsList(); */ recipesList = new RecipesList(); fridge = new Fridge(); productsList = new ProductsList(); }
public void Deserialize(XmlReader xmlr) { XmlSerializer xs = new XmlSerializer(typeof(ProductsList)); ProductsList list = (ProductsList)xs.Deserialize(xmlr); this.Products = list.Products; }
public void Deserialize(StreamReader iStream) { XmlSerializer xs = new XmlSerializer(typeof(ProductsList)); ProductsList list = (ProductsList)xs.Deserialize(iStream); this.Products = list.Products; }
public void getProductsList() { try { // if (cookie == null) // if (!login()) // return; HttpWebRequest req = (HttpWebRequest)WebRequest.Create(config.Current.serverAddress+"/synchro/products_list"); req.Headers["Cookie"] = cookie; req.AllowWriteStreamBuffering = true; req.KeepAlive = true; req.Method = "Get"; HttpWebResponse HttpWResp = (HttpWebResponse)req.GetResponse(); XmlTextReader xmltr = new XmlTextReader(HttpWResp.GetResponseStream()); ProductsList list = new ProductsList(); list.Deserialize(xmltr); HttpWResp.Close(); //mutex.WaitOne(5000, true); productsList = 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); } }