static void Main(string[] args) { Uis myUi = new Uis(); ApplicationHelpers applicationHelpers = new ApplicationHelpers(); if (Uis.TryParse(args[0], out myUi)) { Functions helper = new Functions(myUi); applicationHelpers.StartCaffeine(); int sampleNo = 1; ProductList productList = helper.GetSamplesList(args); bool handleSampleReg = false; if (args.Count() > 2) { if (!bool.TryParse(args[2], out handleSampleReg)) { handleSampleReg = false; } } while (sampleNo < productList.TotalSamples || productList.TotalSamples == 0) { foreach (Product product in productList.Products) { if (!string.IsNullOrEmpty(product.Name)) { helper.SelectProduct(product.Name); } for (int i = 0; i < productList.SamplesPrProduct; i++) { helper.ClickStartStopButton(); if (handleSampleReg) { helper.HandleSampleRegistration(); } Console.Clear(); Console.WriteLine("Running Sample number {0}", sampleNo); helper.WaitForSample(productList.TimeBetweenSamples); sampleNo++; } } } } else { Console.WriteLine("{0} is not a valid UI, check command parameters", args[0]); } }
public Functions(Uis appToRun) { logger = new Logger(); ApplicationHelpers = new ApplicationHelpers(); logger.LogInfo($"Creating a new instance of functions for {appToRun}"); switch (appToRun) { case Uis.MeatMaster2: this.MainWindow = ApplicationHelpers.GetMainWindow(MeatMaster2UiItems.Mm2ProcessName, MeatMaster2UiItems.Mm2MainWindowName); this.StartStopButton = MeatMaster2UiItems.Mm2StartStopButton; this.SelectProductsDialogName = UiItems.AdvancedSelectProductDialogName; this.ProductList = UiItems.AdvancedProductsList; this.SelectProductDialogIsUpdated = false; break; case Uis.pNova: this.MainWindow = ApplicationHelpers.GetMainWindow(UiItems.ProFossProcessName, UiItems.PnovaMainWindowName); this.StartStopButton = UiItems.PnovaStartStopButton; break; case Uis.Advanced: this.MainWindow = ApplicationHelpers.GetMainWindow(UiItems.AdvancedUiProcessName, UiItems.BenchMainWindowName); this.StartStopButton = UiItems.AdvancedUiStartStopButton; this.SelectProductsDialogName = UiItems.AdvancedSelectProductDialogName; this.ProductList = UiItems.AdvancedProductsList; this.SelectProductDialogIsUpdated = true; break; case Uis.Metrohm: this.MainWindow = ApplicationHelpers.GetMainWindow(UiItems.MetrohmProcessName, UiItems.BenchMainWindowName); this.StartStopButton = UiItems.AdvancedUiStartStopButton; this.SelectProductsDialogName = UiItems.AdvancedSelectProductDialogName; this.ProductList = UiItems.AdvancedProductsList; this.SelectProductDialogIsUpdated = true; break; case Uis.Mini: this.MainWindow = ApplicationHelpers.GetMainWindow(UiItems.MiniUiProcessName, UiItems.BenchMainWindowName); this.StartStopButton = UiItems.MiniUiStartStopButton; this.SelectProductsDialogName = UiItems.MiniUiSelectProductsDialogName; this.ProductList = UiItems.MiniUiProductsList; this.SelectProductDialogIsUpdated = false; break; case Uis.Matilde: this.MainWindow = ApplicationHelpers.GetMainWindow(UiItems.MatildeProcessName, UiItems.PnovaMainWindowName); break; default: break; } }