/// <summary> /// Button Event that creates the data base of SPS, Schutzkreis and Safety /// </summary> private void Button_CreateDB(object sender, RoutedEventArgs e) { WriteSavingLabelText("Creating DB's..."); BlocksCreated = new List <string>(); bool importToTia = (bool)cbImportToTia.IsChecked; EngValues = new List <EngAssist>(); RetrieveValues(); EngValues = newEngValues; NetworkDBMaker.GenerateDataBaseThemePlate(); sheetCounterX = 0; foreach (string s in NameS) { if (s == "PLC Tags") { ExcelManager.PLC_Tags(WorkSheetS[sheetCounterX]); } if (s == "User Config") { ExcelManager.EngConfig(WorkSheetS[sheetCounterX]); } sheetCounterX += 1; } sheetCounterX = 0; foreach (string s in NameS) { switch (s) { case "SPS": ExcelManager.SPS(WorkSheetS[sheetCounterX]); NetworkDBMaker.PopulateDB(Variables, "SPS", savePath); break; case "Schutzkreis": ExcelManager.Schutzkreis(WorkSheetS[sheetCounterX]); NetworkDBMaker.PopulateDB(Variables, "Schutzkreis", savePath); break; case "F> Safety <F": ExcelManager.Safety_Standart(WorkSheetS[sheetCounterX]); NetworkDBMaker.PopulateDB(Variables, "Safety_Standart", savePath); ExcelManager.Standart_Safety(WorkSheetS[sheetCounterX]); NetworkDBMaker.PopulateDB(Variables, "Standart_Safety", savePath); break; case "ARG_Typ_Strg": ExcelManager.ARG(WorkSheetS[sheetCounterX]); NetworkDBMaker.PopulateDB(Variables, "ARG", savePath); break; case "Station": ExcelManager.StationName1(WorkSheetS[sheetCounterX]); NetworkDBMaker.PopulateDB(Variables, "Station1", savePath); ExcelManager.StationName2(WorkSheetS[sheetCounterX]); NetworkDBMaker.PopulateDB(Variables, "Station2", savePath); ExcelManager.StationName3(WorkSheetS[sheetCounterX]); NetworkDBMaker.PopulateDB(Variables, "Station3", savePath); break; } sheetCounterX += 1; } BlocksCreated = BlocksCreated.Distinct().ToList(); File.Delete("C:/Temp/DBThemePlate.xml"); if (importToTia) { using (var access = tiaPortal.ExclusiveAccess("Importing elements")) { ExcelManager.BlocksImporter(savePath, current, "2_Safety", BlocksCreated); ExcelManager.BlocksImporter(savePath, current, "40_Betriebsarten", BlocksCreated); ExcelManager.BlocksImporter(savePath, current, "50_Stationen", BlocksCreated); ExcelManager.BlocksImporter(savePath, current, "100_ARG_Typ_Strg", BlocksCreated); } } WriteSavingLabelText(""); }