Esempio n. 1
0
        private void loadButton_Click(object sender, EventArgs e)
        {
            string mihaiUrl = "http://10.10.2.102/export/";
            HttpWebRequest request;
            WebResponse response;

            request = (HttpWebRequest)WebRequest.Create(mihaiUrl);
            request.AllowAutoRedirect = false;

            try
            {
                response = request.GetResponse();
                XmlDocument xmlDoc = new XmlDocument();
                // MemoryStream ms = new MemoryStream(response.GetResponseStream());
                xmlDoc.Load(response.GetResponseStream());
                XmlNodeList appList = xmlDoc.GetElementsByTagName("app");
                foreach (XmlNode node in appList)
                {
                    AppContainer appCont = new AppContainer();
                    foreach (XmlNode child in node.ChildNodes)
                    {
                        switch (child.Name)
                        {
                            case "id":
                                appCont.appId = child.InnerText;
                                break;
                            case "name":
                                appCont.name = child.InnerText;
                                break;
                            case "short-desc":
                                appCont.descShort = child.InnerText;
                                break;
                            case "long-desc":
                                appCont.descLong = child.InnerText;
                                break;
                            case "category":
                                appCont.category = child.InnerText;
                                break;
                            case "keywords":
                                appCont.keywords = child.InnerText;
                                break;
                            case "icon":
                                appCont.icon = child.InnerText;
                                break;
                            case "version":
                                appCont.verison = child.InnerText;
                                break;
                            case "link":
                                appCont.link = child.InnerText;
                                break;
                        }
                    }

                    IconDownloader.AddToQueue(appCont.appId, appCont.icon);
                    ListInvokeAddItem(appCont);
                }
            }
            catch
            { }
        }
Esempio n. 2
0
        private void DownloadLink(AppContainer appCont)
        {
            WebClient webClient = new WebClient();
            webClient.DownloadFileCompleted   += new AsyncCompletedEventHandler(Completed);
            webClient.DownloadProgressChanged += new DownloadProgressChangedEventHandler(ProgressChanged);
            webClient.DownloadFileAsync(new Uri(appCont.link), "temp.exe");
            toolStripStatusLabel.Text = "Downloading";

            toolStripProgressBar.Visible = true;
            toolStripStatusLabel.Visible = true;
        }
Esempio n. 3
0
 public void ListInvokeAddItem(AppContainer appCont)
 {
     installAppslistView.Invoke(new MethodInvoker( () => ListAddItem(appCont) ) );
 }
Esempio n. 4
0
 private void ListAddItem(AppContainer appCont)
 {
     ListViewItem appItem = new ListViewItem(appCont.name);
     appItem.SubItems.Add(appCont.descShort);
     appItem.ImageKey = appCont.appId;
     appItem.Tag = appCont;
     installAppslistView.Items.Add(appItem);
 }