Beispiel #1
0
        public static void UpdateCurrentProgress(long Value, double Speed)
        {
            if (Value < 0 || Value > 100)
            {
                return;
            }

            Globals.packageDownloader.currentProgress.Value    = Convert.ToInt32(Value);
            Globals.packageDownloader.currentProgressText.Text = Texts.GetText(Texts.Keys.CURRENTPROGRESS, Value, Speed.ToString("0.00"));
        }
Beispiel #2
0
        public static void UpdateCompleteProgress(long Value)
        {
            if (Value < 0 || Value > 100)
            {
                return;
            }

            Globals.packageDownloader.completeProgress.Value    = Convert.ToInt32(Value);
            Globals.packageDownloader.completeProgressText.Text = Texts.GetText(Texts.Keys.COMPLETEPROGRESS, Value);
        }
 private static void backgroundWorker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
 {
     if (!Convert.ToBoolean(e.Result))
     {
         MessageBox.Show(Texts.GetText(Texts.Keys.NONETWORK));
         Application.Exit();
     }
     else
     {
         ListDownloader ldown = new ListDownloader();
         ldown.DownloadList();
     }
 }
Beispiel #4
0
        public void CheckFiles()
        {
            backgroundWorker.WorkerReportsProgress = true;

            backgroundWorker.DoWork             += backgroundWorker_DoWork;
            backgroundWorker.ProgressChanged    += backgroundWorker_ProgressChanged;
            backgroundWorker.RunWorkerCompleted += backgroundWorker_RunWorkerCompleted;

            if (backgroundWorker.IsBusy)
            {
                MessageBox.Show(Texts.GetText(Texts.Keys.UNKNOWNERROR, "CheckFiles isBusy"));
                Application.Exit();
            }
            else
            {
                backgroundWorker.RunWorkerAsync();
            }
        }
        public static void CheckNetwork()
        {
            Common.ChangeStatus(Texts.Keys.CONNECTING);

            BackgroundWorker backgroundWorker = new BackgroundWorker();

            backgroundWorker.DoWork             += backgroundWorker_DoWork;
            backgroundWorker.RunWorkerCompleted += backgroundWorker_RunWorkerCompleted;

            if (backgroundWorker.IsBusy)
            {
                MessageBox.Show(Texts.GetText(Texts.Keys.UNKNOWNERROR, "CheckNetwork isBusy"));
                Application.Exit();
            }
            else
            {
                backgroundWorker.RunWorkerAsync();
            }
        }
Beispiel #6
0
        public void DownloadList()
        {
            BackgroundWorker backgroundWorker = new BackgroundWorker();

            Common.ChangeStatus(Texts.Keys.LISTDOWNLOAD);

            backgroundWorker.DoWork             += backgroundWorker_DoWork;
            backgroundWorker.RunWorkerCompleted += backgroundWorker_RunWorkerCompleted;

            if (backgroundWorker.IsBusy)
            {
                MessageBox.Show(Texts.GetText(Texts.Keys.UNKNOWNERROR, "DownloadList isBusy"));
                Application.Exit();
            }
            else
            {
                backgroundWorker.RunWorkerAsync();
            }
        }
Beispiel #7
0
        public static void Start()
        {
            if (!File.Exists(Globals.BinaryName))
            {
                MessageBox.Show(Texts.GetText(Texts.Keys.MISSINGBINARY, Globals.BinaryName));
                return;
            }

            try
            {
                Process startProcess = new Process();
                startProcess.StartInfo.FileName        = Globals.BinaryName;
                startProcess.StartInfo.UseShellExecute = false;
                startProcess.Start();
            }
            catch
            {
                MessageBox.Show(Texts.GetText(Texts.Keys.CANNOTSTART, Globals.BinaryName));
                Application.Exit();
            }
        }
Beispiel #8
0
 private static void backgroundWorker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
 {
     if (!Convert.ToBoolean(e.Result))
     {
         MessageBox.Show(Texts.GetText(Texts.Keys.NONETWORK));
         Application.Exit();
     }
     else
     {
         IList listPackages = new List <string>();
         HtmlAgilityPack.HtmlDocument doc = new HtmlWeb().Load(Globals.ServerURL);
         foreach (HtmlNode link in doc.DocumentNode.SelectNodes("//a[@href]"))
         {
             if (link.InnerText != "../")
             {
                 listPackages.Add(link.InnerText.Remove(link.InnerText.Length - 1));
             }
         }
         Globals.packageSelector.packageList.DataSource = listPackages;
     }
     Common.ChangeStatus(Texts.Keys.LISTDOWNLOADCOMPLETED);
 }
Beispiel #9
0
 public static void ChangeStatus(Texts.Keys Key, params string[] Arguments)
 {
     Globals.toolStrip.Text = Texts.GetText(Key, Arguments);
 }