Ejemplo n.º 1
0
        void mw_pass_StatusChanged(object sender, WorkerStatusEventArgs e)
        {
            Invoke((MethodInvoker) delegate
            {
                lvLog.Items.Add(e.Message);

                Color c = Color.Brown;

                if (e.Status == WorkerStatus.Start)
                {
                    pbLogo.Visible       = false;
                    pbConnecting.Visible = true;
                    DisableAllButtons();
                }

                if ((e.Status == WorkerStatus.FatalError) ||
                    (e.Status == WorkerStatus.CompleteAll))
                {
                    pbLogo.Visible       = true;
                    pbConnecting.Visible = false;
                    EnableAllButtons();
                }

                switch (e.Status)
                {
                case WorkerStatus.Start: c = Color.LightSteelBlue; break;

                case WorkerStatus.Process: c = Color.DarkGray; break;

                case WorkerStatus.Complete: c = Color.MediumSeaGreen; break;

                case WorkerStatus.CompleteAll: c = Color.LimeGreen; break;

                case WorkerStatus.NotComplete: c = Color.Yellow; break;

                case WorkerStatus.FatalError: c = Color.Red; break;

                case WorkerStatus.Wait: c = Color.White; break;
                }

                lvLog.Items[lvLog.Items.Count - 1].ForeColor = c;
                lvLog.TopItem = lvLog.Items[lvLog.Items.Count - 1];

                if (e.EventCode == "PASSWORD")
                {
                    frmSavePassword fSavePassword = new frmSavePassword();
                    fSavePassword.Settings        = ((MainWorker)sender).Settings;
                    fSavePassword.Workdir         = MainWorker.Workdir;
                    fSavePassword.Password        = ((MainWorker)sender).RecognizedPass;
                    fSavePassword.ShowDialog();
                    ((MainWorker)sender).CancelFlag     = fSavePassword.Cancelled;
                    ((MainWorker)sender).RecognizedPass = fSavePassword.Password;
                }
            });
        }
Ejemplo n.º 2
0
        private void StatusChange(WorkerStatus Status, string stMessage)
        {
            WorkerStatusEventArgs e = new WorkerStatusEventArgs();

            e.Status  = Status;
            e.Message = stMessage;
            if (StatusChanged != null)
            {
                StatusChanged(this, e);
            }
        }
Ejemplo n.º 3
0
        void mw_StatusChanged(object sender, WorkerStatusEventArgs e)
        {
            Invoke((MethodInvoker) delegate
            {
                lvLog.Items.Add(e.Message);

                Color c = Color.Brown;

                if (e.Status == WorkerStatus.Start)
                {
                    pbLogo.Visible       = false;
                    pbConnecting.Visible = true;
                    DisableAllButtons();
                }

                if ((e.Status == WorkerStatus.FatalError) ||
                    (e.Status == WorkerStatus.CompleteAll))
                {
                    pbLogo.Visible       = true;
                    pbConnecting.Visible = false;
                    EnableAllButtons();
                }

                switch (e.Status)
                {
                case WorkerStatus.Start: c = Color.LightSteelBlue; break;

                case WorkerStatus.Process: c = Color.DarkGray; break;

                case WorkerStatus.Complete: c = Color.MediumSeaGreen; break;

                case WorkerStatus.CompleteAll: c = Color.LimeGreen; break;

                case WorkerStatus.NotComplete: c = Color.Yellow; break;

                case WorkerStatus.FatalError: c = Color.Red; break;

                case WorkerStatus.Wait: c = Color.White; break;
                }

                lvLog.Items[lvLog.Items.Count - 1].ForeColor = c;
                lvLog.TopItem = lvLog.Items[lvLog.Items.Count - 1];

                if (e.EventCode == "OPTIONS")
                {
                    frmVPNOptions fVPNOptions = new frmVPNOptions();
                    fVPNOptions.Settings      = ((MainWorker)sender).Settings;
                    fVPNOptions.ShowDialog();
                    if (fVPNOptions.Cancelled)
                    {
                        ((MainWorker)sender).CancelFlag = true;
                    }
                }

                if (e.EventCode == "FILES")
                {
                    frmSelectFiles fSelectFiles = new frmSelectFiles();
                    fSelectFiles.Settings       = ((MainWorker)sender).Settings;
                    fSelectFiles.OVPNList       = ((MainWorker)sender).OVPNList;
                    fSelectFiles.ShowDialog();
                    if (fSelectFiles.Cancelled)
                    {
                        ((MainWorker)sender).CancelFlag = true;
                    }
                    ((MainWorker)sender).SelectedFiles = fSelectFiles.SelectFilesList;
                }
            });
        }