Пример #1
0
 public Task GenerateProcDATOPJForSingleTestCondition(DeviceBatchVM DBVM, string testCondition)
 {
     return(Task.Run(() =>
     {
         KillAllOriginApps();
         dbvm = DBVM;
         originApp = new Application
         {
             Visible = MAINWND_VISIBLE.MAINWND_SHOW,
         };
         originApp.Reset();
         ConstructSingleTCDirectory(testCondition);
         foreach (Device d in dbvm.TheDeviceBatch.Devices)
         {
             originApp.ActiveFolder = originApp.RootFolder.Folders.FolderFromPath(d.Label);
             var ss = d.DeviceLJVScanSummaries.Where(x => x.TestCondition == testCondition).FirstOrDefault();
             if (ss != null)
             {
                 activeSheetName = string.Concat("sheet", ss.TestCondition, d.BatchIndex);
                 var charsToRemove = new string[] { "-", ".", "_" };
                 foreach (var c in charsToRemove)
                 {
                     activeSheetName = activeSheetName.Replace(c, string.Empty);
                 }
                 Debug.WriteLine("sn: " + activeSheetName);
                 ConstructSingleTCSheetsPlots(new LJVScanSummaryVM(ss), activeSheetName);
             }
         }
         SaveOPJAndRelease(testCondition);
     }));
 }
Пример #2
0
        public void BatchDeleteTest()
        {
            Device v1 = new Device();
            Device v2 = new Device();

            using (var context = new DataContext(_seed, DBTypeEnum.Memory))
            {
                v1.ID        = "44tvMxOP9";
                v1.ProductId = AddProduct();
                v2.ProductId = v1.ProductId;
                context.Set <Device>().Add(v1);
                context.Set <Device>().Add(v2);
                context.SaveChanges();
            }

            PartialViewResult rv = (PartialViewResult)_controller.BatchDelete(new string[] { v1.ID.ToString(), v2.ID.ToString() });

            Assert.IsInstanceOfType(rv.Model, typeof(DeviceBatchVM));

            DeviceBatchVM vm = rv.Model as DeviceBatchVM;

            vm.Ids = new string[] { v1.ID.ToString(), v2.ID.ToString() };
            _controller.DoBatchDelete(vm, null);

            using (var context = new DataContext(_seed, DBTypeEnum.Memory))
            {
                Assert.AreEqual(context.Set <Device>().Count(), 0);
            }
        }
 public ActionResult DoBatchDelete(DeviceBatchVM vm, IFormCollection nouse)
 {
     if (!ModelState.IsValid || !vm.DoBatchDelete())
     {
         return(PartialView("BatchDelete", vm));
     }
     else
     {
         return(FFResult().CloseDialog().RefreshGrid().Alert("操作成功,共有" + vm.Ids.Length + "条数据被删除"));
     }
 }
Пример #4
0
        public void HandleNewDeviceBatch(object sender, DeviceBatchCreatedEventArgs e)
        {
            Debug.WriteLine("new batchId: " + e.batchId);
            var newDevBatch = ctx.DeviceBatches.Where(x => x.DeviceBatchId == e.batchId).FirstOrDefault();

            if (newDevBatch != null)
            {
                Debug.WriteLine("devbatch not null");
                DeviceBatchVM batchVM = new DeviceBatchVM(newDevBatch);
            }
            UpdateDeviceBatches();
        }
        public static void UpdatePlotsForDeviceBatch(DeviceBatchVM DBVM)
        {
            DevicePlotVM plotVM;

            //first, make sure that we have folders for each test condition
            foreach (string tc in DBVM.TestConditions)
            {
                var testConditionPath = string.Concat(DBVM.TheDeviceBatch.FilePath, @"\", tc, @"\OxyPlots");
                Debug.WriteLine(testConditionPath);
                if (!File.Exists(testConditionPath))//create folders in which to store our bitmaps if it doesn't exist
                {
                    Directory.CreateDirectory(testConditionPath);
                    Directory.CreateDirectory(string.Concat(testConditionPath, @"\L-J-V\"));
                    Directory.CreateDirectory(string.Concat(testConditionPath, @"\J-V\"));
                    Directory.CreateDirectory(string.Concat(testConditionPath, @"\EQE-L\"));
                    Directory.CreateDirectory(string.Concat(testConditionPath, @"\EQE-J\"));
                }
                //next, cycle through each LJVScanSummary and generate bitmaps using OxyPlot
                foreach (Device d in DBVM.TheDeviceBatch.Devices)
                {
                    plotVM = new DevicePlotVM(d);
                    plotVM.SelectedTestCondition = tc;
                    plotVM.LJVPlotVM1.SaveLJVPlotBitmap(string.Concat(testConditionPath, @"\L-J-V\", d.Label, ".jpg"));
                    plotVM.LJVPlotVM1.SaveEQELPlotBitmap(string.Concat(testConditionPath, @"\EQE-L\", d.Label, ".jpg"));
                    plotVM.LJVPlotVM1.SaveEQEJPlotBitmap(string.Concat(testConditionPath, @"\EQE-J\", d.Label, ".jpg"));
                    plotVM.LJVPlotVM1.SaveJVPlotBitmap(string.Concat(testConditionPath, @"\J-V\", d.Label, ".jpg"));
                }
            }
            var agingPath = string.Concat(DBVM.TheDeviceBatch.FilePath, @"\Aging Plots\");

            Directory.CreateDirectory(string.Concat(agingPath, @"\L-J-V\"));
            Directory.CreateDirectory(string.Concat(agingPath, @"\J-V\"));
            Directory.CreateDirectory(string.Concat(agingPath, @"\EQE-L\"));
            Directory.CreateDirectory(string.Concat(agingPath, @"\EQE-J\"));
            Directory.CreateDirectory(string.Concat(agingPath, @"\EL Spectra\"));

            foreach (Device d in DBVM.TheDeviceBatch.Devices)
            {
                plotVM = new DevicePlotVM(d);
                plotVM.ActiveUserControl = plotVM.ControlsDict["Aging"];

                foreach (Pixel p in d.Pixels)
                {
                    plotVM.SelectedPixel = p;
                    plotVM.LJVPlotVM1.SaveLJVPlotBitmap(string.Concat(agingPath, @"\L-J-V\", d.Label, "_", p.Site, ".jpg"));
                    plotVM.LJVPlotVM1.SaveJVPlotBitmap(string.Concat(agingPath, @"\J-V\", d.Label, "_", p.Site, ".jpg"));
                    plotVM.LJVPlotVM1.SaveEQELPlotBitmap(string.Concat(agingPath, @"\EQE-L\", d.Label, "_", p.Site, ".jpg"));
                    plotVM.LJVPlotVM1.SaveEQEJPlotBitmap(string.Concat(agingPath, @"\EQE-J\", d.Label, "_", p.Site, ".jpg"));
                    plotVM.TheELSpecPlotVM.SaveELSpeclotBitmap(string.Concat(agingPath, @"\EL Spectra\", d.Label, "_", p.Site, ".jpg"));
                }
            }
        }
Пример #6
0
 public Task GenerateSingleTCComparePixOPJ(DeviceBatchVM DBVM, string testCondition)
 {
     return(Task.Run(() =>
     {
         dbvm = DBVM;
         originApp = new Application
         {
             Visible = MAINWND_VISIBLE.MAINWND_SHOW,
         };
         originApp.Reset();
         activeTestCondition = testCondition;
         PopulateCompareSheetThenPlotXY(ProcDATField.Voltage, ProcDATField.CurrentDensity, "JV", AxisType.Logarithmic, AxisType.Logarithmic);
         PopulateCompareSheetThenPlotXY(ProcDATField.CurrentDensity, ProcDATField.EQE, "EQEJ");
         //PopulateCompareSheetThenPlotXY(ProcDATField.Luminance, ProcDATField.EQE, "EQEL");
         PopulateCompareSheetThenPlotXY(ProcDATField.CurrentDensity, ProcDATField.CurrentEff, "CEJ");
         //PopulateCompareSheetThenPlotXY(ProcDATField.Luminance, ProcDATField.CurrentEff, "CEL");
         SaveOPJAndRelease(string.Concat("Compare_", testCondition));
     }));
 }
Пример #7
0
 public async Task ScanSelectedDevices(CancellationToken token = new CancellationToken())
 {
     await Task.Run(async() =>
     {
         InstrumentService.LJVScanCoordinator.TheRasPiController.PiInitializeExecute();
         //hardcoding delays because too lazy to develop RasPi TCP update messaging
         await Task.Delay(delaysDict["Initialize"]).ConfigureAwait(false);
         //await Task.Delay(new TimeSpan(13, 0, 0));
         int numberOfDevicesToScan = 0;
         foreach (SingleDeviceScanVM sdsvm in ScanVMs)
         {
             if (sdsvm.ShouldBeScanned)
             {
                 numberOfDevicesToScan++;
             }
         }
         int scannedDeviceCounter = 1;
         foreach (SingleDeviceScanVM sdsvm in ScanVMs)
         {
             if (sdsvm.ShouldBeScanned && !token.IsCancellationRequested)
             {
                 ActiveScanVM = sdsvm;
                 sdsvm.ActivateThisVM();
                 await sdsvm.ScanAllPixels(token).ConfigureAwait(false);
                 if (scannedDeviceCounter < numberOfDevicesToScan && !token.IsCancellationRequested)
                 {
                     InstrumentService.LJVScanCoordinator.TheRasPiController.PiSwapExecute();
                     await Task.Delay(delaysDict["Swap"]).ConfigureAwait(false);
                 }
                 else if (scannedDeviceCounter == numberOfDevicesToScan || token.IsCancellationRequested)
                 {
                     InstrumentService.LJVScanCoordinator.TheRasPiController.PiIdleExecute();
                 }
                 else
                 {
                     Debug.WriteLine("Something screwy happened");
                 }
                 sdsvm.DeactivateThisVM();
                 scannedDeviceCounter++;
             }
         }
         if (!token.IsCancellationRequested)
         {
             try
             {
                 var dbvm = new DeviceBatchVM(theDeviceBatch);
                 await OriginService.OriginController.GenerateSingleTCComparePixOPJ(dbvm, BatchScanSpec.TestCondition);
                 await OriginService.OriginController.GenerateProcDATOPJForSingleTestCondition(dbvm, BatchScanSpec.TestCondition);
                 await OriginService.OriginController.GenerateSingleTCCompareStatsOPJ(dbvm, BatchScanSpec.TestCondition);
                 Application.Current.Dispatcher.Invoke((Action) delegate
                 {
                     Debug.WriteLine("updating oxyplots for devbatch: " + dbvm.TheDeviceBatch.Name);
                     dbvm.UpdatePlotBitmapsExecute(dbvm);
                     //dbvm.OrganizeDataByDevicePixel();
                 });
             }
             catch (Exception e)
             {
                 Debug.WriteLine("DeviceBatchScanVM ScanSelectedDevices exception: " + e.ToString());
             }
         }
     }).ConfigureAwait(false);
 }