Ejemplo n.º 1
0
        internal event AsyncCompletedEventHandler RepoUpdated; // when repo.xml is downloaded

        // get repo.xml from update repository
        internal void CheckRemoteForUpdates()
        {
            lock (_lock)
            {
                if (Checking)
                {
                    return;
                }
                Checking = true;
            }

            var tmpFile = Path.GetTempFileName();
            var path    = Environment.CurrentDirectory;

            path  = path.Replace(@"bin\Debug", "");
            path += @"TestRepo\Repo.xml";
            var webClient = new ImpatientWebClient {
                BaseAddress = path
            };

            webClient.DownloadFileCompleted += (obj, args) =>
            {
                lock (_lock)
                {
                    Checking = false;
                }

                try
                {
                    CheckStoreForUpdates(tmpFile);
                }
                catch (Exception)
                {
                    MessageBox.Show(@"Error while checking repo for updates.");
                    Enabled = false;
                }
                finally
                {
                    File.Delete(tmpFile);
                }

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

            webClient.ImpatientAsyncDownload(repoXmlUri, tmpFile);
        }
Ejemplo n.º 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);
        }