示例#1
0
        private void RefreshAll()
        {
            List <Repo> reponames = new List <Repo>();

            foreach (Repo r in repos)
            {
                reponames.Add(r);
            }
            repos.Clear();
            RefreshBar.Value = 0;
            foreach (Repo r in reponames)
            {
                RefreshProgress.SetProgressNoAnimation(0);

                repos.Add(new Repo(r.url, RefreshProgress, r.srchdir, r.debloc));

                RefreshProgress.SetProgressNoAnimation(100);
                int newval = RefreshBar.Value + (100 / reponames.Count);
                if (newval > 100)
                {
                    RefreshBar.SetProgressNoAnimation(100);
                }
                else
                {
                    RefreshBar.SetProgressNoAnimation(newval);
                }
            }
            RefreshBar.SetProgressNoAnimation(100);
        }
示例#2
0
 private void Refresh_Click(object sender, EventArgs e)
 {
     RefreshProgress.SetProgressNoAnimation(0);
     try {
         AddRepo(EnterRepo.Text);
     } catch (System.Net.WebException ex) {
         RefreshProgress.SetProgressNoAnimation(100);
         MessageBox.Show("Make sure you entered a valid repo, must start with http:// or https://, Error " + ex);
         return;
     }
     RefreshProgress.SetProgressNoAnimation(50);
     ReloadRepos();
     RefreshProgress.SetProgressNoAnimation(100);
 }
示例#3
0
        private void Defrep_Click(object sender, EventArgs e)
        {
            RefreshProgress.SetProgressNoAnimation(0);
            DefaultRepos popup = new DefaultRepos();

            try {
                popup.ShowDialog();
                if (!popup.chosen.MultiOrEquals("", null))
                {
                    MessageBox.Show("This will take a very very long time");
                    string url     = "";
                    string decloc  = "";
                    string srchdir = "main/binary-iphoneos-arm/";
                    string dist    = "/dists/stable/";
                    switch (popup.chosen)
                    {
                    case "bigboss":
                        url    = "http://apt.thebigboss.org/repofiles/cydia";
                        decloc = url;
                        break;

                    case "modmyi":
                        url    = "http://apt.modmyi.com";
                        decloc = url;
                        break;

                    case "saurik":
                        url     = "http://apt.saurik.com/dists/ios";
                        srchdir = "/main/binary-iphoneos-arm/";
                        dist    = "";
                        decloc  = "http://apt.saurik.com/";
                        break;

                    default:
                        url = "";
                        break;
                    }
                    if (url != "")
                    {
                        Adddefault(url, decloc, srchdir, dist);
                    }
                    ReloadRepos();
                    RefreshProgress.SetProgressNoAnimation(100);
                }
            } catch (System.ObjectDisposedException ex) {
                MessageBox.Show("{0} disposed at Defrep_click()", ex.ObjectName);
            }
        }
示例#4
0
        private void RefreshAll()
        {
            List <Repo> reponames = new List <Repo>();

            foreach (Repo r in repos)
            {
                reponames.Add(r);
            }
            repos.Clear();
            foreach (Repo r in reponames)
            {
                RefreshProgress.SetProgressNoAnimation(0);

                repos.Add(new Repo(r.url, RefreshProgress, r.srchdir, r.debloc));
                RefreshProgress.SetProgressNoAnimation(100);
            }
        }
示例#5
0
        /// <inheritdoc/>
        public void OnRefreshProgress(BaseItem item, double progress)
        {
            var id = item.Id;

            _logger.LogDebug("OnRefreshProgress {0} {1}", id.ToString("N", CultureInfo.InvariantCulture), progress);

            // TODO: Need to hunt down the conditions for this happening
            _activeRefreshes.AddOrUpdate(
                id,
                (_) => throw new Exception(
                    string.Format(
                        CultureInfo.InvariantCulture,
                        "Cannot update refresh progress of item '{0}' ({1}) because a refresh for this item is not running",
                        item.GetType().Name,
                        item.Id.ToString("N", CultureInfo.InvariantCulture))),
                (_, __) => progress);

            RefreshProgress?.Invoke(this, new GenericEventArgs <Tuple <BaseItem, double> >(new Tuple <BaseItem, double>(item, progress)));
        }
示例#6
0
        public void OnRefreshProgress(BaseItem item, double progress)
        {
            //_logger.LogInformation("OnRefreshProgress {0} {1}", item.Id.ToString("N", CultureInfo.InvariantCulture), progress);
            var id = item.Id;

            lock (_activeRefreshes)
            {
                if (_activeRefreshes.ContainsKey(id))
                {
                    _activeRefreshes[id] = progress;

                    RefreshProgress?.Invoke(this, new GenericEventArgs <Tuple <BaseItem, double> >(new Tuple <BaseItem, double>(item, progress)));
                }
                else
                {
                    // TODO: Need to hunt down the conditions for this happening
                    //throw new Exception(string.Format("Refresh for item {0} {1} is not in progress", item.GetType().Name, item.Id.ToString("N", CultureInfo.InvariantCulture)));
                }
            }
        }
        private void UpdateDialog()
        {
            if (this.InvokeRequired)
            {
                RefreshProgress callback = new RefreshProgress(UpdateDialog);
                this.Invoke(callback);
            }
            else
            {
                if (!status.Section.Equals(""))
                {
                    lblSection.Text = status.Section;
                }
                if (!status.SectionStatus.Equals(""))
                {
                    lblSectionStatus.Text = status.SectionStatus;
                    justSectionStatusText = status.SectionStatus;
                }
                else if(status.MaxProgress > 0)
                {
                    lblSectionStatus.Text = justSectionStatusText + " (" + status.CurrentProgress + "/" +
                        status.MaxProgress + ")";
                }
                numDits = 0;
                if (status.MaxProgress > 0)
                {
                    if (prgProgress.Value > status.MaxProgress) { prgProgress.Value = status.MaxProgress; }
                    prgProgress.Maximum = status.MaxProgress;
                }
                if (status.CurrentProgress >= 0)
                {
                    try
                    {
                        prgProgress.Value = status.CurrentProgress;
                    }
                    catch (ArgumentException)
                    {
                        // If this exception occurs then just leave progress where it is.
                    }
                }
                if (!sections.Contains(status.Section) && !status.Section.Equals(""))
                {
                    lstStatusHistory.Items.Add(status.Section);
                    SetHorizScroll();
                    sections.Add(status.Section);

                    lastSectStatus = "";
                    //lstStatusHistory.SelectedIndex = lstStatusHistory.Items.Count - 1;
                }
                if (!status.SectionStatus.Equals(lastSectStatus) && !status.SectionStatus.Equals(""))
                {
                    lstStatusHistory.Items.Add("\t" + status.SectionStatus);
                    SetHorizScroll();
                    lastSectStatus = status.SectionStatus;
                    //lstStatusHistory.SelectedIndex = lstStatusHistory.Items.Count - 1;
                }

                if (status.SubProgressDescription.Length > 0)
                {
                    prgSubProgress.Enabled = true;
                    prgSubProgress.Maximum = status.MaxSubProgress;
                    prgSubProgress.Value = status.CurrentSubProgress;
                    lblSubProgress.Text = status.SubProgressDescription;
                }
                else
                {
                    lblSubProgress.Text = "";
                    prgSubProgress.Value = 0;
                    prgSubProgress.Maximum = 0;
                    prgSubProgress.Enabled = false;
                }

                if (status.Done)
                {
                    timer1.Stop();
                    lblSectionStatus.Text = justSectionStatusText;
                    btnOk.Visible = true;
                }
            }
        }
        private void UpdateDialog()
        {
            if (this.InvokeRequired)
            {
                RefreshProgress callback = new RefreshProgress(UpdateDialog);
                this.Invoke(callback);
            }
            else
            {
                _numDits = 0;
                _justStatus = _status.Section +
                    (_status.SectionStatus.Equals("") ? "" : " - " + _status.SectionStatus);
                lblStatus.Text = _justStatus;

                if (_status.Done)
                {
                    this.Close();
                }
            }
        }