public WindowTesting(string transformerSerialNo, string jobName, JobInformation job, int testID = -1, bool istcp = false)
        {
            InitializeComponent();

            Started          = false;
            this.DataContext = this;
            currentJob       = WorkingSets.local.getJob(transformerSerialNo, jobName);
            TestingWorker    = new BackgroundWorker();
            TestingWorker.WorkerReportsProgress      = true;
            TestingWorker.WorkerSupportsCancellation = true;
            TestingWorker.DoWork             += TestingWorker_DoWork;
            TestingWorker.ProgressChanged    += TestingWorker_ProgressChanged;
            TestingWorker.RunWorkerCompleted += TestingWorker_RunWorkerCompleted;
            if (testID < 0)
            {
                worker = new TestingWorkerSender()
                {
                    Transformer      = currentJob.Transformer,
                    job              = currentJob,
                    MeasurementItems = Translator.JobList2MeasurementItems(currentJob).ToArray(),
                    CurrentItemIndex = 0,
                    ProgressPercent  = 0
                }
            }
            ;
            else
            {
                worker = TestingWorkerSender.FromDatabaseRows(testID);
            }
            StatusRefresh(worker);
            if (istcp)
            {
                currentJob.Information = job;
            }
            else
            {
                TestingInfoWindow testingInfoWindow = new TestingInfoWindow(worker);

                if (testingInfoWindow.ShowDialog() != true)
                {
                    // currentJob.Information = testingInfoWindow.Information;
                    inited = false;
                }
                else
                {
                    currentJob.Information = testingInfoWindow.Information;

                    var a = currentJob.Information.GetHashCode();
                    worker.job = currentJob;
                    inited     = true;
                }
            }
            SetgroupboxVisible(Whichgroupbox.READY);
        }
Beispiel #2
0
        public WindowTesting(string transformerSerialNo, string jobName, int testID = -1)
        {
            InitializeComponent();
            currentJob    = WorkingSets.local.getJob(transformerSerialNo, jobName);
            TestingWorker = new BackgroundWorker();
            TestingWorker.WorkerReportsProgress      = true;
            TestingWorker.WorkerSupportsCancellation = true;
            TestingWorker.DoWork             += TestingWorker_DoWork;
            TestingWorker.ProgressChanged    += TestingWorker_ProgressChanged;
            TestingWorker.RunWorkerCompleted += TestingWorker_RunWorkerCompleted;
            if (testID < 0)
            {
                worker = new TestingWorkerSender()
                {
                    Transformer      = currentJob.Transformer,
                    job              = currentJob,
                    MeasurementItems = Translator.JobList2MeasurementItems(currentJob).ToArray(),
                    CurrentItemIndex = 0,
                    ProgressPercent  = 0
                }
            }
            ;
            else
            {
                worker = TestingWorkerSender.FromDatabaseRows(testID);
            }
            StatusRefresh(worker);
            TestingInfoWindow testingInfoWindow = new TestingInfoWindow(worker);

            if (testingInfoWindow.ShowDialog() != true)
            {
                inited = false;
            }
            currentJob.Information = testingInfoWindow.Information;
            worker.job             = currentJob;
            inited = true;
        }
        private void JobConfire(object sender = null, RoutedEventArgs e = null)
        {
            if (!inited)
            {
                return;
            }
            if (HVWindingDCInsulationCheckBox == null)
            {
                return;
            }
            if (MVWindingDCInsulationCheckBox == null)
            {
                return;
            }
            if (LVWindingDCInsulationCheckBox == null)
            {
                return;
            }
            if (HVWindingCapacitanceCheckBox == null)
            {
                return;
            }
            if (MVWindingCapacitanceCheckBox == null)
            {
                return;
            }
            if (LVWindingCapacitanceCheckBox == null)
            {
                return;
            }
            if (HVWindingDCResistanceCheckBox == null)
            {
                return;
            }
            if (MVWindingDCResistanceCheckBox == null)
            {
                return;
            }
            if (LVWindingDCResistanceCheckBox == null)
            {
                return;
            }
            if (BushingDCInsulationCheckBox == null)
            {
                return;
            }
            if (BushingCapacitanceCheckBox == null)
            {
                return;
            }
            if (DCHvResistanceCurrentComboBox == null)
            {
                return;
            }
            if (DCMvResistanceCurrentComboBox == null)
            {
                return;
            }
            if (DCLvResistanceCurrentComboBox == null)
            {
                return;
            }
            if (ZCWindingDCInsulationCheckBox == null)
            {
                return;
            }
            if (OLTCCheckBox == null)
            {
                return;
            }
            if (OLTCRangeTextBox == null)
            {
                return;
            }
            if (OLTCDCResistanceCheckBox == null)
            {
                return;
            }
            if (OLTCSwitchingCheckBox == null)
            {
                return;
            }
            if (WorkList == null)
            {
                return;
            }
            if (DCInsulationTestVoltageComboBox == null)
            {
                return;
            }
            if (DCInsulationResThTextBox == null)
            {
                return;
            }
            if (DCInsulationARTextBox == null)
            {
                return;
            }
            if (CapacitanceTestVoltageComboBox == null)
            {
                return;
            }
            if (DCResistanceCurrentComboBox == null)
            {
                return;
            }
            if (BushingDCInsulationTestVoltageComboBox == null)
            {
                return;
            }
            if (BushingCapacitanceTestVoltageComboBox == null)
            {
                return;
            }
            if (Coreinsulation == null)
            {
                return;
            }
            if (Leakagecurrent == null)
            {
                return;
            }
            if (Shortcircuitimpedance == null)
            {
                return;
            }
            changed = true;

            JobList jobList = new JobList();

            jobList.Transformer = currentTransformer;

            jobList.DCInsulation.HVEnabled = (HVWindingDCInsulationCheckBox.IsChecked == true);
            jobList.DCInsulation.MVEnabled = (MVWindingDCInsulationCheckBox.IsChecked == true);
            jobList.DCInsulation.LVEnabled = (LVWindingDCInsulationCheckBox.IsChecked == true);

            jobList.Capacitance.HVEnabled = (HVWindingCapacitanceCheckBox.IsChecked == true);
            jobList.Capacitance.MVEnabled = (MVWindingCapacitanceCheckBox.IsChecked == true);
            jobList.Capacitance.LVEnabled = (LVWindingCapacitanceCheckBox.IsChecked == true);

            jobList.DCResistance.HVEnabled = (HVWindingDCResistanceCheckBox.IsChecked == true);
            jobList.DCResistance.MVEnabled = (MVWindingDCResistanceCheckBox.IsChecked == true);
            jobList.DCResistance.LVEnabled = (LVWindingDCResistanceCheckBox.IsChecked == true);
            jobList.DCResistance.ZcEnable  = (ZCWindingDCInsulationCheckBox.IsChecked == true);

            jobList.Shortcircuitimpedance = (Shortcircuitimpedance.IsChecked == true);
            jobList.CoreDCInsulation      = (Coreinsulation.IsChecked == true);
            jobList.LossDcresistance      = (Leakagecurrent.IsChecked == true);

            jobList.Bushing.DCInsulation = (BushingDCInsulationCheckBox.IsChecked == true);
            jobList.Bushing.Capacitance  = (BushingCapacitanceCheckBox.IsChecked == true);

            jobList.OLTC.Range              = int.Parse(OLTCRangeTextBox.Text);
            jobList.OLTC.MulRange           = int.Parse(OLTCRangeMulTextBox.Text);
            jobList.OLTC.DCResistance       = (OLTCDCResistanceCheckBox.IsChecked == true);
            jobList.OLTC.SwitchingCharacter = (OLTCSwitchingCheckBox.IsChecked == true);

            jobList.Parameter.BushingCapacitanceVoltage   = (int)Convert.ToDouble(BushingCapacitanceTestVoltageComboBox.SelectionBoxItem.ToString().Replace("kV", "").Trim()) * 1000;
            jobList.Parameter.BushingDCInsulationVoltage  = (int)Convert.ToDouble(BushingDCInsulationTestVoltageComboBox.SelectionBoxItem.ToString().Replace("kV", "").Trim()) * 1000;
            jobList.Parameter.CapacitanceVoltage          = (int)Convert.ToDouble(CapacitanceTestVoltageComboBox.SelectionBoxItem.ToString().Replace("kV", "").Trim()) * 1000;
            jobList.Parameter.DCInsulationAbsorptionRatio = 5;
            jobList.Parameter.DCInsulationResistance      = 5;
            jobList.Parameter.DCInsulationVoltage         = (int)Convert.ToDouble(DCInsulationTestVoltageComboBox.SelectionBoxItem.ToString().Replace("kV", "").Trim()) * 1000;
            jobList.Parameter.DCResistanceCurrent         = Getc(DCResistanceCurrentComboBox);
            jobList.Parameter.DCHvResistanceCurrent       = Getc(DCHvResistanceCurrentComboBox);
            jobList.Parameter.DCMvResistanceCurrent       = Getc(DCMvResistanceCurrentComboBox);
            jobList.Parameter.DCLvResistanceCurrent       = Getc(DCLvResistanceCurrentComboBox);
            #region
            var miList = Translator.JobList2MeasurementItems(jobList);
            TestingInfoWindow testingInfo = new TestingInfoWindow(miList);
            JobList           job         = jobList;
            job.id = GetId();
            if (testingInfo.ShowDialog() == true)
            {
                job.Information = testingInfo.Information;
            }
            UseUpanDoWork.LocalUsb.Reinitialize();
            foreach (var mi in miList)
            {
                UseUpanDoWork.LocalUsb.StartBuiltTestData(mi, jobList);
            }
            //自动检索Upan
#if true
            string[] drives = Environment.GetLogicalDrives();
            UpanForWriteToFile.writefile(drives[drives.Length - 1], "List.lis", job, miList, JobNameTextBox.Text.Trim());
#endif
            // UpanForWriteToFile.writefile("D:\\", "List.lis", jobList, miList);
            List <string> miListString = new List <string>();
            foreach (var mi in miList)
            {
                miListString.Add(mi.Description);
            }
            WorkList.ItemsSource = miListString;
            #endregion
        }