コード例 #1
0
        // download "component.xml" for specified component
        private void InstallOrUpdateComponent(ComponentReference comp)
        {
            string tmpFile   = Path.GetTempFileName();
            var    webClient = new ImpatientWebClient {
                BaseAddress = "http://140.176.10.7:8000/cintron/BioInfoTerminal.git"
            };

            webClient.DownloadFileCompleted += (obj, args) =>
            {
                InstallComponentFromRecord(tmpFile, comp);
                File.Delete(tmpFile);
            };
            Uri compXmlUri = new Uri("component.xml", UriKind.Relative);

            webClient.ImpatientAsyncDownload(compXmlUri, tmpFile);
        }
コード例 #2
0
        // get repo.xml from update repository
        internal void CheckRemoteForUpdates()
        {
            lock (_lock)
            {
                if (Checking)
                {
                    return;
                }
                Checking = true;
            }
            string tmpFile   = Path.GetTempFileName();
            var    webClient = new ImpatientWebClient {
                BaseAddress = "http://140.176.10.7:8000/cintron/BioInfoTerminal.git"
            };

            webClient.DownloadFileCompleted += (obj, args) =>
            {
                lock (_lock)
                    Checking = false;
                try
                {
                    CheckStoreForUpdates(tmpFile);
                }
                catch (Exception)
                {
                    const string msg = "Error while checking repo for updates.";
                }
                finally
                {
                    File.Delete(tmpFile);
                }

                RepoUpdated?.Invoke(obj, args);
            };
            Uri repoXmlUri = new Uri("repo.xml", UriKind.Relative);

            webClient.ImpatientAsyncDownload(repoXmlUri, tmpFile);
        }