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

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

            Globals.pForm.completeProgress.Value    = Convert.ToInt32(Value);
            Globals.pForm.completeProgressText.Text = Texts.GetText(Texts.Keys.COMPLETEPROGRESS, Value);
        }
示例#3
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
     {
         ListDownloader.DownloadList();
     }
 }
示例#4
0
        public static 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();
            }
        }
示例#5
0
        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();
            }
        }
示例#6
0
        public static 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();
            }
        }
示例#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();
            }
        }
示例#8
0
 public static void ChangeStatus(Texts.Keys Key, params string[] Arguments)
 {
     Globals.pForm.Status.Text = Texts.GetText(Key, Arguments);
 }