Пример #1
0
        public void loadRecipesList()
        {
            XmlTextReader xmlr = new XmlTextReader(RecipesFile);

            recipesList.Deserialize(xmlr);
            xmlr.Close();
        }
Пример #2
0
        public void getRecipesList()
        {
            try
            {
                HttpWebRequest req = (HttpWebRequest)WebRequest.Create(config.Current.serverAddress + "/synchro/recipes_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());
                RecipesList     list      = new RecipesList();
                list.Deserialize(xmltr);
                HttpWResp.Close();

                recipesList = list;
                List <Recipe> rList = new List <Recipe>();
                foreach (RecipeForList r in recipesList.ListedRecipies)
                {
                    Recipe re = getRecipe(r.id);
                    rList.Add(re);
                }
                recipesList.Recipes = rList;
            }
            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 getRecipesList()
        {
            try
            {
                HttpWebRequest req = (HttpWebRequest)WebRequest.Create(config.Current.serverAddress + "/synchro/recipes_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());
                RecipesList list = new RecipesList();
                list.Deserialize(xmltr);
                HttpWResp.Close();

                recipesList = list;
                List<Recipe> rList = new List<Recipe>();
                foreach (RecipeForList r in recipesList.ListedRecipies)
                {
                    Recipe re = getRecipe(r.id);
                    rList.Add(re);
                }
                recipesList.Recipes = rList;
            }
            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);
            }
        }