예제 #1
0
        private void btnVPNOptionsList_Click(object sender, EventArgs e)
        {
            frmVPNOptions fVPNOptions = new frmVPNOptions();

            fVPNOptions.Settings = settings;
            fVPNOptions.ShowDialog();
        }
예제 #2
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;
                }
            });
        }